• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# sqlite3_stmt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中sqlite3_stmt的典型用法代码示例。如果您正苦于以下问题:C# sqlite3_stmt类的具体用法?C# sqlite3_stmt怎么用?C# sqlite3_stmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



sqlite3_stmt类属于命名空间,在下文中一共展示了sqlite3_stmt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: sqlite3_prepare_v2

 internal static extern int sqlite3_prepare_v2(
     sqlite3* db, /* Database handle */
     string zSql, /* SQL statement, UTF-8 encoded */
     int nByte, /* Maximum length of zSql in bytes. */
     out sqlite3_stmt* ppStmt, /* OUT: Statement handle */
     out char* pzTail /* OUT: Pointer to unused portion of zSql */
     );
开发者ID:CLRTools,项目名称:Dump2SQLite,代码行数:7,代码来源:NativeMethods.cs


示例2: sqlite3_finalize

    /*
** The following routine destroys a virtual machine that is created by
** the sqlite3_compile() routine. The integer returned is an SQLITE_
** success/failure code that describes the result of executing the virtual
** machine.
**
** This routine sets the error code and string returned by
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
    public static int sqlite3_finalize( ref sqlite3_stmt pStmt )
    {
      int rc;
      if ( pStmt == null )
      {
        rc = SQLITE_OK;
      }
      else
      {
        Vdbe v = pStmt;
        sqlite3 db = v.db;
#if  SQLITE_THREADSAFE
sqlite3_mutex mutex;
#endif
        if ( db == null ) return SQLITE_MISUSE;
#if SQLITE_THREADSAFE
    mutex = v.db.mutex;
#endif
        sqlite3_mutex_enter( mutex );
        rc = sqlite3VdbeFinalize( v );
        rc = sqlite3ApiExit( db, rc );
        sqlite3_mutex_leave( mutex );
      }
      return rc;
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:34,代码来源:vdbeapi_c.cs


示例3: vacuumFinalize

    /*
    ** 2003 April 6
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    ** This file contains code used to implement the VACUUM command.
    **
    ** Most of the code in this file may be omitted by defining the
    ** SQLITE_OMIT_VACUUM macro.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2011-05-19 13:26:54 ed1da510a239ea767a01dc332b667119fa3c908e
    **
    *************************************************************************
    */
    //#include "sqliteInt.h"
    //#include "vdbeInt.h"

