1 #include<AbsSqlStatement.h>
3 /* DO NOT EDIT THIS FILE - it is machine generated */
5 /* Header for class JSqlConnection */
11 * Class: JSqlConnection
15 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlConnection_alloc
16 (JNIEnv
*env
, jobject obj
)
21 // Create new SqlConnection
22 AbsSqlConnection
*con
= SqlFactory::createConnection(CSql
);
24 cls
= env
->GetObjectClass( obj
);
25 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
28 jclass Exception
= env
->FindClass("java/lang/Exception");
29 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
32 env
->SetLongField( obj
, fid
, (jlong
) con
);
37 * Class: JSqlConnection
41 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlConnection_free
42 (JNIEnv
*env
, jobject obj
)
47 cls
= env
->GetObjectClass( obj
);
48 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
51 jclass Exception
= env
->FindClass("java/lang/Exception");
52 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
55 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
61 * Class: JSqlConnection
63 * Signature: (Ljava/lang/String;Ljava/lang/String;)I
65 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_connect
66 (JNIEnv
*env
, jobject obj
, jstring user
, jstring pass
)
70 char *username
=0, *password
=0;
72 cls
= env
->GetObjectClass( obj
);
73 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
76 jclass Exception
= env
->FindClass("java/lang/Exception");
77 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
80 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
81 jboolean isCopy
= JNI_TRUE
;
82 username
= (char*) env
->GetStringUTFChars( user
, &isCopy
);
83 password
= (char*) env
->GetStringUTFChars( pass
, &isCopy
);
84 jint rv
= (jint
) con
->connect(username
, password
);
89 * Class: JSqlConnection
93 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_disconnect
94 (JNIEnv
*env
, jobject obj
)
99 cls
= env
->GetObjectClass( obj
);
100 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
103 jclass Exception
= env
->FindClass("java/lang/Exception");
104 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
107 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
108 jint rv
= (jint
) con
->disconnect();
114 * Class: JSqlConnection
118 JNIEXPORT jboolean JNICALL Java_csql_jdbc_JSqlConnection_isOpen
119 (JNIEnv
*env
, jobject obj
)
126 * Class: JSqlConnection
130 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_beginTrans
131 (JNIEnv
*env
, jobject obj
, jint type
)
136 cls
= env
->GetObjectClass( obj
);
137 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
140 jclass Exception
= env
->FindClass("java/lang/Exception");
141 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
144 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
145 jint rv
= (jint
) con
->beginTrans((IsolationLevel
) type
);
150 * Class: JSqlConnection
154 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_commit
155 (JNIEnv
*env
, jobject obj
)
160 cls
= env
->GetObjectClass( obj
);
161 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
164 jclass Exception
= env
->FindClass("java/lang/Exception");
165 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
168 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
169 jint rv
= (jint
) con
->commit();
175 * Class: JSqlConnection
179 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_rollback
180 (JNIEnv
*env
, jobject obj
)
185 cls
= env
->GetObjectClass( obj
);
186 fid
= env
->GetFieldID( cls
, "sqlConPtr", "J");
189 jclass Exception
= env
->FindClass("java/lang/Exception");
190 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
193 AbsSqlConnection
*con
= (AbsSqlConnection
*) env
->GetLongField( obj
, fid
);
194 jint rv
= (jint
) con
->rollback();