public void Exec(string sql) { var rc = UnsafeNativeMethods.sqlite3_exec(this.connection, sql, null, IntPtr.Zero, IntPtr.Zero); if (rc != UnsafeNativeMethods.SQLITE_OK) { var error = StatementInterceptor.UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(this.connection)); throw new ArgumentException(error, sql); } }
public void Listen(int port) { if (port <= 0) { throw new ArgumentOutOfRangeException("port", "Invalid port"); } this.listener = new TcpListener(IPAddress.Any, port); this.listenTask = this.ListenForClients(); this.interceptor = new StatementInterceptor(this); }
public SQLiteStatement Prepare(string sql) { IntPtr stmt; var rc = UnsafeNativeMethods.sqlite3_prepare_v2(this.connection, sql, -1, out stmt, IntPtr.Zero); if (rc != UnsafeNativeMethods.SQLITE_OK) { var error = StatementInterceptor.UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(this.connection)); throw new ArgumentException(error, sql); } return(new SQLiteStatement(stmt)); }
public string ColumnText(int index) { var text = UnsafeNativeMethods.sqlite3_column_text(this.stmt, index); return(StatementInterceptor.UTF8ToString(text)); }