#if !SQLITE_OMIT_VACUUM && !SQLITE_OMIT_ATTACH
    /*
** Finalize a prepared statement.  If there was an error, store the
** text of the error message in *pzErrMsg.  Return the result code.
*/
    static int vacuumFinalize( sqlite3 db, sqlite3_stmt pStmt, string pzErrMsg )
    {
      int rc;
      rc = sqlite3VdbeFinalize( ref pStmt );
      if ( rc != 0 )
      {
        sqlite3SetString( ref pzErrMsg, db, sqlite3_errmsg( db ) );
      }
      return rc;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:41,代码来源:vacuum_c.cs


示例4: sqlite3_prepare_v2

 public static int sqlite3_prepare_v2(
 sqlite3 db,               /* Database handle. */
 string zSql,              /* UTF-8 encoded SQL statement. */
 int nBytes,               /* Length of zSql in bytes. */
 ref sqlite3_stmt ppStmt,  /* OUT: A pointer to the prepared statement */
 ref string pzTail         /* OUT: End of parsed string */
 )
 {
   int rc;
   rc = sqlite3LockAndPrepare( db, zSql, nBytes, 1, null, ref  ppStmt, ref pzTail );
   Debug.Assert( rc == SQLITE_OK || ppStmt == null );  /* VERIFY: F13021 */
   return rc;
 }
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:13,代码来源:prepare_c.cs


示例5: sqlite3LockAndPrepare

 static int sqlite3LockAndPrepare(
 sqlite3 db,               /* Database handle. */
 string zSql,              /* UTF-8 encoded SQL statement. */
 int nBytes,               /* Length of zSql in bytes. */
 int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */
 Vdbe pOld,                /* VM being reprepared */
 ref sqlite3_stmt ppStmt,  /* OUT: A pointer to the prepared statement */
 ref string pzTail         /* OUT: End of parsed string */
 )
 {
   int rc;
   //  assert( ppStmt!=0 );
   ppStmt = null;
   if ( !sqlite3SafetyCheckOk( db ) )
   {
     return SQLITE_MISUSE_BKPT();
   }
   sqlite3_mutex_enter( db.mutex );
   sqlite3BtreeEnterAll( db );
   rc = sqlite3Prepare( db, zSql, nBytes, saveSqlFlag, pOld, ref ppStmt, ref pzTail );
   if ( rc == SQLITE_SCHEMA )
   {
     sqlite3_finalize( ppStmt );
     rc = sqlite3Prepare( db, zSql, nBytes, saveSqlFlag, pOld, ref ppStmt, ref  pzTail );
   }
   sqlite3BtreeLeaveAll( db );
   sqlite3_mutex_leave( db.mutex );
   return rc;
 }
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:29,代码来源:prepare_c.cs


示例6: c_misuse_test

    /*
    ** c_misuse_test
    */
    static int c_misuse_test(
    object clientdata, /* Pointer to sqlite3_enable_XXX function */
    Tcl_Interp interp,    /* The TCL interpreter that invoked this command */
    int objc,              /* Number of arguments */
    Tcl_Obj[] objv /* Command arguments */
    )
    {
      string zErrFunction = "N/A";
      sqlite3 db = null;
      sqlite3_stmt pStmt;
      int rc;

      if ( objc != 1 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "" );
        return TCL.TCL_ERROR;
      }

      /* Open a database. Then close it again. We need to do this so that
      ** we have a "closed database handle" to pass to various API functions.
      */
      rc = sqlite3_open( ":memory:", out db );
      if ( rc != SQLITE_OK )
      {
        zErrFunction = "sqlite3_open";
        goto error_out;
      }
      sqlite3_close( db );


      rc = sqlite3_errcode( db );
      if ( rc != SQLITE_MISUSE )
      {
        zErrFunction = "sqlite3_errcode";
        goto error_out;
      }

      pStmt = new sqlite3_stmt();
      pStmt.pc = 1234;
      rc = sqlite3_prepare( db, (StringBuilder)null, 0, ref pStmt, 0 );
      if ( rc != SQLITE_MISUSE )
      {
        zErrFunction = "sqlite3_prepare";
        goto error_out;
      }
      Debug.Assert( pStmt == null ); /* Verify that pStmt is zeroed even on a MISUSE error */


      pStmt = new sqlite3_stmt();
      pStmt.pc = 1234;
      rc = sqlite3_prepare_v2( db, null, 0, ref pStmt, 0 );
      if ( rc != SQLITE_MISUSE )
      {
        zErrFunction = "sqlite3_prepare_v2";
        goto error_out;
      }
      Debug.Assert( pStmt == null );

#if !SQLITE_OMIT_UTF16
pStmt = (sqlite3_stmt)1234;
rc = sqlite3_prepare16( db, null, 0, ref pStmt, 0 );
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_prepare16";
goto error_out;
}
Debug.Assert( pStmt==0 );
pStmt = (sqlite3_stmt)1234;
rc = sqlite3_prepare16_v2( db, null, 0, ref pStmt, 0 );
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_prepare16_v2";
goto error_out;
}
Debug.Assert( pStmt==0 );
#endif

      return TCL.TCL_OK;

error_out:
      TCL.Tcl_ResetResult( interp );
      TCL.Tcl_AppendResult( interp, "Error testing function: ", zErrFunction );
      return TCL.TCL_ERROR;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:85,代码来源:test9_c.cs


