#include <AbsSqlStatement.h>
#include <SqlFactory.h>
#include <jni.h>
Include dependency graph for JSqlConnection.cxx:
Go to the source code of this file.
Functions | |
JNIEXPORT void JNICALL | Java_csql_jdbc_JSqlConnection_alloc (JNIEnv *env, jobject obj, jint mode) |
JNIEXPORT void JNICALL | Java_csql_jdbc_JSqlConnection_free (JNIEnv *env, jobject obj) |
JNIEXPORT jint JNICALL | Java_csql_jdbc_JSqlConnection_connect (JNIEnv *env, jobject obj, jstring user, jstring pass) |
JNIEXPORT jint JNICALL | Java_csql_jdbc_JSqlConnection_disconnect (JNIEnv *env, jobject obj) |
JNIEXPORT jboolean JNICALL | Java_csql_jdbc_JSqlConnection_isOpen (JNIEnv *env, jobject obj) |
JNIEXPORT jint JNICALL | Java_csql_jdbc_JSqlConnection_beginTrans (JNIEnv *env, jobject obj, jint type) |
JNIEXPORT jint JNICALL | Java_csql_jdbc_JSqlConnection_commit (JNIEnv *env, jobject obj) |
JNIEXPORT jint JNICALL | Java_csql_jdbc_JSqlConnection_rollback (JNIEnv *env, jobject obj) |
JNIEXPORT void JNICALL Java_csql_jdbc_JSqlConnection_alloc | ( | JNIEnv * | env, | |
jobject | obj, | |||
jint | mode | |||
) |
Definition at line 16 of file JSqlConnection.cxx.
References SqlFactory::createConnection(), CSql, and CSqlGateway.
00017 { 00018 jclass cls; 00019 jfieldID fid; 00020 00021 // Create new SqlConnection 00022 AbsSqlConnection *con; 00023 if (mode ==1 ) 00024 con = SqlFactory::createConnection(CSql); 00025 else 00026 con = SqlFactory::createConnection(CSqlGateway); 00027 00028 cls = env->GetObjectClass( obj ); 00029 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00030 if (fid == 0) 00031 { 00032 jclass Exception = env->FindClass("java/lang/Exception"); 00033 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00034 return; 00035 } 00036 env->SetLongField( obj, fid, (jlong) con ); 00037 return; 00038 }
Here is the call graph for this function:
JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_beginTrans | ( | JNIEnv * | env, | |
jobject | obj, | |||
jint | type | |||
) |
Definition at line 135 of file JSqlConnection.cxx.
References AbsSqlConnection::beginTrans().
00136 { 00137 jclass cls; 00138 jfieldID fid; 00139 00140 cls = env->GetObjectClass( obj ); 00141 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00142 if (fid == 0) 00143 { 00144 jclass Exception = env->FindClass("java/lang/Exception"); 00145 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00146 return( -1 ); 00147 } 00148 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00149 jint rv = (jint) con->beginTrans((IsolationLevel) type ); 00150 return rv; 00151 }
Here is the call graph for this function:
JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_commit | ( | JNIEnv * | env, | |
jobject | obj | |||
) |
Definition at line 159 of file JSqlConnection.cxx.
References AbsSqlConnection::commit().
00160 { 00161 jclass cls; 00162 jfieldID fid; 00163 00164 cls = env->GetObjectClass( obj ); 00165 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00166 if (fid == 0) 00167 { 00168 jclass Exception = env->FindClass("java/lang/Exception"); 00169 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00170 return( -1 ); 00171 } 00172 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00173 jint rv = (jint) con->commit(); 00174 return rv; 00175 00176 }
Here is the call graph for this function:
JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_connect | ( | JNIEnv * | env, | |
jobject | obj, | |||
jstring | user, | |||
jstring | pass | |||
) |
Definition at line 70 of file JSqlConnection.cxx.
References AbsSqlConnection::connect().
00071 { 00072 jclass cls; 00073 jfieldID fid; 00074 char *username=0, *password=0; 00075 00076 cls = env->GetObjectClass( obj ); 00077 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00078 if (fid == 0) 00079 { 00080 jclass Exception = env->FindClass("java/lang/Exception"); 00081 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00082 return( -1 ); 00083 } 00084 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00085 jboolean isCopy = JNI_TRUE; 00086 username = (char*) env->GetStringUTFChars( user, &isCopy ); 00087 password = (char*) env->GetStringUTFChars( pass, &isCopy ); 00088 jint rv = (jint) con->connect(username, password); 00089 return rv; 00090 }
Here is the call graph for this function:
JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_disconnect | ( | JNIEnv * | env, | |
jobject | obj | |||
) |
Definition at line 98 of file JSqlConnection.cxx.
References AbsSqlConnection::disconnect().
00099 { 00100 jclass cls; 00101 jfieldID fid; 00102 00103 cls = env->GetObjectClass( obj ); 00104 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00105 if (fid == 0) 00106 { 00107 jclass Exception = env->FindClass("java/lang/Exception"); 00108 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00109 return( -1 ); 00110 } 00111 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00112 jint rv = (jint) con->disconnect(); 00113 return rv; 00114 00115 }
Here is the call graph for this function:
JNIEXPORT void JNICALL Java_csql_jdbc_JSqlConnection_free | ( | JNIEnv * | env, | |
jobject | obj | |||
) |
Definition at line 46 of file JSqlConnection.cxx.
00047 { 00048 jclass cls; 00049 jfieldID fid; 00050 00051 cls = env->GetObjectClass( obj ); 00052 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00053 if (fid == 0) 00054 { 00055 jclass Exception = env->FindClass("java/lang/Exception"); 00056 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00057 return; 00058 } 00059 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00060 delete con; 00061 return; 00062 }
JNIEXPORT jboolean JNICALL Java_csql_jdbc_JSqlConnection_isOpen | ( | JNIEnv * | env, | |
jobject | obj | |||
) |
JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlConnection_rollback | ( | JNIEnv * | env, | |
jobject | obj | |||
) |
Definition at line 184 of file JSqlConnection.cxx.
References AbsSqlConnection::rollback().
00185 { 00186 jclass cls; 00187 jfieldID fid; 00188 00189 cls = env->GetObjectClass( obj ); 00190 fid = env->GetFieldID( cls, "sqlConPtr", "J"); 00191 if (fid == 0) 00192 { 00193 jclass Exception = env->FindClass("java/lang/Exception"); 00194 env->ThrowNew(Exception,"JNI: GetFieldID failed.\n"); 00195 return( -1 ); 00196 } 00197 AbsSqlConnection *con = (AbsSqlConnection*) env->GetLongField( obj, fid ); 00198 jint rv = (jint) con->rollback(); 00199 return rv; 00200 00201 }
Here is the call graph for this function: