System.Data.SQLite

Check-in [e268cdb240]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When looking up type callbacks, permit the parameter name to be used if the appropriate connection flag is set.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | customDataTypes
Files: files | file ages | folders
SHA1: e268cdb2400331a423f72fbbaa4158907ef19c6c
User & Date: mistachkin 2016-06-20 04:51:25.312
Context
2016-06-20
04:52
Add draft tests for parameter binding and data reader callbacks. Still needs cleanup. check-in: a07ba949c9 user: mistachkin tags: customDataTypes
04:51
When looking up type callbacks, permit the parameter name to be used if the appropriate connection flag is set. check-in: e268cdb240 user: mistachkin tags: customDataTypes
04:50
More improvements to test suite infrastructure helper procedures. check-in: 822b7c577c user: mistachkin tags: customDataTypes
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLiteBase.cs.
1172
1173
1174
1175
1176
1177
1178






1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
      /// <summary>
      /// If the database type name has not been explicitly set for the
      /// parameter specified, fallback to using the database type name
      /// associated with the <see cref="DbType" /> value.
      /// </summary>
      UseParameterDbTypeForTypeName = 0x800000000,







      /// <summary>
      /// Enable using per-connection mappings between type names and
      /// <see cref="SQLiteReadValueCallback" /> values.  Also see the
      /// <see cref="SQLiteConnection.ClearTypeCallbacks" />,
      /// <see cref="SQLiteConnection.TryGetTypeCallbacks" />, and
      /// <see cref="SQLiteConnection.SetTypeCallbacks" /> methods.
      /// </summary>
      UseConnectionReadValueCallbacks = 0x1000000000,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted).
      /// </summary>
      BindAndGetAllAsText = BindAllAsText | GetAllAsText,







>
>
>
>
>
>







|







1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
      /// <summary>
      /// If the database type name has not been explicitly set for the
      /// parameter specified, fallback to using the database type name
      /// associated with the <see cref="DbType" /> value.
      /// </summary>
      UseParameterDbTypeForTypeName = 0x800000000,

      /// <summary>
      /// If the database type name has not been explicitly set for the
      /// parameter specified, fallback to using the parameter name.
      /// </summary>
      UseParameterNameForTypeName = 0x1000000000,

      /// <summary>
      /// Enable using per-connection mappings between type names and
      /// <see cref="SQLiteReadValueCallback" /> values.  Also see the
      /// <see cref="SQLiteConnection.ClearTypeCallbacks" />,
      /// <see cref="SQLiteConnection.TryGetTypeCallbacks" />, and
      /// <see cref="SQLiteConnection.SetTypeCallbacks" /> methods.
      /// </summary>
      UseConnectionReadValueCallbacks = 0x2000000000,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted).
      /// </summary>
      BindAndGetAllAsText = BindAllAsText | GetAllAsText,
Changes to System.Data.SQLite/SQLiteStatement.cs.
307
308
309
310
311
312
313




314
315
316
317
318
319
320
321
322
323
324
325
326
327
328











329
330

331
332
333
334
335
336
337
                return;

            SQLiteConnection connection = GetConnection(this);

            if (connection == null)
                return;





            string typeName = parameter.TypeName;

            if (typeName == null)
            {
                //
                // NOTE: Are we allowed to fallback to using the database type
                //       name translated from the DbType?  If not, there is
                //       nothing else we can do.
                //
                if ((_flags & SQLiteConnectionFlags.UseParameterDbTypeForTypeName)
                        != SQLiteConnectionFlags.UseParameterDbTypeForTypeName)
                {
                    return;
                }












                typeName = SQLiteConvert.DbTypeToTypeName(
                    connection, parameter.DbType, _flags);

            }

            if (typeName == null)
                return;

            SQLiteTypeCallbacks callbacks;








>
>
>
>





|
<
|

|
|

|

|
>
>
>
>
>
>
>
>
>
>
>
|
|
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
                return;

            SQLiteConnection connection = GetConnection(this);

            if (connection == null)
                return;

            //
            // NOTE: First, always look for an explicitly set database type
            //       name.
            //
            string typeName = parameter.TypeName;

            if (typeName == null)
            {
                //
                // NOTE: Are we allowed to fallback to using the parameter name

                //       as the basis for looking up the binding callback?
                //
                if ((_flags & SQLiteConnectionFlags.UseParameterNameForTypeName)
                        == SQLiteConnectionFlags.UseParameterNameForTypeName)
                {
                    typeName = parameter.ParameterName;
                }
            }

            if (typeName == null)
            {
                //
                // NOTE: Are we allowed to fallback to using the database type
                //       name translated from the DbType as the basis for looking
                //       up the binding callback?
                //
                if ((_flags & SQLiteConnectionFlags.UseParameterDbTypeForTypeName)
                        == SQLiteConnectionFlags.UseParameterDbTypeForTypeName)
                {
                    typeName = SQLiteConvert.DbTypeToTypeName(
                        connection, parameter.DbType, _flags);
                }
            }

            if (typeName == null)
                return;

            SQLiteTypeCallbacks callbacks;