System.Data.SQLite
Check-in [69ed1c6104]
Not logged in

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

Overview
Comment:Remove superfluous conversions between int and DbType.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 69ed1c6104ba4f2dcd8e8aa599493f210b8e95f1
User & Date: mistachkin 2015-03-26 20:15:40
Context
2015-03-26
20:20
Make the DbType value of (-1) a constant in the parameter class. check-in: 30d638f582 user: mistachkin tags: trunk
20:15
Remove superfluous conversions between int and DbType. check-in: 69ed1c6104 user: mistachkin tags: trunk
00:16
Bump all version numbers to 1.0.97.0. Update version history docs. check-in: 548a7a1ecd user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteParameter.cs.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
...
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
  /// SQLite implementation of DbParameter.
  /// </summary>
  public sealed class SQLiteParameter : DbParameter, ICloneable
  {
    /// <summary>
    /// The data type of the parameter
    /// </summary>
    internal int            _dbType;
    /// <summary>
    /// The version information for mapping the parameter
    /// </summary>
    private DataRowVersion _rowVersion;
    /// <summary>
    /// The value of the data in the parameter
    /// </summary>
................................................................................
    /// <param name="parameterType">The data type</param>
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)      
    {
      _parameterName = parameterName;
      _dbType = (int)parameterType;
      _sourceColumn = sourceColumn;
      _rowVersion = rowVersion;
      _dataSize = parameterSize;
      _nullable = true;
    }

    private SQLiteParameter(SQLiteParameter source)
................................................................................
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {
        if (_dbType == -1)
        {
          if (_objValue != null && _objValue != DBNull.Value)
          {
            return SQLiteConvert.TypeToDbType(_objValue.GetType());
          }
          return DbType.String; // Unassigned default value is String
        }
        return (DbType)_dbType;
      }
      set
      {
        _dbType = (int)value;
      }
    }

    /// <summary>
    /// Supports only input parameters
    /// </summary>
    public override ParameterDirection Direction
................................................................................
    }

    /// <summary>
    /// Resets the DbType of the parameter so it can be inferred from the value
    /// </summary>
    public override void ResetDbType()
    {
      _dbType = -1;
    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]
................................................................................
      get
      {
        return _objValue;
      }
      set
      {
        _objValue = value;
        if (_dbType == -1 && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype 
          _dbType = (int)SQLiteConvert.TypeToDbType(_objValue.GetType());
      }
    }

    /// <summary>
    /// Clones a parameter
    /// </summary>
    /// <returns>A new, unassociated SQLiteParameter</returns>







|







 







|







 







|











|







 







|







 







|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
...
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
  /// SQLite implementation of DbParameter.
  /// </summary>
  public sealed class SQLiteParameter : DbParameter, ICloneable
  {
    /// <summary>
    /// The data type of the parameter
    /// </summary>
    internal DbType        _dbType;
    /// <summary>
    /// The version information for mapping the parameter
    /// </summary>
    private DataRowVersion _rowVersion;
    /// <summary>
    /// The value of the data in the parameter
    /// </summary>
................................................................................
    /// <param name="parameterType">The data type</param>
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)      
    {
      _parameterName = parameterName;
      _dbType = parameterType;
      _sourceColumn = sourceColumn;
      _rowVersion = rowVersion;
      _dataSize = parameterSize;
      _nullable = true;
    }

    private SQLiteParameter(SQLiteParameter source)
................................................................................
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {
        if (_dbType == (DbType)-1)
        {
          if (_objValue != null && _objValue != DBNull.Value)
          {
            return SQLiteConvert.TypeToDbType(_objValue.GetType());
          }
          return DbType.String; // Unassigned default value is String
        }
        return (DbType)_dbType;
      }
      set
      {
        _dbType = value;
      }
    }

    /// <summary>
    /// Supports only input parameters
    /// </summary>
    public override ParameterDirection Direction
................................................................................
    }

    /// <summary>
    /// Resets the DbType of the parameter so it can be inferred from the value
    /// </summary>
    public override void ResetDbType()
    {
      _dbType = (DbType)-1;
    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]
................................................................................
      get
      {
        return _objValue;
      }
      set
      {
        _objValue = value;
        if (_dbType == (DbType)-1 && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype
          _dbType = SQLiteConvert.TypeToDbType(_objValue.GetType());
      }
    }

    /// <summary>
    /// Clones a parameter
    /// </summary>
    /// <returns>A new, unassociated SQLiteParameter</returns>