aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/jni/sqlite.c
blob: 124b3df2f68cb08fca6f36d3ad4e2c10c4bf8634 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include "sqlite/sqlite3.h"
#include "sqlite.h"

void throw_sqlite3_exception(JNIEnv *env, sqlite3 *handle, int errcode) {
	if (SQLITE_OK == errcode) {
		errcode = sqlite3_errcode(handle);
	}
	const char *errmsg = sqlite3_errmsg(handle);
	jclass exClass = (*env)->FindClass(env, "org/telegram/SQLite/SQLiteException");
	(*env)->ThrowNew(env, exClass, errmsg);
}