1 #include<AbsSqlStatement.h>
6 /* DO NOT EDIT THIS FILE - it is machine generated */
8 /* Header for class JSqlStatement */
14 * Class: JSqlStatement
18 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_alloc
19 (JNIEnv
*env
, jobject obj
, jint mode
)
24 AbsSqlStatement
*stmt
;
26 stmt
= SqlFactory::createStatement(CSql
);
28 stmt
= SqlFactory::createStatement(CSqlGateway
);
30 cls
= env
->GetObjectClass( obj
);
31 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
34 jclass Exception
= env
->FindClass("java/lang/Exception");
35 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
38 env
->SetLongField( obj
, fid
, (jlong
) stmt
);
43 * Class: JSqlStatement
47 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_free
48 (JNIEnv
*env
, jobject obj
)
53 cls
= env
->GetObjectClass(obj
);
54 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
57 jclass Exception
= env
->FindClass("java/lang/Exception");
58 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
61 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
67 * Class: JSqlStatement
71 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_freeStmt
72 (JNIEnv
*env
, jobject obj
)
77 cls
= env
->GetObjectClass(obj
);
78 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
81 jclass Exception
= env
->FindClass("java/lang/Exception");
82 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
85 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
92 * Class: JSqlStatement
93 * Method: setConnectionPtr
96 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setConnectionPtr
97 (JNIEnv
*env
, jobject obj
, jlong conn
)
103 cls
= env
->GetObjectClass(obj
);
104 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
107 jclass Exception
= env
->FindClass("java/lang/Exception");
108 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
111 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
112 stmt
->setConnection((AbsSqlConnection
*) conn
);
117 * Class: JSqlStatement
119 * Signature: (Ljava/lang/String;)I
121 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlStatement_prepare
122 (JNIEnv
*env
, jobject obj
, jstring stmt
)
127 cls
= env
->GetObjectClass(obj
);
128 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
131 jclass Exception
= env
->FindClass("java/lang/Exception");
132 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
135 AbsSqlStatement
*s
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
136 jboolean isCopy
= JNI_TRUE
;
137 char *stmtString
= (char*) env
->GetStringUTFChars(stmt
, &isCopy
);
138 int rv
= s
->prepare(stmtString
);
143 * Class: JSqlStatement
147 JNIEXPORT jboolean JNICALL Java_csql_jdbc_JSqlStatement_isSelect
148 (JNIEnv
*env
, jobject obj
)
153 cls
= env
->GetObjectClass(obj
);
154 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
157 jclass Exception
= env
->FindClass("java/lang/Exception");
158 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
161 AbsSqlStatement
*s
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
162 return s
->isSelect();
166 * Class: JSqlStatement
170 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlStatement_execute
171 (JNIEnv
*env
, jobject obj
)
176 cls
= env
->GetObjectClass(obj
);
177 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
180 jclass Exception
= env
->FindClass("java/lang/Exception");
181 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
184 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
186 DbRetVal rv
= stmt
->execute(rowsAffected
);
187 if (rv
!= OK
) return -1;
192 * Class: JSqlStatement
196 JNIEXPORT jlong JNICALL Java_csql_jdbc_JSqlStatement_next
197 (JNIEnv
*env
, jobject obj
)
201 cls
= env
->GetObjectClass(obj
);
202 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
205 jclass Exception
= env
->FindClass("java/lang/Exception");
206 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
209 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
210 void *tuple
= stmt
->next();
211 if (NULL
== tuple
) return 0; else return 1;
215 * Class: JSqlStatement
219 JNIEXPORT jlong JNICALL Java_csql_jdbc_JSqlStatement_close
220 (JNIEnv
*env
, jobject obj
)
222 //TODO::stmt currently does not support close
225 cls
= env
->GetObjectClass(obj
);
226 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
229 jclass Exception
= env
->FindClass("java/lang/Exception");
230 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
233 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
240 * Class: JSqlStatement
244 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setBoolean
245 (JNIEnv
*env
, jobject obj
, jint position
, jint value
)
249 * Class: JSqlStatement
253 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setShort
254 (JNIEnv
*env
, jobject obj
, jint position
, jshort value
)
259 cls
= env
->GetObjectClass( obj
);
260 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
263 jclass Exception
= env
->FindClass("java/lang/Exception");
264 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
267 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
268 stmt
->setShortParam(position
, (short) value
);
273 * Class: JSqlStatement
277 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setInt
278 (JNIEnv
*env
, jobject obj
, jint position
, jint value
)
283 cls
= env
->GetObjectClass( obj
);
284 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
287 jclass Exception
= env
->FindClass("java/lang/Exception");
288 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
291 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
292 stmt
->setIntParam(position
, (int) value
);
297 * Class: JSqlStatement
301 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setLong
302 (JNIEnv
*env
, jobject obj
, jint position
, jlong value
)
307 cls
= env
->GetObjectClass( obj
);
308 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
311 jclass Exception
= env
->FindClass("java/lang/Exception");
312 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
315 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
316 stmt
->setLongParam(position
, (long) value
);
321 * Class: JSqlStatement
325 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setByte
326 (JNIEnv
*env
, jobject obj
, jint position
, jbyte value
)
331 cls
= env
->GetObjectClass( obj
);
332 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
335 jclass Exception
= env
->FindClass("java/lang/Exception");
336 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
339 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
340 stmt
->setByteIntParam(position
, (ByteInt
) value
);
344 * Class: JSqlStatement
348 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setFloat
349 (JNIEnv
*env
, jobject obj
, jint position
, jfloat value
)
354 cls
= env
->GetObjectClass( obj
);
355 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
358 jclass Exception
= env
->FindClass("java/lang/Exception");
359 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
362 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
363 stmt
->setFloatParam(position
, (float) value
);
368 * Class: JSqlStatement
372 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setDouble
373 (JNIEnv
*env
, jobject obj
, jint position
, jdouble value
)
378 cls
= env
->GetObjectClass( obj
);
379 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
382 jclass Exception
= env
->FindClass("java/lang/Exception");
383 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
386 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
387 stmt
->setDoubleParam(position
, (double) value
);
392 * Class: JSqlStatement
394 * Signature: (ILjava/lang/String;)V
396 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setString
397 (JNIEnv
*env
, jobject obj
, jint position
, jstring value
)
402 cls
= env
->GetObjectClass( obj
);
403 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
406 jclass Exception
= env
->FindClass("java/lang/Exception");
407 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
411 jboolean isCopy
= JNI_TRUE
;
412 char *valueStr
= (char*) env
->GetStringUTFChars( value
, &isCopy
);
414 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
415 stmt
->setStringParam(position
, valueStr
);
420 * Class: JSqlStatement
422 * Signature: (ILjava/sql/Date;)V
424 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setDate
425 (JNIEnv
*env
, jobject obj
, jint position
, jobject dateObj
)
430 jmethodID dateMethod
;
432 cls
= env
->GetObjectClass( obj
);
433 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
436 jclass Exception
= env
->FindClass("java/lang/Exception");
437 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
440 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
442 // Get date, month, year from java object
444 datecls
= env
->GetObjectClass( dateObj
);
445 dateMethod
= env
->GetMethodID( datecls
, "getYear", "()I");
446 y
= env
->CallIntMethod( dateObj
, dateMethod
);
447 dateMethod
= env
->GetMethodID( datecls
, "getMonth", "()I");
448 m
= env
->CallIntMethod( dateObj
, dateMethod
);
449 dateMethod
= env
->GetMethodID( datecls
, "getDate", "()I");
450 d
= env
->CallIntMethod( dateObj
, dateMethod
);
452 Date
date(y
+ 1900, m
+ 1, d
);
453 stmt
->setDateParam(position
, date
);
460 * Class: JSqlStatement
462 * Signature: (ILjava/sql/Time;)V
464 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setTime
465 (JNIEnv
*env
, jobject obj
, jint position
, jobject timeObj
)
470 jmethodID timeMethod
;
472 cls
= env
->GetObjectClass( obj
);
473 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
476 jclass Exception
= env
->FindClass("java/lang/Exception");
477 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
480 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
482 // Get hour, minures, secs from java object
484 timecls
= env
->GetObjectClass( timeObj
);
485 timeMethod
= env
->GetMethodID( timecls
, "getHours", "()I");
486 h
= env
->CallIntMethod( timeObj
, timeMethod
);
487 timeMethod
= env
->GetMethodID( timecls
, "getMinutes", "()I");
488 m
= env
->CallIntMethod( timeObj
, timeMethod
);
489 timeMethod
= env
->GetMethodID( timecls
, "getSeconds", "()I");
490 s
= env
->CallIntMethod( timeObj
, timeMethod
);
492 Time
time(h
, m
, s
, 0);
493 stmt
->setTimeParam(position
, time
);
499 * Class: JSqlStatement
500 * Method: setTimestamp
501 * Signature: (ILjava/sql/Timestamp;)V
503 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setTimestamp
504 (JNIEnv
*env
, jobject obj
, jint position
, jobject timeObj
)
509 jmethodID timeMethod
;
511 cls
= env
->GetObjectClass( obj
);
512 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
515 jclass Exception
= env
->FindClass("java/lang/Exception");
516 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
519 AbsSqlStatement
*stmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
521 // Get year, month, day, hour, minutes, secs from java object
522 int y
, mo
, d
, h
, mn
, s
;
523 timecls
= env
->GetObjectClass( timeObj
);
525 timeMethod
= env
->GetMethodID( timecls
, "getYear", "()I");
526 y
= env
->CallIntMethod( timeObj
, timeMethod
);
527 timeMethod
= env
->GetMethodID( timecls
, "getMonth", "()I");
528 mo
= env
->CallIntMethod( timeObj
, timeMethod
);
529 timeMethod
= env
->GetMethodID( timecls
, "getDate", "()I");
530 d
= env
->CallIntMethod( timeObj
, timeMethod
);
531 timeMethod
= env
->GetMethodID( timecls
, "getHours", "()I");
532 h
= env
->CallIntMethod( timeObj
, timeMethod
);
533 timeMethod
= env
->GetMethodID( timecls
, "getMinutes", "()I");
534 mn
= env
->CallIntMethod( timeObj
, timeMethod
);
535 timeMethod
= env
->GetMethodID( timecls
, "getSeconds", "()I");
536 s
= env
->CallIntMethod( timeObj
, timeMethod
);
538 TimeStamp
timeStamp(y
+ 1900, mo
+ 1, d
, h
, mn
, s
, 0);
539 stmt
->setTimeStampParam(position
, timeStamp
);
545 * Class: JSqlStatement
549 JNIEXPORT jshort JNICALL Java_csql_jdbc_JSqlStatement_getShort
550 (JNIEnv
*env
, jobject obj
, jint pos
)
555 cls
= env
->GetObjectClass( obj
);
556 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
559 jclass Exception
= env
->FindClass("java/lang/Exception");
560 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
563 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
568 // Read data at column
569 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
570 return( * ((short*)fvp
) );
574 * Class: JSqlStatement
578 JNIEXPORT
void JNICALL Java_csql_jdbc_JSqlStatement_setNull
579 (JNIEnv
*, jobject
, jint
);
582 * Class: JSqlStatement
586 JNIEXPORT jint JNICALL Java_csql_jdbc_JSqlStatement_getInt
587 (JNIEnv
*env
, jobject obj
, jint pos
)
592 cls
= env
->GetObjectClass( obj
);
593 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
596 jclass Exception
= env
->FindClass("java/lang/Exception");
597 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
600 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
605 // Read data at column
606 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
607 return( * ((int*)fvp
) );
611 * Class: JSqlStatement
615 JNIEXPORT jlong JNICALL Java_csql_jdbc_JSqlStatement_getLong
616 (JNIEnv
*env
, jobject obj
, jint pos
)
621 cls
= env
->GetObjectClass( obj
);
622 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
625 jclass Exception
= env
->FindClass("java/lang/Exception");
626 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
629 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
634 // Read data at column
635 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
636 return( * ((long*)fvp
) );
640 * Class: JSqlStatement
644 JNIEXPORT jbyte JNICALL Java_csql_jdbc_JSqlStatement_getByte
645 (JNIEnv
*env
, jobject obj
, jint pos
)
650 cls
= env
->GetObjectClass( obj
);
651 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
654 jclass Exception
= env
->FindClass("java/lang/Exception");
655 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
658 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
663 // Read data at column
664 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
665 return( * ((char*)fvp
) );
669 * Class: JSqlStatement
673 JNIEXPORT jfloat JNICALL Java_csql_jdbc_JSqlStatement_getFloat
674 (JNIEnv
*env
, jobject obj
, jint pos
)
679 cls
= env
->GetObjectClass( obj
);
680 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
683 jclass Exception
= env
->FindClass("java/lang/Exception");
684 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
687 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
692 // Read data at column
693 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
694 return( * ((float*)fvp
) );
698 * Class: JSqlStatement
702 JNIEXPORT jdouble JNICALL Java_csql_jdbc_JSqlStatement_getDouble
703 (JNIEnv
*env
, jobject obj
, jint pos
)
708 cls
= env
->GetObjectClass( obj
);
709 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
712 jclass Exception
= env
->FindClass("java/lang/Exception");
713 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
716 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
721 // Read data at column
722 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
723 return( * ((double*)fvp
) );
727 * Class: JSqlStatement
729 * Signature: (I)Ljava/lang/String;
731 JNIEXPORT jstring JNICALL Java_csql_jdbc_JSqlStatement_getString
732 (JNIEnv
*env
, jobject obj
, jint pos
)
737 cls
= env
->GetObjectClass( obj
);
738 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
741 jclass Exception
= env
->FindClass("java/lang/Exception");
742 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
743 return( (jstring
) 0 );
745 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
750 // Read data at column
751 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
752 return( env
->NewStringUTF( (char*) fvp
) );
756 * Class: JSqlStatement
760 JNIEXPORT jbyteArray JNICALL Java_csql_jdbc_JSqlStatement_getBytes
761 (JNIEnv
*, jobject
, jint
);
764 * Class: JSqlStatement
766 * Signature: (I)Ljava/sql/Date;
768 JNIEXPORT jobject JNICALL Java_csql_jdbc_JSqlStatement_getDate
769 (JNIEnv
*env
, jobject obj
, jint pos
)
774 cls
= env
->GetObjectClass( obj
);
775 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
778 jclass Exception
= env
->FindClass("java/lang/Exception");
779 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
780 return( (jobject
) 0 );
782 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
787 // Read data at column
788 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
790 // Create Java Object
791 jclass cDate
= env
->FindClass("java/sql/Date");
792 jmethodID methodID
= env
->GetMethodID( cDate
, "<init>", "(III)V" );
795 Date
*dt
= (Date
*) fvp
;
796 dateObj
= env
->NewObject( cDate
, methodID
,
797 (jint
) dt
->year()-1900, (jint
) dt
->month() - 1,
798 (jint
) dt
->dayOfMonth() );
804 * Class: JSqlStatement
806 * Signature: (I)Ljava/sql/Time;
808 JNIEXPORT jobject JNICALL Java_csql_jdbc_JSqlStatement_getTime
809 (JNIEnv
*env
, jobject obj
, jint pos
)
814 cls
= env
->GetObjectClass( obj
);
815 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
818 jclass Exception
= env
->FindClass("java/lang/Exception");
819 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
820 return( (jobject
) 0 );
822 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
827 // Read data at column
828 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
830 // Create Java Object
831 jclass cTime
= env
->FindClass("java/sql/Time");
832 jmethodID methodID
= env
->GetMethodID( cTime
, "<init>", "(III)V" );
835 Time
*tm
= (Time
*) fvp
;
836 timeObj
= env
->NewObject( cTime
, methodID
,
837 (jint
) tm
->hours(), (jint
) tm
->minutes(),
838 (jint
) tm
->seconds() );
844 * Class: JSqlStatement
845 * Method: getTimestamp
846 * Signature: (I)Ljava/sql/Timestamp;
848 JNIEXPORT jobject JNICALL Java_csql_jdbc_JSqlStatement_getTimestamp
849 (JNIEnv
*env
, jobject obj
, jint pos
)
854 cls
= env
->GetObjectClass( obj
);
855 fid
= env
->GetFieldID( cls
, "sqlStmtPtr", "J");
858 jclass Exception
= env
->FindClass("java/lang/Exception");
859 env
->ThrowNew(Exception
,"JNI: GetFieldID failed.\n");
860 return( (jobject
) 0 );
862 AbsSqlStatement
*sqlStmt
= (AbsSqlStatement
*) env
->GetLongField( obj
, fid
);
867 // Read data at column
868 void *fvp
= sqlStmt
->getFieldValuePtr( pos
);
870 // Create Java Object
871 jclass cTimestamp
= env
->FindClass("java/sql/Timestamp");
872 jmethodID methodID
= env
->GetMethodID( cTimestamp
, "<init>", "(IIIIIII)V" );
875 TimeStamp
*ts
= (TimeStamp
*) fvp
;
876 timeObj
= env
->NewObject( cTimestamp
, methodID
, \
877 (jint
) ts
->year()-1900, (jint
) ts
->month() - 1, (jint
) ts
->dayOfMonth(), \
878 (jint
) ts
->hours(), (jint
) ts
->minutes(), (jint
) ts
->seconds(), (jint
) 0 );
884 * Class: JSqlStatement
888 JNIEXPORT jboolean JNICALL Java_csql_jdbc_JSqlStatement_getBoolean
889 (JNIEnv
*, jobject
, jint
);