Example #1
0
        /// <summary>
        /// Initialises the sql statement with a autoincrementing object
        /// </summary>
        private void InitialiseStatement(string tableName, ISupportsAutoIncrementingField supportsAutoIncrementingField)
        {
            _dbFieldList = new StringBuilder(_bo.Props.Count * 20);
            _dbValueList = new StringBuilder(_bo.Props.Count * 20);
            var statement = new InsertSqlStatement(_connection);

            statement.TableName = tableName;
            statement.SupportsAutoIncrementingField = supportsAutoIncrementingField;

            _insertSql = statement;

            _gen        = _connection.CreateParameterNameGenerator();
            _firstField = true;
        }
Example #2
0
 /// <summary>
 /// Constructor to initialise a new sql statement
 /// </summary>
 /// <param name="connection">A database connection</param>
 public SqlStatement(IDatabaseConnection connection)
 {
     if (connection == null) throw new ArgumentNullException("connection");
     _parameters = new List<IDbDataParameter>();
     DatabaseConnection = connection;
     _idbConnection = DatabaseConnection.GetConnection();
     if (_idbConnection != null)
     {
         _sampleCommand = _idbConnection.CreateCommand();
         _gen = connection.CreateParameterNameGenerator();
     }
     else
     {
         _gen = new ParameterNameGenerator(null);
     }
     _statement = new StringBuilder(100);
 }
Example #3
0
 /// <summary>
 /// Constructor to initialise a new sql statement
 /// </summary>
 /// <param name="connection">A database connection</param>
 public SqlStatement(IDatabaseConnection connection)
 {
     if (connection == null)
     {
         throw new ArgumentNullException("connection");
     }
     _parameters        = new List <IDbDataParameter>();
     DatabaseConnection = connection;
     _idbConnection     = DatabaseConnection.GetConnection();
     if (_idbConnection != null)
     {
         _sampleCommand = _idbConnection.CreateCommand();
         _gen           = connection.CreateParameterNameGenerator();
     }
     else
     {
         _gen = new ParameterNameGenerator(null);
     }
     _statement = new StringBuilder(100);
 }