| 4 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 5 | return sqlite3_column_type(handle, columnIndex); |
| 6 | } |
| 7 |
| 8 | int Java_org_telegram_SQLite_SQLiteCursor_columnIsNull(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 9 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 10 | int valType = sqlite3_column_type(handle, columnIndex); |
| 11 | return SQLITE_NULL == valType; |
| 12 | } |
| 13 |
| 14 | int Java_org_telegram_SQLite_SQLiteCursor_columnIntValue(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 15 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 16 | int valType = sqlite3_column_type(handle, columnIndex); |
| 17 | if (SQLITE_NULL == valType) { |
| 18 | return 0; |
| 19 | } |
| 20 | return sqlite3_column_int(handle, columnIndex); |
| 21 | } |
| 22 |
| 23 | long long Java_org_telegram_SQLite_SQLiteCursor_columnLongValue(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 24 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 25 | int valType = sqlite3_column_type(handle, columnIndex); |
| 26 | if (SQLITE_NULL == valType) { |
| 27 | return 0; |
| 28 | } |
| 29 | return sqlite3_column_int64(handle, columnIndex); |
| 30 | } |
| 31 |
| 32 | double Java_org_telegram_SQLite_SQLiteCursor_columnDoubleValue(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 33 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 34 | int valType = sqlite3_column_type(handle, columnIndex); |
| 35 | if (SQLITE_NULL == valType) { |
| 36 | return 0; |
| 37 | } |
| 38 | return sqlite3_column_double(handle, columnIndex); |
| 39 | } |
| 40 |
| 41 | jstring Java_org_telegram_SQLite_SQLiteCursor_columnStringValue(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 42 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 43 | const char *str = sqlite3_column_text(handle, columnIndex); |
| 44 | if (str != 0) { |
| 45 | return (*env)->NewStringUTF(env, str); |
| 46 | } |
| 47 | return 0; |
| 48 | } |
| 49 |
| 50 | jbyteArray Java_org_telegram_SQLite_SQLiteCursor_columnByteArrayValue(JNIEnv *env, jobject object, int statementHandle, int columnIndex) { |
| 51 | sqlite3_stmt *handle = (sqlite3_stmt *)statementHandle; |
| 52 | void *buf = sqlite3_column_blob(handle, columnIndex); |
| 53 | int length = sqlite3_column_bytes(handle, columnIndex); |
| 54 | if (buf != 0 && length > 0) { |
| 55 | jbyteArray result = (*env)->NewByteArray(env, length); |
| 56 | (*env)->SetByteArrayRegion(env, result, 0, length, buf); |
| 57 | return result; |
| 58 | } |
| 59 | return 0; |
| 60 | } |
| 61 |