private PreparedSqlLiteInsertCommand CreateInsertCommand(SQLiteConnection conn, string extra) { Column[] cols = InsertColumns; string insertSql; if (!cols.Any() && Columns.Count() == 1 && Columns[0].IsAutoInc) { insertSql = string.Format("insert {1} into \"{0}\" default values", TableName, extra); } else { bool replacing = string.Compare(extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0; if (replacing) { cols = InsertOrReplaceColumns; } insertSql = string.Format("insert {3} into \"{0}\"({1}) values ({2})", TableName, string.Join(",", (from c in cols select "\"" + c.Name + "\"").ToArray()), string.Join(",", (from c in cols select "?").ToArray()), extra); } var insertCommand = new PreparedSqlLiteInsertCommand(_sqlitePlatform, conn); insertCommand.CommandText = insertSql; return(insertCommand); }
protected internal void Dispose() { if (_insertCommand != null) { _insertCommand.Dispose(); _insertCommand = null; } }
public PreparedSqlLiteInsertCommand GetInsertCommand(SQLiteConnection conn, string extra) { if (_insertCommand == null) { _insertCommand = CreateInsertCommand(conn, extra); _insertCommandExtra = extra; } else if (_insertCommandExtra != extra) { _insertCommand.Dispose(); _insertCommand = CreateInsertCommand(conn, extra); _insertCommandExtra = extra; } return(_insertCommand); }
public PreparedSqlLiteInsertCommand GetCommand(SQLiteConnection conn, string extra) { if (_insertCommand == null) { _insertCommand = CreateCommand(conn, extra); _insertCommandExtra = extra; } else if (_insertCommandExtra != extra) { _insertCommand.Dispose(); _insertCommand = CreateCommand(conn, extra); _insertCommandExtra = extra; } return _insertCommand; }
private PreparedSqlLiteInsertCommand CreateInsertCommand(SQLiteConnection conn, string extra) { Column[] cols = InsertColumns; string insertSql; if (!cols.Any() && Columns.Count() == 1 && Columns[0].IsAutoInc) { insertSql = string.Format("insert {1} into \"{0}\" default values", TableName, extra); } else { bool replacing = string.Compare(extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0; if (replacing) { cols = InsertOrReplaceColumns; } insertSql = string.Format("insert {3} into \"{0}\"({1}) values ({2})", TableName, string.Join(",", (from c in cols select "\"" + c.Name + "\"").ToArray()), string.Join(",", (from c in cols select "?").ToArray()), extra); } var insertCommand = new PreparedSqlLiteInsertCommand(_sqlitePlatform, conn); insertCommand.CommandText = insertSql; return insertCommand; }