예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
        public string ColumnText(int index)
        {
            var text = UnsafeNativeMethods.sqlite3_column_text(this.stmt, index);

            return(StatementInterceptor.UTF8ToString(text));
        }