예제 #1
0
        internal Statement(Connection connection, string sql)
        {
            CommandText = sql;
            Connection  = connection;

            IntPtr pzTail;

            CheckError(Native.sqlite3_prepare16_v2(connection.Ptr, sql, -1, out ptr, out pzTail));

            lock (Connection.Statements) {
                Connection.Statements.Add(this);
            }

            if (pzTail != IntPtr.Zero && Marshal.ReadByte(pzTail) != 0)
            {
                Dispose();
                throw new ArgumentException("sql", string.Format("This sqlite binding does not support multiple commands in one statement:\n  {0}", sql));
            }

            ParameterCount = Native.sqlite3_bind_parameter_count(ptr);
            reader         = new QueryReader()
            {
                Statement = this
            };
        }
예제 #2
0
 public object Get(int i, Type asType)
 {
     return(QueryReader.GetAs(this[i], asType));
 }