示例#1
0
 public void exec(string sql)
 {
     using( MarshalStr m = new MarshalStr(sql) )
     {
         IntPtr errmsg;
         sqlite3_exec(DB,m.GetSQLiteStr(),IntPtr.Zero,IntPtr.Zero,out errmsg);
         CheckOK();
     }
 }
示例#2
0
 public void open(string filename)
 {
     using( MarshalStr m = new MarshalStr(_encoding,filename) )
     {
         int res = sqlite3_open(m.GetSQLiteStr(),out DB);
         if( res != SQLITE.OK )
         {
             try
             {
                 CheckOK();
             }
             finally
             {
                 sqlite3_close(DB);
                 DB = IntPtr.Zero;
             }
         }
     }
 }
示例#3
0
 public isqlite_vm compile(string zSql)
 {
     using( MarshalStr s = new MarshalStr(_encoding,zSql) )
     {
         IntPtr pTail;
         IntPtr pVM;
         sqlite3_prepare(DB,s.GetSQLiteStr(),s.GetSQLiteStrByteLength(),out pVM,out pTail);
         CheckOK();
         return new sqlite_vm(this,pVM);
     }
 }
示例#4
0
 internal MarshalStr GetMarshalStr( Encoding encoding )
 {
     if( mpMarshalStr == null )
         mpMarshalStr = new MarshalStr(encoding);
     else
     {
         // purge cache if the encoding is different
         if( mpMarshalStr.Encoding != encoding )
         {
             mpMarshalStr.Encoding = encoding;
             mpMarshalStr.Str = null;
         }
     }
     return mpMarshalStr;
 }
示例#5
0
 public void Dispose()
 {
     if( mpMarshalStr != null )
     {
         mpMarshalStr.Dispose();
         mpMarshalStr = null;
     }
 }
示例#6
0
 public isqlite_vm compile(string zSql)
 {
     using( MarshalStr s = new MarshalStr(_encoding,zSql) )
     {
         IntPtr pzErrmsg;
         IntPtr pTail;
         IntPtr pVm;
         int result = sqlite_compile(DB,s.GetSQLiteStr(),out pTail,out pVm,out pzErrmsg);
         CheckOK(result,pzErrmsg);
         return new sqlite_vm(this,pVm);
     }
 }
示例#7
0
 public void open(string filename)
 {
     using( MarshalStr m = new MarshalStr(filename) )
     {
         IntPtr perr;
         IntPtr handle = sqlite_open(m.GetSQLiteStr(),0,out perr);
         if( handle == IntPtr.Zero )
             Throw (SQLITE.ERROR, perr);
         DB = handle;
     }
 }