testing failed systests after bug fixes
[csql.git] / src / jdbc / JSqlConnection.cxx
blob07e5c845fbb4d659654bd6b9352506dab5353c8c
1 #include<AbsSqlStatement.h>
2 #include<SqlFactory.h>
3 /* DO NOT EDIT THIS FILE - it is machine generated */
4 #include <jni.h>
5 /* Header for class JSqlConnection */
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 * Class: JSqlConnection
12 * Method: alloc
13 * Signature: ()V
15 JNIEXPORT void JNICALL Java_csql_jdbc_JSqlConnection_alloc
16 (JNIEnv *env, jobject obj)
18 jclass cls;
19 jfieldID fid;
21 // Create new SqlConnection
22 AbsSqlConnection *con = SqlFactory::createConnection(CSql);
24 cls = env->GetObjectClass( obj );
25 fid = env->GetFieldID( cls, "sqlConPtr", "J");
26 if (fid == 0)
28 jclass Exception = env->FindClass("java/lang/Exception");
29 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
30 return;
32 env->SetLongField( obj, fid, (jlong) con );
33 return;
37 * Class: JSqlConnection
38 * Method: free
39 * Signature: ()V
41 JNIEXPORT void JNICALL Java_csql_jdbc_JSqlConnection_free
42 (JNIEnv *env, jobject obj)
44 jclass cls;
45 jfieldID fid;
47 cls = env->GetObjectClass( obj );
48 fid = env->GetFieldID( cls, "sqlConPtr", "J");
49 if (fid == 0)
51 jclass Exception = env->FindClass("java/lang/Exception");
52 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
53 return;
55 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid );
56 delete con;
57 return;
61 * Class: JSqlConnection
62 * Method: connect
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)
68 jclass cls;
69 jfieldID fid;
70 char *username=0, *password=0;
72 cls = env->GetObjectClass( obj );
73 fid = env->GetFieldID( cls, "sqlConPtr", "J");
74 if (fid == 0)
76 jclass Exception = env->FindClass("java/lang/Exception");
77 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
78 return( -1 );
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);
85 return rv;
89 * Class: JSqlConnection
90 * Method: disconnect
91 * Signature: ()I
93 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_disconnect
94 (JNIEnv *env, jobject obj)
96 jclass cls;
97 jfieldID fid;
99 cls = env->GetObjectClass( obj );
100 fid = env->GetFieldID( cls, "sqlConPtr", "J");
101 if (fid == 0)
103 jclass Exception = env->FindClass("java/lang/Exception");
104 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
105 return( -1 );
107 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid );
108 jint rv = (jint) con->disconnect();
109 return rv;
114 * Class: JSqlConnection
115 * Method: isOpen
116 * Signature: ()Z
118 JNIEXPORT jboolean JNICALL Java_csql_jdbc_JSqlConnection_isOpen
119 (JNIEnv *env, jobject obj)
121 //TODO
122 return false;
126 * Class: JSqlConnection
127 * Method: beginTrans
128 * Signature: (I)I
130 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_beginTrans
131 (JNIEnv *env, jobject obj, jint type)
133 jclass cls;
134 jfieldID fid;
136 cls = env->GetObjectClass( obj );
137 fid = env->GetFieldID( cls, "sqlConPtr", "J");
138 if (fid == 0)
140 jclass Exception = env->FindClass("java/lang/Exception");
141 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
142 return( -1 );
144 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid );
145 jint rv = (jint) con->beginTrans((IsolationLevel) type );
146 return rv;
150 * Class: JSqlConnection
151 * Method: commit
152 * Signature: ()I
154 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_commit
155 (JNIEnv *env, jobject obj)
157 jclass cls;
158 jfieldID fid;
160 cls = env->GetObjectClass( obj );
161 fid = env->GetFieldID( cls, "sqlConPtr", "J");
162 if (fid == 0)
164 jclass Exception = env->FindClass("java/lang/Exception");
165 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
166 return( -1 );
168 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid );
169 jint rv = (jint) con->commit();
170 return rv;
175 * Class: JSqlConnection
176 * Method: rollback
177 * Signature: ()I
179 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_rollback
180 (JNIEnv *env, jobject obj)
182 jclass cls;
183 jfieldID fid;
185 cls = env->GetObjectClass( obj );
186 fid = env->GetFieldID( cls, "sqlConPtr", "J");
187 if (fid == 0)
189 jclass Exception = env->FindClass("java/lang/Exception");
190 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n");
191 return( -1 );
193 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid );
194 jint rv = (jint) con->rollback();
195 return rv;
199 #ifdef __cplusplus
201 #endif