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 Side-by-Side Diffs Ignore Whitespace Patch

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

    16     16     /// SQLite implementation of DbParameter.
    17     17     /// </summary>
    18     18     public sealed class SQLiteParameter : DbParameter, ICloneable
    19     19     {
    20     20       /// <summary>
    21     21       /// The data type of the parameter
    22     22       /// </summary>
    23         -    internal int            _dbType;
           23  +    internal DbType        _dbType;
    24     24       /// <summary>
    25     25       /// The version information for mapping the parameter
    26     26       /// </summary>
    27     27       private DataRowVersion _rowVersion;
    28     28       /// <summary>
    29     29       /// The value of the data in the parameter
    30     30       /// </summary>
................................................................................
   177    177       /// <param name="parameterType">The data type</param>
   178    178       /// <param name="parameterSize">The size of the parameter</param>
   179    179       /// <param name="sourceColumn">The source column</param>
   180    180       /// <param name="rowVersion">The row version information</param>
   181    181       public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)      
   182    182       {
   183    183         _parameterName = parameterName;
   184         -      _dbType = (int)parameterType;
          184  +      _dbType = parameterType;
   185    185         _sourceColumn = sourceColumn;
   186    186         _rowVersion = rowVersion;
   187    187         _dataSize = parameterSize;
   188    188         _nullable = true;
   189    189       }
   190    190   
   191    191       private SQLiteParameter(SQLiteParameter source)
................................................................................
   297    297       [DbProviderSpecificTypeProperty(true)]
   298    298       [RefreshProperties(RefreshProperties.All)]
   299    299   #endif
   300    300       public override DbType DbType
   301    301       {
   302    302         get
   303    303         {
   304         -        if (_dbType == -1)
          304  +        if (_dbType == (DbType)-1)
   305    305           {
   306    306             if (_objValue != null && _objValue != DBNull.Value)
   307    307             {
   308    308               return SQLiteConvert.TypeToDbType(_objValue.GetType());
   309    309             }
   310    310             return DbType.String; // Unassigned default value is String
   311    311           }
   312    312           return (DbType)_dbType;
   313    313         }
   314    314         set
   315    315         {
   316         -        _dbType = (int)value;
          316  +        _dbType = value;
   317    317         }
   318    318       }
   319    319   
   320    320       /// <summary>
   321    321       /// Supports only input parameters
   322    322       /// </summary>
   323    323       public override ParameterDirection Direction
................................................................................
   349    349       }
   350    350   
   351    351       /// <summary>
   352    352       /// Resets the DbType of the parameter so it can be inferred from the value
   353    353       /// </summary>
   354    354       public override void ResetDbType()
   355    355       {
   356         -      _dbType = -1;
          356  +      _dbType = (DbType)-1;
   357    357       }
   358    358   
   359    359       /// <summary>
   360    360       /// Returns the size of the parameter
   361    361       /// </summary>
   362    362   #if !PLATFORM_COMPACTFRAMEWORK
   363    363       [DefaultValue((int)0)]
................................................................................
   430    430         get
   431    431         {
   432    432           return _objValue;
   433    433         }
   434    434         set
   435    435         {
   436    436           _objValue = value;
   437         -        if (_dbType == -1 && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype 
   438         -          _dbType = (int)SQLiteConvert.TypeToDbType(_objValue.GetType());
          437  +        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
          438  +          _dbType = SQLiteConvert.TypeToDbType(_objValue.GetType());
   439    439         }
   440    440       }
   441    441   
   442    442       /// <summary>
   443    443       /// Clones a parameter
   444    444       /// </summary>
   445    445       /// <returns>A new, unassociated SQLiteParameter</returns>