您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ throw_sqlite3_exception函数代码示例

51自学网 2021-06-03 08:49:45
  C++
这篇教程C++ throw_sqlite3_exception函数代码示例写得很实用,希望能帮到您。

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

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

示例1: nativeGetBlob

static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jlong windowPtr,        jint row, jint column) {    CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr);    LOG_WINDOW("Getting blob for %d,%d from %p", row, column, window);    CursorWindow::FieldSlot* fieldSlot = window->getFieldSlot(row, column);    if (!fieldSlot) {        throwExceptionWithRowCol(env, row, column);        return NULL;    }    int32_t type = window->getFieldSlotType(fieldSlot);    if (type == CursorWindow::FIELD_TYPE_BLOB || type == CursorWindow::FIELD_TYPE_STRING) {        size_t size;        const void* value = window->getFieldSlotValueBlob(fieldSlot, &size);        jbyteArray byteArray = env->NewByteArray(size);        if (!byteArray) {            env->ExceptionClear();            throw_sqlite3_exception(env, "Native could not create new byte[]");            return NULL;        }        env->SetByteArrayRegion(byteArray, 0, size, static_cast<const jbyte*>(value));        return byteArray;    } else if (type == CursorWindow::FIELD_TYPE_INTEGER) {        throw_sqlite3_exception(env, "INTEGER data in nativeGetBlob ");    } else if (type == CursorWindow::FIELD_TYPE_FLOAT) {        throw_sqlite3_exception(env, "FLOAT data in nativeGetBlob ");    } else if (type == CursorWindow::FIELD_TYPE_NULL) {        // do nothing    } else {        throwUnknownTypeException(env, type);    }    return NULL;}
开发者ID:android-source,项目名称:platform_frameworks_base,代码行数:34,


示例2: Java_com_jim_multipos_utils_database_AbstractSQLite_tableinfo

void Java_com_jim_multipos_utils_database_AbstractSQLite_tableinfo(JNIEnv *env, jobject object, int dbHandle, jstring tableName) {    sqlite3 *db = (sqlite3 *) dbHandle;    sqlite3_stmt *handle;    char const *tn = env->GetStringUTFChars(tableName, 0);    char test[100] = "CREATE TABLE IF NOT EXISTS foo (id INTEGER, name TEXT, test TEXT);";    int rc = sqlite3_exec(db, test, NULL, 0, 0);    if (rc != SQLITE_OK) {        throw_sqlite3_exception(env, db, rc);        return;    }    else        __android_log_write(ANDROID_LOG_DEBUG, "com.jim.multipos", "table created");    std::string temp =  "PRAGMA table_info(foo)";    char query[100];    strcpy(query, temp.c_str());    rc = sqlite3_prepare_v2(db, query, sizeof(query), &handle, NULL);    if (rc != SQLITE_OK) {        throw_sqlite3_exception(env, db, rc);        return;    }    while (sqlite3_step(handle) == SQLITE_ROW) {        __android_log_write(ANDROID_LOG_DEBUG, "com.jim.multipos", std::to_string(sqlite3_column_count(handle)).c_str());        const char *str = (const char *) sqlite3_column_text(handle, 0);        __android_log_write(ANDROID_LOG_DEBUG, "com.jim.multipos", str);    }    sqlite3_finalize(handle);    if (tn != 0) {        env->ReleaseStringUTFChars(tableName, tn);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:34,


示例3: getBlob_native

static jbyteArray getBlob_native(JNIEnv* env, jobject object, jint row, jint column){    int32_t err;    CursorWindow * window = GET_WINDOW(env, object);LOG_WINDOW("Getting blob for %d,%d from %p", row, column, window);    field_slot_t field;    err = window->read_field_slot(row, column, &field);    if (err != 0) {        throwExceptionWithRowCol(env, row, column);        return NULL;    }    uint8_t type = field.type;    if (type == FIELD_TYPE_BLOB || type == FIELD_TYPE_STRING) {        jbyteArray byteArray = env->NewByteArray(field.data.buffer.size);        LOG_ASSERT(byteArray, "Native could not create new byte[]");        env->SetByteArrayRegion(byteArray, 0, field.data.buffer.size,            (const jbyte*)window->offsetToPtr(field.data.buffer.offset));        return byteArray;    } else if (type == FIELD_TYPE_INTEGER) {        throw_sqlite3_exception(env, "INTEGER data in getBlob_native ");    } else if (type == FIELD_TYPE_FLOAT) {        throw_sqlite3_exception(env, "FLOAT data in getBlob_native ");    } else if (type == FIELD_TYPE_NULL) {        // do nothing    } else {        throwUnknowTypeException(env, type);    }    return NULL;}
开发者ID:qingyue,项目名称:platform_frameworks,代码行数:31,


示例4: throw_sqlite3_exception_errcode

/* throw a SQLiteException for a given error code */void throw_sqlite3_exception_errcode(JNIEnv* env, int errcode, const char* message) {    if (errcode == SQLITE_DONE) {        throw_sqlite3_exception(env, errcode, NULL, message);    } else {        char temp[21];        sprintf(temp, "error code %d", errcode);        throw_sqlite3_exception(env, errcode, temp, message);    }}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:10,


示例5: executeNonQuery

static int executeNonQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3_stmt* statement) {    int err = sqlite3_step(statement);    if (err == SQLITE_ROW) {        throw_sqlite3_exception(env,                "Queries can be performed using SQLiteDatabase query or rawQuery methods only.");    } else if (err != SQLITE_DONE) {        throw_sqlite3_exception(env, connection->db);    }    return err;}
开发者ID:yuzhiyun,项目名称:platform_frameworks_base,代码行数:10,


示例6: throw_sqlite3_exception

/* throw a SQLiteException with a message appropriate for the error in handle   concatenated with the given message */void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle, const char* message) {    if (handle) {        throw_sqlite3_exception(env, sqlite3_errcode(handle),                                sqlite3_errmsg(handle), message);    } else {        // we use SQLITE_OK so that a generic SQLiteException is thrown;        // any code not specified in the switch statement below would do.        throw_sqlite3_exception(env, SQLITE_OK, "unknown error", message);    }}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:13,


示例7: assert

/** Class:     com_sabo_sqlite_SQLiteDatabase_SQLiteQuery* Method:    nativeQuery* Signature: (J)[Ljava/lang/String;*/JNIEXPORT jobjectArray JNICALL Java_com_sabo_sqlite_SQLiteDatabase_00024SQLiteQuery_nativeQuery(JNIEnv *env, jobject clazz, jlong statementPtr) {	sqlite3_stmt *pStmt;	jobjectArray objArray;	int nCol;	int i;	int rc;	int nLen;	jchar *zVal;	jclass clazzString;	jstring val;	assert(statementPtr != 0);	pStmt = (sqlite3_stmt *)statementPtr;	nCol = sqlite3_column_count(pStmt);	assert(nCol > 0);	clazzString = env->FindClass("java/lang/String");	assert(clazzString != NULL);	/**	  Ignore to check clazzString.	*/	if (nCol <= 0) throw_sqlite3_exception(env, "[SQLite]: nCol is less than 1.");	objArray = env->NewObjectArray(nCol, clazzString, NULL);	if (objArray == NULL) throw_sqlite3_exception(env, "[SQLite]: Allocate objArray failed (No enough memory)");	rc = sqlite3_step(pStmt);		if (rc == SQLITE_ROW) {		for (i = 0; i < nCol; ++i) {			zVal = (jchar *)sqlite3_column_text16(pStmt, i);			nLen = 0;			if (zVal) {				nLen = sqlite3_column_bytes16(pStmt, i);				assert(nLen > 0);			}			if (nLen > 0) {				val = env->NewString(zVal, nLen/sizeof(jchar));				assert(val != NULL);				if (val == NULL) throw_sqlite3_exception(env, "[SQLite]: NewString failed...");			}			else {				val = NULL;			}			env->SetObjectArrayElement(objArray, i, val);		}	}	else {		if (rc == SQLITE_OK || rc == SQLITE_DONE) {			return NULL;		}		throw_sqlite3_exception(env, "[SQLITE]: Fail to run sqltie3_step.");	}	return objArray;}
开发者ID:augustus0725,项目名称:EasySQLite,代码行数:59,


示例8: throw_sqlite3_exception

/* throw a SQLiteException with a message appropriate for the error in handle   concatenated with the given message */void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle, const char* message) {    if (handle) {        // get the error code and message from the SQLite connection        // the error message may contain more information than the error code        // because it is based on the extended error code rather than the simplified        // error code that SQLite normally returns.        throw_sqlite3_exception(env, sqlite3_extended_errcode(handle),                sqlite3_errmsg(handle), message);    } else {        // we use SQLITE_OK so that a generic SQLiteException is thrown;        // any code not specified in the switch statement below would do.        throw_sqlite3_exception(env, SQLITE_OK, "unknown error", message);    }}
开发者ID:MaTriXy,项目名称:sqlite-android,代码行数:17,


示例9: native_execSQL

/* public native void native_execSQL(String sql); */static void native_execSQL(JNIEnv* env, jobject object, jstring sqlString){    int err;    int stepErr;    sqlite3_stmt * statement = NULL;    sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);    jchar const * sql = env->GetStringChars(sqlString, NULL);    jsize sqlLen = env->GetStringLength(sqlString);    if (sql == NULL || sqlLen == 0) {        jniThrowException(env, "java/lang/IllegalArgumentException", "You must supply an SQL string");        return;    }    err = sqlite3_prepare16_v2(handle, sql, sqlLen * 2, &statement, NULL);    env->ReleaseStringChars(sqlString, sql);    if (err != SQLITE_OK) {        char const * sql8 = env->GetStringUTFChars(sqlString, NULL);        LOGE("Failure %d (%s) on %p when preparing '%s'./n", err, sqlite3_errmsg(handle), handle, sql8);        throw_sqlite3_exception(env, handle, sql8);        env->ReleaseStringUTFChars(sqlString, sql8);        return;    }    stepErr = sqlite3_step(statement);    err = sqlite3_finalize(statement);    if (stepErr != SQLITE_DONE) {        if (stepErr == SQLITE_ROW) {            throw_sqlite3_exception(env, "Queries cannot be performed using execSQL(), use query() instead.");        } else {            char const * sql8 = env->GetStringUTFChars(sqlString, NULL);            LOGE("Failure %d (%s) on %p when executing '%s'/n", err, sqlite3_errmsg(handle), handle, sql8);            throw_sqlite3_exception(env, handle, sql8);            env->ReleaseStringUTFChars(sqlString, sql8);        }    } else#ifndef DB_LOG_STATEMENTS    IF_LOGV()#endif    {        char const * sql8 = env->GetStringUTFChars(sqlString, NULL);        LOGV("Success on %p when executing '%s'/n", handle, sql8);        env->ReleaseStringUTFChars(sqlString, sql8);    }}
开发者ID:Abhishekh-TEL,项目名称:pdroid,代码行数:50,


示例10: Java_com_jim_multipos_utils_database_AbstractSQLite_closedb

//close dbvoid Java_com_jim_multipos_utils_database_AbstractSQLite_closedb(JNIEnv *env, jobject object, int sqliteHandle) {    sqlite3 *handle = (sqlite3 *)sqliteHandle;    int err = sqlite3_close(handle);    if (SQLITE_OK != err) {        throw_sqlite3_exception(env, handle, err);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:8,


示例11: nativeGetDouble

static jdouble nativeGetDouble(JNIEnv* env, jclass clazz, jlong windowPtr,        jint row, jint column) {    CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr);    LOG_WINDOW("Getting double for %d,%d from %p", row, column, window);    CursorWindow::FieldSlot* fieldSlot = window->getFieldSlot(row, column);    if (!fieldSlot) {        throwExceptionWithRowCol(env, row, column);        return 0.0;    }    int32_t type = window->getFieldSlotType(fieldSlot);    if (type == CursorWindow::FIELD_TYPE_FLOAT) {        return window->getFieldSlotValueDouble(fieldSlot);    } else if (type == CursorWindow::FIELD_TYPE_STRING) {        size_t sizeIncludingNull;        const char* value = window->getFieldSlotValueString(fieldSlot, &sizeIncludingNull);        return sizeIncludingNull > 1 ? strtod(value, NULL) : 0.0;    } else if (type == CursorWindow::FIELD_TYPE_INTEGER) {        return jdouble(window->getFieldSlotValueLong(fieldSlot));    } else if (type == CursorWindow::FIELD_TYPE_NULL) {        return 0.0;    } else if (type == CursorWindow::FIELD_TYPE_BLOB) {        throw_sqlite3_exception(env, "Unable to convert BLOB to double");        return 0.0;    } else {        throwUnknownTypeException(env, type);        return 0.0;    }}
开发者ID:android-source,项目名称:platform_frameworks_base,代码行数:30,


示例12: Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_closedb

void Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_closedb(JNIEnv *env, jobject object, int sqliteHandle) {	sqlite3 *handle = (sqlite3 *)sqliteHandle;	int err = sqlite3_close(handle);	if (SQLITE_OK != err) {		throw_sqlite3_exception(env, handle, err);	}}
开发者ID:yuvidigital,项目名称:CustomMessenger,代码行数:7,


示例13: Java_com_jim_multipos_utils_database_SQLitePreparedStatement_reset

void Java_com_jim_multipos_utils_database_SQLitePreparedStatement_reset(JNIEnv *env, jobject object, int statementHandle) {    sqlite3_stmt *handle = (sqlite3_stmt *) statementHandle;    int errcode = sqlite3_reset(handle);    if (SQLITE_OK != errcode) {        throw_sqlite3_exception(env, sqlite3_db_handle(handle), errcode);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:7,


示例14: native_finalize

static void native_finalize(JNIEnv* env, jobject object){    char buf[66];    strcpy(buf, "com_sqlcrypt_database_SQLiteProgram->native_finalize() not implemented");    throw_sqlite3_exception(env, GET_HANDLE(env, object), buf);    return;}
开发者ID:274737258,项目名称:android-sqlite-encrypt,代码行数:7,


示例15: dbclose

/* public native void close(); */static void dbclose(JNIEnv* env, jobject object){    sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);    if (handle != NULL) {        // release the memory associated with the traceFuncArg in enableSqlTracing function        void *traceFuncArg = sqlite3_trace(handle, &sqlTrace, NULL);        if (traceFuncArg != NULL) {            free(traceFuncArg);        }        // release the memory associated with the traceFuncArg in enableSqlProfiling function        traceFuncArg = sqlite3_profile(handle, &sqlProfile, NULL);        if (traceFuncArg != NULL) {            free(traceFuncArg);        }        LOGV("Closing database: handle=%p/n", handle);        int result = sqlite3_close(handle);        if (result == SQLITE_OK) {            LOGV("Closed %p/n", handle);            env->SetIntField(object, offset_db_handle, 0);        } else {            // This can happen if sub-objects aren't closed first.  Make sure the caller knows.            throw_sqlite3_exception(env, handle);            LOGE("sqlite3_close(%p) failed: %d/n", handle, result);        }    }}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:28,


示例16: native_compile

static void native_compile(JNIEnv* env, jobject object, jstring sqlString){    char buf[65];    strcpy(buf, "android_database_SQLiteProgram->native_compile() not implemented");    throw_sqlite3_exception(env, GET_HANDLE(env, object), buf);    return;}
开发者ID:draekko,项目名称:android-database-sqlcipher,代码行数:7,


示例17: Java_ir_persianfox_SQLite_SQLiteDatabase_closedb

void Java_ir_persianfox_SQLite_SQLiteDatabase_closedb(JNIEnv *env, jobject object, int sqliteHandle) {	sqlite3 *handle = (sqlite3 *)sqliteHandle;	int err = sqlite3_close(handle);	if (SQLITE_OK != err) {		throw_sqlite3_exception(env, handle, err);	}}
开发者ID:hadixm,项目名称:Telegram-Farsi,代码行数:7,


示例18: nativePrepareStatement

static jlong nativePrepareStatement(JNIEnv* env, jclass clazz, jlong connectionPtr,        jstring sqlString) {    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);    jsize sqlLength = env->GetStringLength(sqlString);    const jchar* sql = env->GetStringCritical(sqlString, NULL);    sqlite3_stmt* statement;    int err = sqlite3_prepare16_v2(connection->db,            sql, sqlLength * sizeof(jchar), &statement, NULL);    env->ReleaseStringCritical(sqlString, sql);    if (err != SQLITE_OK) {        // Error messages like 'near ")": syntax error' are not        // always helpful enough, so construct an error string that        // includes the query itself.        const char *query = env->GetStringUTFChars(sqlString, NULL);        char *message = (char*) malloc(strlen(query) + 50);        if (message) {            strcpy(message, ", while compiling: "); // less than 50 chars            strcat(message, query);        }        env->ReleaseStringUTFChars(sqlString, query);        throw_sqlite3_exception(env, connection->db, message);        free(message);        return 0;    }    ALOGV("Prepared statement %p on connection %p", statement, connection->db);    return reinterpret_cast<jlong>(statement);}
开发者ID:yuzhiyun,项目名称:platform_frameworks_base,代码行数:30,


示例19: executeOneRowQuery

static int executeOneRowQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3_stmt* statement) {    int err = sqlite3_step(statement);    if (err != SQLITE_ROW) {        throw_sqlite3_exception(env, connection->db);    }    return err;}
开发者ID:yuzhiyun,项目名称:platform_frameworks_base,代码行数:7,


示例20: Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindLong

//bind longvoid Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindLong(JNIEnv *env, jobject object, int statementHandle, int index, long long value) {    sqlite3_stmt *handle = (sqlite3_stmt *) statementHandle;    int errcode = sqlite3_bind_int64(handle, index, value);    if (SQLITE_OK != errcode) {        throw_sqlite3_exception(env, sqlite3_db_handle(handle), errcode);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:9,


示例21: native_key_char

void native_key_char(JNIEnv* env, jobject object, jcharArray jKey){  char *keyUtf8        = 0;  int lenUtf8          = 0;  jchar* keyUtf16      = 0;  jsize lenUtf16       = 0;  UErrorCode status    = U_ZERO_ERROR;  UConverter *encoding = 0;  sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);  keyUtf16 = env->GetCharArrayElements(jKey, 0);  lenUtf16 = env->GetArrayLength(jKey);  // no key, bailing out.  if ( lenUtf16 == 0 ) goto done;  encoding = ucnv_open("UTF-8", &status);  if( U_FAILURE(status) ) {    throw_sqlite3_exception(env, "native_key_char: opening encoding converter failed");    goto done;  }  lenUtf8 = ucnv_fromUChars(encoding, NULL, 0, keyUtf16, lenUtf16, &status);  status = (status == U_BUFFER_OVERFLOW_ERROR) ? U_ZERO_ERROR : status;  if( U_FAILURE(status) ) {    throw_sqlite3_exception(env, "native_key_char: utf8 length unknown");    goto done;  }  keyUtf8 = (char*) malloc(lenUtf8 * sizeof(char));  ucnv_fromUChars(encoding, keyUtf8, lenUtf8, keyUtf16, lenUtf16, &status);  if( U_FAILURE(status) ) {    throw_sqlite3_exception(env, "native_key_char: utf8 conversion failed");    goto done;  }  if ( sqlite3_key(handle, keyUtf8, lenUtf8) != SQLITE_OK ) {    throw_sqlite3_exception(env, handle);  }done:  env->ReleaseCharArrayElements(jKey, keyUtf16, 0);  if(encoding != 0) ucnv_close(encoding);  if(keyUtf8 != 0)  free(keyUtf8);}
开发者ID:13kz,项目名称:android-database-sqlcipher,代码行数:46,


示例22: getString_native

static jstring getString_native(JNIEnv* env, jobject object, jint row, jint column){    int32_t err;    CursorWindow * window = GET_WINDOW(env, object);LOG_WINDOW("Getting string for %d,%d from %p", row, column, window);    field_slot_t field;    err = window->read_field_slot(row, column, &field);    if (err != 0) {        throwExceptionWithRowCol(env, row, column);        return NULL;    }    uint8_t type = field.type;    if (type == FIELD_TYPE_STRING) {        uint32_t size = field.data.buffer.size;        if (size > 0) {#if WINDOW_STORAGE_UTF8            // Pass size - 1 since the UTF8 is null terminated and we don't want a null terminator on the UTF16 string            String16 utf16((char const *)window->offsetToPtr(field.data.buffer.offset), size - 1);            return env->NewString((jchar const *)utf16.string(), utf16.size());#else            return env->NewString((jchar const *)window->offsetToPtr(field.data.buffer.offset), size / 2);#endif        } else {            return env->NewStringUTF("");        }    } else if (type == FIELD_TYPE_INTEGER) {        int64_t value;        if (window->getLong(row, column, &value)) {            char buf[32];            snprintf(buf, sizeof(buf), "%lld", value);            return env->NewStringUTF(buf);        }        return NULL;    } else if (type == FIELD_TYPE_FLOAT) {        double value;        if (window->getDouble(row, column, &value)) {            char buf[32];            //selete the print way by code to impove the precision            if (((value > 0.0001) && (value < 1000000)) || ((value < -0.0001) && (value > -1000000)))                snprintf(buf, sizeof(buf), "%lf", value);            else                snprintf(buf, sizeof(buf), "%e", value);            return env->NewStringUTF(buf);        }        return NULL;    } else if (type == FIELD_TYPE_NULL) {        return NULL;    } else if (type == FIELD_TYPE_BLOB) {        throw_sqlite3_exception(env, "Unable to convert BLOB to string");        return NULL;    } else {        throwUnknowTypeException(env, type);        return NULL;    }}
开发者ID:qingyue,项目名称:platform_frameworks,代码行数:58,


示例23: Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindByteBuffer

//binding none primitive typesvoid Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindByteBuffer(JNIEnv *env, jobject object, int statementHandle, int index, jobject value, int length) {    sqlite3_stmt *handle = (sqlite3_stmt *) statementHandle;    void *buf = env->GetDirectBufferAddress(value);    int errcode = sqlite3_bind_blob(handle, index, buf, length, SQLITE_STATIC);    if (SQLITE_OK != errcode) {        throw_sqlite3_exception(env, sqlite3_db_handle(handle), errcode);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:10,


示例24: memcpy

ECode CursorWindow::NativeGetBlob(    /* [in] */ Int32 row,    /* [in] */ Int32 column,    /* [out] */ ArrayOf<Byte>** blob){    ECode ec = NOERROR;    int32_t err;    NativeCursorWindow * window = mNativeWindow;    // LOG_WINDOW("Getting blob for %d,%d from %p", row, column, window);    field_slot_t field;    err = window->read_field_slot(row, column, &field);    if (err != 0) {        *blob = NULL;        // throwExceptionWithRowCol(env, row, column);        return E_ILLEGAL_STATE_EXCEPTION;    }    uint8_t type = field.type;    if (type == FIELD_TYPE_BLOB || type == FIELD_TYPE_STRING) {        ArrayOf<Byte>* byteArray = ArrayOf<Byte>::Alloc(field.data.buffer.size);        // LOG_ASSERT(byteArray, "Native could not create new byte[]");        memcpy(byteArray->GetPayload(), window->offsetToPtr(field.data.buffer.offset),                field.data.buffer.size);        *blob = byteArray;        return NOERROR;    }    else if (type == FIELD_TYPE_INTEGER) {        ec = throw_sqlite3_exception(NULL);    }    else if (type == FIELD_TYPE_FLOAT) {        ec = throw_sqlite3_exception(NULL);    }    else if (type == FIELD_TYPE_NULL) {        // do nothing    }    else {        // throwUnknowTypeException(env, type);        ec = E_ILLEGAL_STATE_EXCEPTION;    }    *blob = NULL;    return ec;}
开发者ID:xianjimli,项目名称:Elastos,代码行数:43,


示例25: native_rawExecSQL

 void native_rawExecSQL(JNIEnv* env, jobject object, jstring sql) {   sqlite3 * handle = (sqlite3 *)env->GetLongField(object, offset_db_handle);   char const * sqlCommand = env->GetStringUTFChars(sql, NULL);   int status = sqlite3_exec(handle, sqlCommand, NULL, NULL, NULL);   env->ReleaseStringUTFChars(sql, sqlCommand);   if(status != SQLITE_OK){     throw_sqlite3_exception(env, handle);   } }
开发者ID:sqlcipher,项目名称:android-database-sqlcipher,代码行数:10,


示例26: nativeBindDouble

static void nativeBindDouble(JNIEnv* env, jclass clazz, jlong connectionPtr,        jlong statementPtr, jint index, jdouble value) {    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);    sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);    int err = sqlite3_bind_double(statement, index, value);    if (err != SQLITE_OK) {        throw_sqlite3_exception(env, connection->db, NULL);    }}
开发者ID:yuzhiyun,项目名称:platform_frameworks_base,代码行数:10,


示例27: native_clear_bindings

static void native_clear_bindings(JNIEnv* env, jobject object){    int err;    sqlite3_stmt * statement = GET_STATEMENT(env, object);    err = sqlite3_clear_bindings(statement);    if (err != SQLITE_OK) {        throw_sqlite3_exception(env, GET_HANDLE(env, object));        return;    }}
开发者ID:draekko,项目名称:android-database-sqlcipher,代码行数:11,


示例28: native_status

 int native_status(JNIEnv* env, jobject object, jint operation, jboolean reset) {   int value;   int highWater;   sqlite3 * handle = (sqlite3 *)env->GetLongField(object, offset_db_handle);   int status = sqlite3_status(operation, &value, &highWater, reset);   if(status != SQLITE_OK){     throw_sqlite3_exception(env, handle);   }   return value; }
开发者ID:sqlcipher,项目名称:android-database-sqlcipher,代码行数:11,


示例29: Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindString

//binding stringvoid Java_com_jim_multipos_utils_database_SQLitePreparedStatement_bindString(JNIEnv *env, jobject object, int statementHandle, int index, jstring value) {    sqlite3_stmt *handle = (sqlite3_stmt *) statementHandle;    char const *valueStr = env->GetStringUTFChars(value, 0);    int errcode = sqlite3_bind_text(handle, index, valueStr, -1, SQLITE_TRANSIENT);    if (SQLITE_OK != errcode) {        throw_sqlite3_exception(env, sqlite3_db_handle(handle), errcode);    }    if (valueStr != 0) {        env->ReleaseStringUTFChars(value, valueStr);    }}
开发者ID:achilovbakhrom,项目名称:multipos,代码行数:13,


示例30: nativeRegisterLocalizedCollators

static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jlong connectionPtr,        jstring localeStr) {    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);    const char* locale = env->GetStringUTFChars(localeStr, NULL);    int err = register_localized_collators(connection->db, locale, UTF16_STORAGE);    env->ReleaseStringUTFChars(localeStr, locale);    if (err != SQLITE_OK) {        throw_sqlite3_exception(env, connection->db);    }}
开发者ID:yuzhiyun,项目名称:platform_frameworks_base,代码行数:12,



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


C++ throw_wrong_arguments_nr函数代码示例
C++ throw_pdo_exception函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。