public int IndexOf (SqliteParameter param) { return IndexOf (param.ParameterName); }
public void RemoveAt (SqliteParameter param) { RemoveAt (param.ParameterName); }
public bool Contains (SqliteParameter param) { return Contains (param.ParameterName); }
public SqliteParameter Add (SqliteParameter param) { Add ((object)param); return param; }
void SetParameter (string parameterName, SqliteParameter parameter) { if (this.Contains(parameterName)) numeric_param_list[(int) named_param_hash[parameterName]] = parameter; else if (parameterName.Length > 1 && this.Contains(parameterName.Substring(1))) numeric_param_list[(int) named_param_hash[parameterName.Substring(1)]] = parameter; else throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName); }
void SetParameter (int parameterIndex, SqliteParameter parameter) { if (this.Count >= parameterIndex+1) numeric_param_list[parameterIndex] = parameter; else throw new IndexOutOfRangeException("The specified parameter index does not exist: " + parameterIndex.ToString()); }
private void BindParameters3(Sqlite3.Vdbe pStmt) { if (sql_params == null) { return; } if (sql_params.Count == 0) { return; } int pcount = Sqlite3.sqlite3_bind_parameter_count(pStmt); for (int i = 1; i <= pcount; i++) { String name = Sqlite3.sqlite3_bind_parameter_name(pStmt, i); SqliteParameter param = null; if (name != null) { param = sql_params[name] as SqliteParameter; } else { param = sql_params[i - 1] as SqliteParameter; } if (param.Value == null) { Sqlite3.sqlite3_bind_null(pStmt, i); continue; } Type ptype = param.Value.GetType(); if (ptype.IsEnum) { ptype = Enum.GetUnderlyingType(ptype); } SqliteError err; if (ptype.Equals(typeof(String))) { String s = (String)param.Value; err = (SqliteError)Sqlite3.sqlite3_bind_text(pStmt, i, s, -1, null); } else if (ptype.Equals(typeof(DBNull))) { err = (SqliteError)Sqlite3.sqlite3_bind_null(pStmt, i); } else if (ptype.Equals(typeof(Boolean))) { bool b = (bool)param.Value; err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, b ? 1 : 0); } else if (ptype.Equals(typeof(Byte))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (Byte)param.Value); } else if (ptype.Equals(typeof(Char))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (Char)param.Value); } else if (ptype.IsEnum) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (Int32)param.Value); } else if (ptype.Equals(typeof(Int16))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (Int16)param.Value); } else if (ptype.Equals(typeof(Int32))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (Int32)param.Value); } else if (ptype.Equals(typeof(SByte))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (SByte)param.Value); } else if (ptype.Equals(typeof(UInt16))) { err = (SqliteError)Sqlite3.sqlite3_bind_int(pStmt, i, (UInt16)param.Value); } else if (ptype.Equals(typeof(DateTime))) { DateTime dt = (DateTime)param.Value; err = (SqliteError)Sqlite3.sqlite3_bind_text(pStmt, i, dt.ToString(), -1, null); } else if (ptype.Equals(typeof(Double))) { err = (SqliteError)Sqlite3.sqlite3_bind_double(pStmt, i, (Double)param.Value); } else if (ptype.Equals(typeof(Single))) { err = (SqliteError)Sqlite3.sqlite3_bind_double(pStmt, i, (Single)param.Value); } else if (ptype.Equals(typeof(UInt32))) { err = (SqliteError)Sqlite3.sqlite3_bind_int64(pStmt, i, (UInt32)param.Value); } else if (ptype.Equals(typeof(Int64))) { err = (SqliteError)Sqlite3.sqlite3_bind_int64(pStmt, i, (Int64)param.Value); } else if (ptype.Equals(typeof(Byte[]))) { err = (SqliteError)Sqlite3.sqlite3_bind_blob(pStmt, i, (byte[])param.Value, ((byte[])param.Value).Length, null); } else if (ptype.Equals(typeof(Guid))) { err = (SqliteError)Sqlite3.sqlite3_bind_text(pStmt, i, param.Value.ToString(), param.Value.ToString().Length, null); } else { throw new ApplicationException("Unkown Parameter Type"); } if (err != SqliteError.OK) { throw new ApplicationException("Sqlite error in bind " + err); } } }