本文整理汇总了C#中SQLitePCL.sqlite3类的典型用法代码示例。如果您正苦于以下问题:C# sqlite3类的具体用法?C# sqlite3怎么用?C# sqlite3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
sqlite3类属于SQLitePCL命名空间,在下文中一共展示了sqlite3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSqliteStatement
internal static sqlite3_stmt GetSqliteStatement(string sql, sqlite3 db)
{
sqlite3_stmt statement;
int rc= raw.sqlite3_prepare_v2(db, sql, out statement);
VerifySQLiteResponse(rc, raw.SQLITE_OK, db);
return statement;
}
示例2: Bind
internal static void Bind(sqlite3 db, sqlite3_stmt stm, int index, object value)
{
int rc = 0;
if (value == null)
{
rc = raw.sqlite3_bind_null(stm, index);
}
else
{
if (IsSupportedInteger(value))
{
rc = raw.sqlite3_bind_int64(stm, index, GetInteger(value));
}
else if (IsSupportedFloat(value))
{
rc = raw.sqlite3_bind_double(stm, index, GetFloat(value));
}
else if (IsSupportedText(value))
{
rc = raw.sqlite3_bind_text(stm, index, value.ToString());
}
else if (value is byte[])
{
rc = raw.sqlite3_bind_blob(stm, index, (byte[])value);
}
else
{
throw new SQLiteException("Unable to bind parameter with unsupported type: " + value.GetType().FullName);
}
}
VerifySQLiteResponse(rc, raw.SQLITE_OK, db);
}
示例3: VerifySQLiteResponse
internal static void VerifySQLiteResponse(int result, int expectedResult, sqlite3 db)
{
if (result != expectedResult)
{
string sqliteErrorMessage = raw.sqlite3_errmsg(db);
throw new SQLiteException(string.Format("Error executing SQLite command: '{0}'.", sqliteErrorMessage));
}
}
示例4: BuildCommand
private sqlite3_stmt BuildCommand(sqlite3 db, string sql, object[] paramArgs)
{
if (db == null) {
throw new ArgumentNullException("db");
}
sqlite3_stmt command = null;
try
{
if (!IsOpen) {
Open(Path);
}
lock(Cursor.StmtDisposeLock)
{
LastErrorCode = raw.sqlite3_prepare_v2(db, sql, out command);
}
if (LastErrorCode != raw.SQLITE_OK || command == null)
{
Log.E(TAG, "sqlite3_prepare_v2: " + LastErrorCode);
}
if (paramArgs != null && paramArgs.Length > 0 && command != null && LastErrorCode != raw.SQLITE_ERROR)
{
command.bind(paramArgs);
}
}
catch (Exception e)
{
Log.E(TAG, "Error when build a sql " + sql + " with params " + paramArgs, e);
throw;
}
return command;
}
示例5: OpenSqliteConnection
void OpenSqliteConnection(int flags, SymmetricKey encryptionKey, out sqlite3 db)
{
LastErrorCode = raw.sqlite3_open_v2(Path, out db, flags, null);
if (LastErrorCode != raw.SQLITE_OK) {
Path = null;
var errMessage = "Failed to open SQLite storage engine at path {0}".Fmt(Path);
throw new CouchbaseLiteException(errMessage, StatusCode.DbError);
}
#if !__ANDROID__ && !NET_3_5 && VERBOSE
var i = 0;
var val = raw.sqlite3_compileoption_get(i);
while (val != null)
{
Log.V(TAG, "Sqlite Config: {0}".Fmt(val));
val = raw.sqlite3_compileoption_get(++i);
}
#endif
Log.D(TAG, "Open {0} (flags={1}{2})", Path, flags, (encryptionKey != null ? ", encryption key given" : ""));
raw.sqlite3_create_collation(db, "JSON", null, CouchbaseSqliteJsonUnicodeCollationFunction.Compare);
raw.sqlite3_create_collation(db, "JSON_ASCII", null, CouchbaseSqliteJsonAsciiCollationFunction.Compare);
raw.sqlite3_create_collation(db, "JSON_RAW", null, CouchbaseSqliteJsonRawCollationFunction.Compare);
raw.sqlite3_create_collation(db, "REVID", null, CouchbaseSqliteRevIdCollationFunction.Compare);
}
示例6: sqlite3_wal_checkpoint
static public int sqlite3_wal_checkpoint(sqlite3 db, string dbName)
{
return _imp.sqlite3_wal_checkpoint(db.ptr, dbName);
}
示例7: sqlite3_blob_open
static public int sqlite3_blob_open(sqlite3 db, string sdb, string table, string col, long rowid, int flags, out sqlite3_blob blob)
{
IntPtr p;
int rc = _imp.sqlite3_blob_open(db.ptr, sdb, table, col, rowid, flags, out p);
blob = new sqlite3_blob(p);
return rc;
}
示例8: sqlite3_next_stmt
static public sqlite3_stmt sqlite3_next_stmt(sqlite3 db, sqlite3_stmt stmt)
{
IntPtr prev = IntPtr.Zero;
if (stmt != null)
{
prev = stmt.ptr;
}
IntPtr p = _imp.sqlite3_next_stmt(db.ptr, prev);
if (p == IntPtr.Zero)
{
return null;
}
else
{
return db.find_stmt(p);
}
}
示例9: sqlite3_exec
static public int sqlite3_exec(sqlite3 db, string sql)
{
string errmsg;
return _imp.sqlite3_exec(db.ptr, sql, null, null, out errmsg);
}
示例10: sqlite3_db_filename
static public string sqlite3_db_filename(sqlite3 db, string att)
{
return _imp.sqlite3_db_filename(db.ptr, att);
}
示例11: sqlite3_db_readonly
static public int sqlite3_db_readonly(sqlite3 db, string dbName)
{
return _imp.sqlite3_db_readonly(db.ptr, dbName);
}
示例12: sqlite3_errmsg
static public string sqlite3_errmsg(sqlite3 db)
{
return _imp.sqlite3_errmsg(db.ptr);
}
示例13: sqlite3_db_status
static public int sqlite3_db_status(sqlite3 db, int op, out int current, out int highest, int resetFlg)
{
return _imp.sqlite3_db_status(db.ptr, op, out current, out highest, resetFlg);
}
示例14: sqlite3_create_function
static public int sqlite3_create_function(sqlite3 db, string name, int nArg, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)
{
return _imp.sqlite3_create_function(db.ptr, name, nArg, v, func_step, func_final);
}
示例15: sqlite3_prepare_v2
static public int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt, out string tail)
{
IntPtr p;
int rc = _imp.sqlite3_prepare_v2(db.ptr, sql, out p, out tail);
stmt = new sqlite3_stmt(p, db);
return rc;
}