コード例 #1
0
        public int ExecuteNonQuery()
        {
            _stmt = this.Prepare();

            var result = SQLiteNative.Step(_stmt);

            if (result == SQLiteResult.Done)
            {
                var rows = SQLiteNative.Changes(_connection.Handle);
                return(rows);
            }
            if (result == SQLiteResult.Error)
            {
                throw new SQLiteException(result, SQLiteNative.GetErrmsg(_connection.Handle));
            }
            string message;

            try
            {
                message = SQLiteNative.GetErrmsg(_connection.Handle);
            }
            catch
            {
                message = result.ToString();
            }
            throw new SQLiteException(result, message);
        }
コード例 #2
0
 public void Close()
 {
     if (this.Handle != IntPtr.Zero)
     {
         try
         {
             var result = SQLiteNative.Close(this.Handle);
             if (result != SQLiteResult.OK)
             {
                 throw new SQLiteException(result, SQLiteNative.GetErrmsg(this.Handle));
             }
         }
         finally
         {
             this.Handle = IntPtr.Zero;
         }
     }
 }