Beispiel #1
0
 public static Error sqlite3_bind_text(sqlite3_stmt stmt, int index, string value) =>
 (Error)provider.sqlite3_bind_text(stmt.Handle, index, value);
Beispiel #2
0
 public static Error sqlite3_clear_bindings(sqlite3_stmt stmt) =>
 (Error)provider.sqlite3_clear_bindings(stmt.Handle);
Beispiel #3
0
 public static Error sqlite3_bind_double(sqlite3_stmt stmt, int index, double value) =>
 (Error)provider.sqlite3_bind_double(stmt.Handle, index, value);
Beispiel #4
0
 public static Error sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] value) =>
 (Error)provider.sqlite3_bind_blob(stmt.Handle, index, value);
Beispiel #5
0
 public static Error sqlite3_bind_null(sqlite3_stmt stmt, int index) =>
 (Error)provider.sqlite3_bind_null(stmt.Handle, index);
Beispiel #6
0
 public static Error sqlite3_bind_int64(sqlite3_stmt stmt, int index, long value) =>
 (Error)provider.sqlite3_bind_int64(stmt.Handle, index, value);
Beispiel #7
0
 public static string sqlite3_column_name(sqlite3_stmt stmt, int column) =>
 provider.sqlite3_column_name(stmt.Handle, column);
Beispiel #8
0
 public static double sqlite3_column_double(sqlite3_stmt stmt, int index) =>
 provider.sqlite3_column_double(stmt.Handle, index);
Beispiel #9
0
 public static StepResult sqlite3_step(sqlite3_stmt stmt) => (StepResult)provider.sqlite3_step(stmt.Handle);
Beispiel #10
0
 public static int sqlite3_column_count(sqlite3_stmt stmt) => provider.sqlite3_column_count(stmt.Handle);
Beispiel #11
0
 public static Error sqlite3_finalize(sqlite3_stmt stmt)
 {
     GC.SuppressFinalize(stmt);
     return((Error)provider.sqlite3_finalize(stmt.Handle));
 }
Beispiel #12
0
 public static string sqlite3_column_text(sqlite3_stmt stmt, int index) =>
 provider.sqlite3_column_text(stmt.Handle, index);
Beispiel #13
0
 public static byte[] sqlite3_column_blob(sqlite3_stmt stmt, int index) =>
 provider.sqlite3_column_blob(stmt.Handle, index);
Beispiel #14
0
 public static Error sqlite3_reset(sqlite3_stmt stmt) =>
 (Error)provider.sqlite3_reset(stmt.Handle);
Beispiel #15
0
 public static ColumnType sqlite3_column_type(sqlite3_stmt stmt, int column) =>
 (ColumnType)provider.sqlite3_column_type(stmt.Handle, column);
Beispiel #16
0
 public static int sqlite3_column_int(sqlite3_stmt stmt, int index) =>
 provider.sqlite3_column_int(stmt.Handle, index);
        public static void BindParameter(this sqlite3_stmt stmt, object parameter, int index)
        {
            try {
                if (parameter == null)
                {
                    SQLite.sqlite3_bind_null(stmt, index);
                    return;
                }

                var t = parameter.GetType();
                if (t == typeof(int))
                {
                    SQLite.sqlite3_bind_int(stmt, index, (int)parameter);
                }
                else if (t == typeof(uint))
                {
                    SQLite.sqlite3_bind_int64(stmt, index, (uint)parameter);
                }

                else if (t == typeof(short))
                {
                    SQLite.sqlite3_bind_int(stmt, index, (short)parameter);
                }
                else if (t == typeof(ushort))
                {
                    SQLite.sqlite3_bind_int(stmt, index, (ushort)parameter);
                }

                else if (t == typeof(double))
                {
                    SQLite.sqlite3_bind_double(stmt, index, (double)parameter);
                }
                else if (t == typeof(float))
                {
                    SQLite.sqlite3_bind_double(stmt, index, (float)parameter);
                }

                else if (t == typeof(long))
                {
                    SQLite.sqlite3_bind_int64(stmt, index, (long)parameter);
                }

                else if (t == typeof(byte[]))
                {
                    SQLite.sqlite3_bind_blob(stmt, index, (byte[])parameter);
                }

                else if (t == typeof(string))
                {
                    SQLite.sqlite3_bind_text(stmt, index, (string)parameter);
                }

                else
                {
                    throw new NotSupportedException();
                }
            }
            catch (NotSupportedException) { throw; }
            catch (Exception ex) {
                throw new SQLiteException("An unknown error occured: " + ex.Message, ex);
            }
        }