1
1
package com .annimon .ownlang .modules .jdbc ;
2
2
3
3
import com .annimon .ownlang .exceptions .ArgumentsMismatchException ;
4
+ import com .annimon .ownlang .exceptions .OwnLangRuntimeException ;
4
5
import com .annimon .ownlang .lib .*;
5
6
import com .annimon .ownlang .modules .Module ;
6
7
import java .io .IOException ;
@@ -99,7 +100,7 @@ private static com.annimon.ownlang.lib.Function getConnectionFunction(String con
99
100
throw new ArgumentsMismatchException ("Wrong number of arguments" );
100
101
}
101
102
} catch (Exception ex ) {
102
- throw new RuntimeException (ex );
103
+ throw new OwnLangRuntimeException (ex );
103
104
}
104
105
};
105
106
}
@@ -161,7 +162,7 @@ private Value createStatement(Value[] args) {
161
162
throw new ArgumentsMismatchException ("Wrong number of arguments" );
162
163
}
163
164
} catch (SQLException sqlex ) {
164
- throw new RuntimeException (sqlex );
165
+ throw new OwnLangRuntimeException (sqlex );
165
166
}
166
167
}
167
168
@@ -186,7 +187,7 @@ private Value prepareStatement(Value[] args) {
186
187
throw new ArgumentsMismatchException ("Wrong number of arguments" );
187
188
}
188
189
} catch (SQLException sqlex ) {
189
- throw new RuntimeException (sqlex );
190
+ throw new OwnLangRuntimeException (sqlex );
190
191
}
191
192
}
192
193
@@ -284,7 +285,7 @@ private void init() {
284
285
try {
285
286
return new URL (args [1 ].asString ());
286
287
} catch (IOException ioe ) {
287
- throw new RuntimeException (ioe );
288
+ throw new OwnLangRuntimeException (ioe );
288
289
}
289
290
}));
290
291
}
@@ -298,7 +299,7 @@ private Value addBatch(Value[] args) {
298
299
else statement .addBatch (args [0 ].asString ());
299
300
return NumberValue .ONE ;
300
301
} catch (SQLException sqlex ) {
301
- throw new RuntimeException (sqlex );
302
+ throw new OwnLangRuntimeException (sqlex );
302
303
}
303
304
}
304
305
@@ -316,7 +317,7 @@ private Value execute(Value[] args) {
316
317
(String [] columnNames ) -> statement .execute (sql , columnNames ));
317
318
return NumberValue .fromBoolean (result );
318
319
} catch (SQLException sqlex ) {
319
- throw new RuntimeException (sqlex );
320
+ throw new OwnLangRuntimeException (sqlex );
320
321
}
321
322
}
322
323
@@ -345,7 +346,7 @@ private Value executeUpdate(Value[] args) {
345
346
(String [] columnNames ) -> statement .executeUpdate (sql , columnNames ));
346
347
return NumberValue .of (rowCount );
347
348
} catch (SQLException sqlex ) {
348
- throw new RuntimeException (sqlex );
349
+ throw new OwnLangRuntimeException (sqlex );
349
350
}
350
351
}
351
352
@@ -363,7 +364,7 @@ private Value executeLargeUpdate(Value[] args) {
363
364
(String [] columnNames ) -> statement .executeLargeUpdate (sql , columnNames ));
364
365
return NumberValue .of (rowCount );
365
366
} catch (SQLException sqlex ) {
366
- throw new RuntimeException (sqlex );
367
+ throw new OwnLangRuntimeException (sqlex );
367
368
}
368
369
}
369
370
}
@@ -463,7 +464,7 @@ private Value findColumn(Value[] args) {
463
464
try {
464
465
return NumberValue .of (rs .findColumn (args [0 ].asString ()));
465
466
} catch (SQLException sqlex ) {
466
- throw new RuntimeException (sqlex );
467
+ throw new OwnLangRuntimeException (sqlex );
467
468
}
468
469
}
469
470
@@ -476,7 +477,7 @@ private Value updateNull(Value[] args) {
476
477
rs .updateNull (args [0 ].asString ());
477
478
return NumberValue .ONE ;
478
479
} catch (SQLException sqlex ) {
479
- throw new RuntimeException (sqlex );
480
+ throw new OwnLangRuntimeException (sqlex );
480
481
}
481
482
}
482
483
}
@@ -514,7 +515,7 @@ private static <T> T columnData(Value value, AutogeneratedKeys<T> autogeneratedK
514
515
return columnNamesFunction .apply (columnNames );
515
516
516
517
} catch (SQLException sqlex ) {
517
- throw new RuntimeException (sqlex );
518
+ throw new OwnLangRuntimeException (sqlex );
518
519
}
519
520
}
520
521
@@ -539,7 +540,7 @@ private static FunctionValue voidFunction(VoidResult result) {
539
540
result .execute ();
540
541
return NumberValue .ONE ;
541
542
} catch (SQLException sqlex ) {
542
- throw new RuntimeException (sqlex );
543
+ throw new OwnLangRuntimeException (sqlex );
543
544
}
544
545
});
545
546
}
@@ -551,7 +552,7 @@ private static FunctionValue voidIntFunction(VoidResultInt result) {
551
552
result .execute (args [0 ].asInt ());
552
553
return NumberValue .ONE ;
553
554
} catch (SQLException sqlex ) {
554
- throw new RuntimeException (sqlex );
555
+ throw new OwnLangRuntimeException (sqlex );
555
556
}
556
557
});
557
558
}
@@ -561,7 +562,7 @@ private static FunctionValue booleanFunction(BooleanResult result) {
561
562
try {
562
563
return NumberValue .fromBoolean (result .get ());
563
564
} catch (SQLException sqlex ) {
564
- throw new RuntimeException (sqlex );
565
+ throw new OwnLangRuntimeException (sqlex );
565
566
}
566
567
});
567
568
}
@@ -571,7 +572,7 @@ private static Value intFunction(IntResult numberResult) {
571
572
try {
572
573
return NumberValue .of (numberResult .get ());
573
574
} catch (SQLException sqlex ) {
574
- throw new RuntimeException (sqlex );
575
+ throw new OwnLangRuntimeException (sqlex );
575
576
}
576
577
});
577
578
}
@@ -581,7 +582,7 @@ private static Value stringFunction(StringResult stringResult) {
581
582
try {
582
583
return new StringValue (stringResult .get ());
583
584
} catch (SQLException sqlex ) {
584
- throw new RuntimeException (sqlex );
585
+ throw new OwnLangRuntimeException (sqlex );
585
586
}
586
587
});
587
588
}
@@ -591,7 +592,7 @@ private static <T> Value objectFunction(ObjectResult<T> objectResult, Function<T
591
592
try {
592
593
return converter .apply (objectResult .get ());
593
594
} catch (SQLException sqlex ) {
594
- throw new RuntimeException (sqlex );
595
+ throw new OwnLangRuntimeException (sqlex );
595
596
}
596
597
});
597
598
}
@@ -606,7 +607,7 @@ private static Value getBooleanResult(BooleanColumnResultInt numberResult, Boole
606
607
}
607
608
return NumberValue .fromBoolean (stringResult .get (args [0 ].asString ()));
608
609
} catch (SQLException sqlex ) {
609
- throw new RuntimeException (sqlex );
610
+ throw new OwnLangRuntimeException (sqlex );
610
611
}
611
612
});
612
613
}
@@ -620,7 +621,7 @@ private static Value getNumberResult(NumberColumnResultInt numberResult, NumberC
620
621
}
621
622
return NumberValue .of (stringResult .get (args [0 ].asString ()));
622
623
} catch (SQLException sqlex ) {
623
- throw new RuntimeException (sqlex );
624
+ throw new OwnLangRuntimeException (sqlex );
624
625
}
625
626
});
626
627
}
@@ -634,7 +635,7 @@ private static Value getStringResult(StringColumnResultInt numberResult, StringC
634
635
}
635
636
return new StringValue (stringResult .get (args [0 ].asString ()));
636
637
} catch (SQLException sqlex ) {
637
- throw new RuntimeException (sqlex );
638
+ throw new OwnLangRuntimeException (sqlex );
638
639
}
639
640
});
640
641
}
@@ -649,7 +650,7 @@ private static <T> Value getObjectResult(ObjectColumnResultInt<T> numberResult,
649
650
}
650
651
return converter .apply (stringResult .get (args [0 ].asString ()));
651
652
} catch (SQLException sqlex ) {
652
- throw new RuntimeException (sqlex );
653
+ throw new OwnLangRuntimeException (sqlex );
653
654
}
654
655
});
655
656
}
@@ -664,7 +665,7 @@ private static <T> Value getObjectResult(ObjectColumnResultInt<T> numberResult,
664
665
}
665
666
return converter .apply (stringResult .get (args [0 ].asString ()), args );
666
667
} catch (SQLException sqlex ) {
667
- throw new RuntimeException (sqlex );
668
+ throw new OwnLangRuntimeException (sqlex );
668
669
}
669
670
});
670
671
}
@@ -676,7 +677,7 @@ private static <T> Value updateData(VoidResultObject<T> result, Function<Value[]
676
677
result .execute (converter .apply (args ));
677
678
return NumberValue .ONE ;
678
679
} catch (SQLException sqlex ) {
679
- throw new RuntimeException (sqlex );
680
+ throw new OwnLangRuntimeException (sqlex );
680
681
}
681
682
});
682
683
}
@@ -688,7 +689,7 @@ private static <T> Value updateData(VoidColumnResultIntObject<T> numberResult, F
688
689
numberResult .execute (args [0 ].asInt (), converter .apply (args ));
689
690
return NumberValue .ONE ;
690
691
} catch (SQLException sqlex ) {
691
- throw new RuntimeException (sqlex );
692
+ throw new OwnLangRuntimeException (sqlex );
692
693
}
693
694
});
694
695
}
@@ -705,7 +706,7 @@ private static <T> Value updateData(VoidColumnResultIntObject<T> numberResult, V
705
706
}
706
707
return NumberValue .ONE ;
707
708
} catch (SQLException sqlex ) {
708
- throw new RuntimeException (sqlex );
709
+ throw new OwnLangRuntimeException (sqlex );
709
710
}
710
711
});
711
712
}
@@ -728,7 +729,7 @@ private static Value arrayToResultSetValue(Array array, Value[] args) {
728
729
}
729
730
return new ResultSetValue (result );
730
731
} catch (SQLException sqlex ) {
731
- throw new RuntimeException (sqlex );
732
+ throw new OwnLangRuntimeException (sqlex );
732
733
}
733
734
}
734
735
0 commit comments