示例7: sqlite3_column_bytes16

 public static int sqlite3_column_bytes16( sqlite3_stmt pStmt, int i )
 {
   int val = sqlite3_value_bytes16( columnMem( pStmt, i ) );
   columnMallocFailure( pStmt );
   return val;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:6,代码来源:vdbeapi_c.cs


示例8: sqlite3_column_blob

 /**************************** sqlite3_column_  *******************************
 ** The following routines are used to access elements of the current row
 ** in the result set.
 */
 public static byte[] sqlite3_column_blob( sqlite3_stmt pStmt, int i )
 {
   byte[] val;
   val = sqlite3_value_blob( columnMem( pStmt, i ) );
   /* Even though there is no encoding conversion, value_blob() might
   ** need to call malloc() to expand the result of a zeroblob()
   ** expression.
   */
   columnMallocFailure( pStmt );
   return val;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:15,代码来源:vdbeapi_c.cs


示例9: columnMem

    /*
    ** Check to see if column iCol of the given statement is valid.  If
    ** it is, return a pointer to the Mem for the value of that column.
    ** If iCol is not valid, return a pointer to a Mem which has a value
    ** of NULL.
    */
    static Mem columnMem( sqlite3_stmt pStmt, int i )
    {
      Vdbe pVm;
      Mem pOut;

      pVm = (Vdbe)pStmt;
      if ( pVm != null && pVm.pResultSet != null && i < pVm.nResColumn && i >= 0 )
      {
        sqlite3_mutex_enter( pVm.db.mutex );
        pOut = pVm.pResultSet[i];
      }
      else
      {
        /* If the value passed as the second argument is out of range, return
        ** a pointer to the following public static Mem object which contains the
        ** value SQL NULL. Even though the Mem structure contains an element
        ** of type i64, on certain architecture (x86) with certain compiler
        ** switches (-Os), gcc may align this Mem object on a 4-byte boundary
        ** instead of an 8-byte one. This all works fine, except that when
        ** running with SQLITE_DEBUG defined the SQLite code sometimes Debug.Assert()s
        ** that a Mem structure is located on an 8-byte boundary. To prevent
        ** this Debug.Assert() from failing, when building with SQLITE_DEBUG defined
        ** using gcc, force nullMem to be 8-byte aligned using the magical
        ** __attribute__((aligned(8))) macro.  */
        //    static const Mem nullMem 
        //#if defined(SQLITE_DEBUG) && defined(__GNUC__)
        //      __attribute__((aligned(8))) 
        //#endif
        //      = {0, "", (double)0, {0}, 0, MEM_Null, SQLITE_NULL, 0,
        //#if SQLITE_DEBUG
        //         0, 0,  /* pScopyFrom, pFiller */
        //#endif
        //         0, 0 };
        Mem nullMem = new Mem( null, string.Empty, (double)0, 0, 0, MEM_Null, SQLITE_NULL, 0
#if SQLITE_DEBUG
         , null, null  /* pScopyFrom, pFiller */
#endif
 );

        if ( pVm != null && ALWAYS( pVm.db != null ) )
        {
          sqlite3_mutex_enter( pVm.db.mutex );
          sqlite3Error( pVm.db, SQLITE_RANGE, 0 );
        }
        pOut = nullMem;
      }
      return pOut;
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:54,代码来源:vdbeapi_c.cs


示例10: columnName

    /* The following function is experimental and subject to change or
    ** removal */
    /*int sqlite3_column_numeric_type(sqlite3_stmt pStmt, int i){
    **  return sqlite3_value_numeric_type( columnMem(pStmt,i) );
    **}
    */

    /*
    ** Convert the N-th element of pStmt.pColName[] into a string using
    ** xFunc() then return that string.  If N is out of range, return 0.
    **
    ** There are up to 5 names for each column.  useType determines which
    ** name is returned.  Here are the names:
    **
    **    0      The column name as it should be displayed for output
    **    1      The datatype name for the column
    **    2      The name of the database that the column derives from
    **    3      The name of the table that the column derives from
    **    4      The name of the table column that the result column derives from
    **
    ** If the result is not a simple column reference (if it is an expression
    ** or a constant) then useTypes 2, 3, and 4 return NULL.
    */
    public static string columnName(
    sqlite3_stmt pStmt,
    int N,
    dxColname xFunc,
    int useType
    )
    {
      string ret = null;
      Vdbe p = pStmt;
      int n;
      sqlite3 db = p.db;

      Debug.Assert( db != null );

      n = sqlite3_column_count( pStmt );
      if ( N < n && N >= 0 )
      {
        N += useType * n;
        sqlite3_mutex_enter( db.mutex );
        //Debug.Assert( db.mallocFailed == 0 );
        ret = xFunc( p.aColName[N] );

        /* A malloc may have failed inside of the xFunc() call. If this
        ** is the case, clear the mallocFailed flag and return NULL.
        */
        //if ( db.mallocFailed != 0 )
        //{
        //  //db.mallocFailed = 0;
        //  ret = null;
        //}
        sqlite3_mutex_leave( db.mutex );
      }
      return ret;
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:57,代码来源:vdbeapi_c.cs


示例11: sqlite3_column_type

//const void *sqlite3_column_text16(sqlite3_stmt pStmt, int i){
//  const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
//  columnMallocFailure(pStmt);
//  return val;
//}
#endif // * SQLITE_OMIT_UTF16 */

    public static int sqlite3_column_type( sqlite3_stmt pStmt, int i )
    {
      int iType = sqlite3_value_type( columnMem( pStmt, i ) );
      columnMallocFailure( pStmt );
      return iType;
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:13,代码来源:vdbeapi_c.cs


示例12: sqlite3_column_value

 public static sqlite3_value sqlite3_column_value( sqlite3_stmt pStmt, int i )
 {
   Mem pOut = columnMem( pStmt, i );
   if ( ( pOut.flags & MEM_Static ) != 0 )
   {
     pOut.flags = (u16)( pOut.flags & ~MEM_Static );
     pOut.flags |= MEM_Ephem;
   }
   columnMallocFailure( pStmt );
   return (sqlite3_value)pOut;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:11,代码来源:vdbeapi_c.cs


示例13: sqlite3_column_text

 public static string sqlite3_column_text( sqlite3_stmt pStmt, int i )
 {
   string val = sqlite3_value_text( columnMem( pStmt, i ) );
   columnMallocFailure( pStmt );
   return val;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:6,代码来源:vdbeapi_c.cs


示例14: sqlite3_column_int64

 public static sqlite_int64 sqlite3_column_int64( sqlite3_stmt pStmt, int i )
 {
   sqlite_int64 val = sqlite3_value_int64( columnMem( pStmt, i ) );
   columnMallocFailure( pStmt );
   return val;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:6,代码来源:vdbeapi_c.cs


示例15: sqlite3_column_text

 public static string sqlite3_column_text(sqlite3_stmt pStmt, int i)
 {
   string val = sqlite3_value_text(columnMem(pStmt, i));
   columnMallocFailure(pStmt);
   if (String.IsNullOrEmpty(val)) return null; return val;
 }
开发者ID:arissetyawan,项目名称:rhodes,代码行数:6,代码来源:vdbeapi_c.cs


示例16: sqlite3_column_count

    /*
** Return the number of columns in the result set for the statement pStmt.
*/
    public static int sqlite3_column_count( sqlite3_stmt pStmt )
    {
      Vdbe pVm = pStmt;
      return pVm != null ? (int)pVm.nResColumn : 0;
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:8,代码来源:vdbeapi_c.cs


示例17: sqlite3_data_count

 /*
 ** Return the number of values available from the current row of the
 ** currently executing statement pStmt.
 */
 public static int sqlite3_data_count( sqlite3_stmt pStmt )
 {
   Vdbe pVm = pStmt;
   if ( pVm == null || pVm.pResultSet == null )
     return 0;
   return pVm.nResColumn;
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:11,代码来源:vdbeapi_c.cs


示例18: sqlite3_column_name16

public static string sqlite3_column_name16(sqlite3_stmt pStmt, int N){
return columnName(
pStmt, N,  sqlite3_value_text16, COLNAME_NAME);
}
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:4,代码来源:vdbeapi_c.cs


示例19: columnMallocFailure

 /*
 ** This function is called after invoking an sqlite3_value_XXX function on a
 ** column value (i.e. a value returned by evaluating an SQL expression in the
 ** select list of a SELECT statement) that may cause a malloc() failure. If
 ** malloc() has failed, the threads mallocFailed flag is cleared and the result
 ** code of statement pStmt set to SQLITE_NOMEM.
 **
 ** Specifically, this is called from within:
 **
 **     sqlite3_column_int()
 **     sqlite3_column_int64()
 **     sqlite3_column_text()
 **     sqlite3_column_text16()
 **     sqlite3_column_real()
 **     sqlite3_column_bytes()
 **     sqlite3_column_bytes16()
 **     sqlite3_column_blob()
 */
 static void columnMallocFailure( sqlite3_stmt pStmt )
 {
   /* If malloc() failed during an encoding conversion within an
   ** sqlite3_column_XXX API, then set the return code of the statement to
   ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR
   ** and _finalize() will return NOMEM.
   */
   Vdbe p = pStmt;
   if ( p != null )
   {
     p.rc = sqlite3ApiExit( p.db, p.rc );
     sqlite3_mutex_leave( p.db.mutex );
   }
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:32,代码来源:vdbeapi_c.cs


示例20: sqlite3_column_decltype

    /*
** Constraint:  If you have ENABLE_COLUMN_METADATA then you must
** not define OMIT_DECLTYPE.
*/
#if SQLITE_OMIT_DECLTYPE && SQLITE_ENABLE_COLUMN_METADATA
# error "Must not define both SQLITE_OMIT_DECLTYPE and SQLITE_ENABLE_COLUMN_METADATA"
#endif

#if !SQLITE_OMIT_DECLTYPE
    /*
** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt.
*/
    public static string sqlite3_column_decltype( sqlite3_stmt pStmt, int N )
    {
      return columnName(
      pStmt, N, sqlite3_value_text, COLNAME_DECLTYPE );
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:18,代码来源:vdbeapi_c.cs



注:本文中的sqlite3_stmt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# sqlite3_value类代码示例发布时间:2022-05-24
下一篇:
C# sqlite3_mutex类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap