本文整理汇总了C#中sqlite3类的典型用法代码示例。如果您正苦于以下问题:C# sqlite3类的具体用法?C# sqlite3怎么用?C# sqlite3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
sqlite3类属于命名空间,在下文中一共展示了sqlite3类的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: sqlite3FindDb
// The token *pName contains the name of a database (either "main" or "temp" or the name of an attached db). This routine returns the
// index of the named database in db->aDb[], or -1 if the named db does not exist.
internal static int sqlite3FindDb(sqlite3 db, Token pName)
{
var zName = sqlite3NameFromToken(db, pName);
var i = sqlite3FindDbName(db, zName);
sqlite3DbFree(db, ref zName);
return i;
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:9,代码来源:Build+Find.cs
示例3: callFinaliser
/*
** This function invokes either the xRollback or xCommit method
** of each of the virtual tables in the sqlite3.aVTrans array. The method
** called is identified by the second argument, "offset", which is
** the offset of the method to call in the sqlite3_module structure.
**
** The array is cleared after invoking the callbacks.
*/
static void callFinaliser(sqlite3 db, int offset)
{
int i;
if (db.aVTrans != null)
{
for (i = 0; i < db.nVTrans; i++)
{
VTable pVTab = db.aVTrans[i];
sqlite3_vtab p = pVTab.pVtab;
if (p != null)
{
//int (*x)(sqlite3_vtab );
//x = *(int (*)(sqlite3_vtab ))((char )p.pModule + offset);
//if( x ) x(p);
if (offset == 0)
{
if (p.pModule.xCommit != null)
p.pModule.xCommit(p);
}
else
{
if (p.pModule.xRollback != null)
p.pModule.xRollback(p);
}
}
pVTab.iSavepoint = 0;
sqlite3VtabUnlock(pVTab);
}
sqlite3DbFree(db, ref db.aVTrans);
db.nVTrans = 0;
db.aVTrans = null;
}
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:41,代码来源:vtab_c.cs
示例4: addModuleArgument
/*
** Add a new module argument to pTable.azModuleArg[].
** The string is not copied - the pointer is stored. The
** string will be freed automatically when the table is
** deleted.
*/
static void addModuleArgument(sqlite3 db, Table pTable, string zArg)
{
int i = pTable.nModuleArg++;
//int nBytes = sizeof(char )*(1+pTable.nModuleArg);
//string[] azModuleArg;
//sqlite3DbRealloc( db, pTable.azModuleArg, nBytes );
if (pTable.azModuleArg == null || pTable.azModuleArg.Length < pTable.nModuleArg)
Array.Resize(ref pTable.azModuleArg, 3 + pTable.nModuleArg);
//if ( azModuleArg == null )
//{
// int j;
// for ( j = 0; j < i; j++ )
// {
// sqlite3DbFree( db, ref pTable.azModuleArg[j] );
// }
// sqlite3DbFree( db, ref zArg );
// sqlite3DbFree( db, ref pTable.azModuleArg );
// pTable.nModuleArg = 0;
//}
//else
{
pTable.azModuleArg[i] = zArg;
//pTable.azModuleArg[i + 1] = null;
//azModuleArg[i+1] = 0;
}
//pTable.azModuleArg = azModuleArg;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:33,代码来源:vtab_c.cs
示例5: CreateTable
private static bool CreateTable(sqlite3* db, string sql)
{
sqlite3_stmt* createTableStmt;
char* tail;
int error = NativeMethods.sqlite3_prepare_v2(db, sql, sql.Length, out createTableStmt, out tail);
if (error != 0)
{
LogErrorWithTimeStamp("sqlite3_prepare_v2 -> " + sql + " failed to execute with SQLite error code: " + error);
NativeMethods.sqlite3_finalize(createTableStmt);
return false;
}
error = NativeMethods.sqlite3_step(createTableStmt);
if (error != 101)
{
LogErrorWithTimeStamp("sqlite3_step -> " + sql + " failed to execute with SQLite error code: " + error);
NativeMethods.sqlite3_finalize(createTableStmt);
return false;
}
NativeMethods.sqlite3_finalize(createTableStmt);
return true;
}
开发者ID:CLRTools,项目名称:Dump2SQLite,代码行数:26,代码来源:Program.cs
示例6: sqlite3_exec
internal static extern int sqlite3_exec(
sqlite3* db, /* An open database */
string sql, /* SQL to be evaluated */
IntPtr callback, /* Callback function */
IntPtr firstArg, /* 1st argument to callback */
IntPtr errmsg /* Error msg written here */
);
开发者ID:CLRTools,项目名称:Dump2SQLite,代码行数:7,代码来源:NativeMethods.cs
示例7: execSql
/*
** Execute zSql on database db. Return an error code.
*/
static int execSql( sqlite3 db, string pzErrMsg, string zSql )
{
sqlite3_stmt pStmt = null;
#if !NDEBUG
int rc;
//VVA_ONLY( int rc; )
#endif
if ( zSql == null )
{
return SQLITE_NOMEM;
}
if ( SQLITE_OK != sqlite3_prepare( db, zSql, -1, ref pStmt, 0 ) )
{
sqlite3SetString( ref pzErrMsg, db, sqlite3_errmsg( db ) );
return sqlite3_errcode( db );
}
#if !NDEBUG
rc = sqlite3_step( pStmt );
//VVA_ONLY( rc = ) sqlite3_step(pStmt);
Debug.Assert( rc != SQLITE_ROW );
#else
sqlite3_step(pStmt);
#endif
return vacuumFinalize( db, pStmt, pzErrMsg );
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:28,代码来源:vacuum_c.cs
示例8: assert
/*
** pTab is a pointer to a Table structure representing a virtual-table.
** Return a pointer to the VTable object used by connection db to access
** this virtual-table, if one has been created, or NULL otherwise.
*/
VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab)
{
VTable *pVtab;
assert( IsVirtual(pTab) );
for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);
return pVtab;
}
开发者ID:taxilian,项目名称:some_library,代码行数:12,代码来源:vtab_c.cs
示例9: void
/*
** The first parameter (pDef) is a function implementation. The
** second parameter (pExpr) is the first argument to this function.
** If pExpr is a column in a virtual table, then let the virtual
** table implementation have an opportunity to overload the function.
**
** This routine is used to allow virtual table implementations to
** overload MATCH, LIKE, GLOB, and REGEXP operators.
**
** Return either the pDef argument (indicating no change) or a
** new FuncDef structure that is marked as ephemeral using the
** SQLITE_FUNC_EPHEM flag.
*/
FuncDef *sqlite3VtabOverloadFunction(
sqlite3 *db, /* Database connection for reporting malloc problems */
FuncDef *pDef, /* Function to possibly overload */
int nArg, /* Number of arguments to the function */
Expr *pExpr /* First argument to the function */
)
{
Table *pTab;
sqlite3_vtab *pVtab;
sqlite3_module *pMod;
void (*xFunc)(sqlite3_context*,int,sqlite3_value**) = 0;
void *pArg = 0;
FuncDef *pNew;
int rc = 0;
char *zLowerName;
unsigned char *z;
/* Check to see the left operand is a column in a virtual table */
if( NEVER(pExpr==0) ) return pDef;
if( pExpr->op!=TK_COLUMN ) return pDef;
pTab = pExpr->pTab;
if( NEVER(pTab==0) ) return pDef;
if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;
pVtab = sqlite3GetVTable(db, pTab)->pVtab;
assert( pVtab!=0 );
assert( pVtab->pModule!=0 );
pMod = (sqlite3_module *)pVtab->pModule;
if( pMod->xFindFunction==0 ) return pDef;
/* Call the xFindFunction method on the virtual table implementation
** to see if the implementation wants to overload this function
*/
zLowerName = sqlite3DbStrDup(db, pDef->zName);
if( zLowerName ){
for(z=(unsigned char*)zLowerName; *z; z++){
*z = sqlite3UpperToLower[*z];
}
rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg);
sqlite3DbFree(db, zLowerName);
}
if( rc==0 ){
return pDef;
}
/* Create a new ephemeral function definition for the overloaded
** function */
pNew = sqlite3DbMallocZero(db, sizeof(*pNew)
+ sqlite3Strlen30(pDef->zName) + 1);
if( pNew==0 ){
return pDef;
}
*pNew = *pDef;
pNew->zName = (char *)&pNew[1];
memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1);
pNew->xFunc = xFunc;
pNew->pUserData = pArg;
pNew->flags |= SQLITE_FUNC_EPHEM;
return pNew;
}
开发者ID:taxilian,项目名称:some_library,代码行数:72,代码来源:vtab_c.cs
示例10: CheckOk
internal static void CheckOk(sqlite3 db, int rc)
{
int extended = raw.sqlite3_extended_errcode(db);
if (raw.SQLITE_OK != rc)
{
throw SQLiteException.Create(rc, extended, raw.sqlite3_errmsg(db));
}
}
开发者ID:matrostik,项目名称:SQLitePCL.pretty,代码行数:8,代码来源:SQLiteException.cs
示例11: freeIndex
// Reclaim the memory used by an index
internal static void freeIndex(sqlite3 db, ref Index p)
{
#if !SQLITE_OMIT_ANALYZE
sqlite3DeleteIndexSamples(db, p);
#endif
sqlite3DbFree(db, ref p.zColAff);
sqlite3DbFree(db, ref p);
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:9,代码来源:Build+Delete.cs
示例12: sqlite3_exec
//OVERLOADS
static public int sqlite3_exec(
sqlite3 db, /* The database on which the SQL executes */
string zSql, /* The SQL to be executed */
int NoCallback, int NoArgs, int NoErrors
)
{
string Errors = "";
return sqlite3_exec( db, zSql, null, null, ref Errors );
}
开发者ID:z0rg1nc,项目名称:CsharpSqliteFork,代码行数:10,代码来源:legacy_c.cs
示例13: 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
示例14: cube_init
/*
** This is the entry point to register the extension for the cube() function.
*/
static int cube_init(
sqlite3 db,
ref string pzErrMsg,
sqlite3_api_routines pApi
)
{
sqlite3_api = pApi; //SQLITE_EXTENSION_INIT2( pApi );
sqlite3_create_function( db, "cube", 1, SQLITE_ANY, 0, cubeFunc, null, null );
return 0;
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:13,代码来源:test_autoext_c.cs
示例15: sqlite3_blob_open
/*
** Open a blob handle.
*/
int sqlite3_blob_open(
sqlite3* db, /* The database connection */
string zDb, /* The attached database containing the blob */
string zTable, /* The table containing the blob */
string zColumn, /* The column containing the blob */
sqlite_int64 iRow, /* The row containing the glob */
int flags, /* True -> read/write access, false -> read-only */
sqlite3_blob **ppBlob /* Handle for accessing the blob returned here */
){
int nAttempt = 0;
int iCol; /* Index of zColumn in row-record */
开发者ID:gxl-wex5,项目名称:WeX5_V3.3_pre_test,代码行数:14,代码来源:vdbeblob_c.cs
示例16: clearSelect
/*
** 2001 September 15
**
** 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 C code routines that are called by the parser
** to handle SELECT statements in SQLite.
*************************************************************************
** 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-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
**
*************************************************************************
*/
//#include "sqliteInt.h"
/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
*/
static void clearSelect( sqlite3 db, Select p )
{
sqlite3ExprListDelete( db, ref p.pEList );
sqlite3SrcListDelete( db, ref p.pSrc );
sqlite3ExprDelete( db, ref p.pWhere );
sqlite3ExprListDelete( db, ref p.pGroupBy );
sqlite3ExprDelete( db, ref p.pHaving );
sqlite3ExprListDelete( db, ref p.pOrderBy );
sqlite3SelectDelete( db, ref p.pPrior );
sqlite3ExprDelete( db, ref p.pLimit );
sqlite3ExprDelete( db, ref p.pOffset );
}
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:40,代码来源:select_c.cs
示例17: 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:taxilian,项目名称:some_library,代码行数:13,代码来源:prepare_c.cs
示例18: sqlite3FindDbName
// Parameter zName points to a nul-terminated buffer containing the name of a database ("main", "temp" or the name of an attached db). This
// function returns the index of the named database in db->aDb[], or -1 if the named db cannot be found.
internal static int sqlite3FindDbName(sqlite3 db, string zName)
{
var i = -1; /* Database number */
if (zName != null)
{
int n = sqlite3Strlen30(zName);
for (i = (db.nDb - 1); i >= 0; i--)
{
var pDb = db.aDb[i];
if ((OMIT_TEMPDB == 0 || i != 1) && n == sqlite3Strlen30(pDb.zName) && pDb.zName.Equals(zName, StringComparison.InvariantCultureIgnoreCase))
break;
}
}
return i;
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:17,代码来源:Build+Find.cs
示例19: sqlite3DeleteTriggerStep
/*
**
** 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 the implementation for TRIGGERs
*************************************************************************
** 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: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
**
** $Header: Community.CsharpSqlite/src/trigger_c.cs,v 6604176a7dbe 2010/03/12 23:35:36 Noah $
*************************************************************************
*/
//#include "sqliteInt.h"
#if !SQLITE_OMIT_TRIGGER
/*
** Delete a linked list of TriggerStep structures.
*/
static void sqlite3DeleteTriggerStep( sqlite3 db, ref TriggerStep pTriggerStep )
{
while ( pTriggerStep != null )
{
TriggerStep pTmp = pTriggerStep;
pTriggerStep = pTriggerStep.pNext;
sqlite3ExprDelete( db, ref pTmp.pWhere );
sqlite3ExprListDelete( db, ref pTmp.pExprList );
sqlite3SelectDelete( db, ref pTmp.pSelect );
sqlite3IdListDelete( db, ref pTmp.pIdList );
pTriggerStep = null;sqlite3DbFree( db, ref pTmp );
}
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:41,代码来源:trigger_c.cs
示例20: sqlite3VdbeCreate
/*
** Create a new virtual database engine.
*/
static Vdbe sqlite3VdbeCreate( sqlite3 db )
{
Vdbe p;
p = new Vdbe();// sqlite3DbMallocZero(db, Vdbe).Length;
if ( p == null ) return null;
p.db = db;
if ( db.pVdbe != null )
{
db.pVdbe.pPrev = p;
}
p.pNext = db.pVdbe;
p.pPrev = null;
db.pVdbe = p;
p.magic = VDBE_MAGIC_INIT;
return p;
}
开发者ID:koush,项目名称:csharp-sqlite,代码行数:19,代码来源:vdbeaux_c.cs
注:本文中的sqlite3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论