@@ -54,15 +54,17 @@ public static void main(String args[]) {
54
54
public void testProc0 ()
55
55
throws Exception
56
56
{
57
+ dropProcedure ( "spTestProc0" );
58
+ dropTable ( "tableTestProc0" );
59
+
57
60
Statement stmt = con .createStatement ();
58
- dropProcedure ( "#spTestProc0" );
59
61
60
- stmt .executeUpdate ( "create table # tableTestProc0 ( A varchar( 10 ) )" );
61
- stmt .executeUpdate ( "insert into # tableTestProc0 values( 'testval' )" );
62
- stmt .executeUpdate ( "create procedure # spTestProc0 as set nocount off select * into #tmp from # tableTestProc0 select * from #tmp" );
62
+ stmt .executeUpdate ( "create table tableTestProc0 ( A varchar( 10 ) )" );
63
+ stmt .executeUpdate ( "insert into tableTestProc0 values( 'testval' )" );
64
+ stmt .executeUpdate ( "create procedure spTestProc0 as set nocount off select * into #tmp from tableTestProc0 select * from #tmp" );
63
65
stmt .close ();
64
66
65
- CallableStatement cstmt = con .prepareCall ( "# spTestProc0" );
67
+ CallableStatement cstmt = con .prepareCall ( "spTestProc0" );
66
68
assertFalse ( cstmt .execute () );
67
69
assertEquals ( 1 , cstmt .getUpdateCount () );
68
70
@@ -124,9 +126,11 @@ public void testProc1() throws Exception {
124
126
}
125
127
126
128
public void testProc2 () throws Exception {
129
+ dropProcedure ( "multi1withcount" );
130
+ dropProcedure ( "multi1nocount" );
127
131
Statement stmt = con .createStatement ();
128
132
String sqlwithcount =
129
- "create procedure # multi1withcount as " +
133
+ "create procedure multi1withcount as " +
130
134
" set nocount off " +
131
135
" select 'a' " +
132
136
" select 'b' " +
@@ -137,7 +141,7 @@ public void testProc2() throws Exception {
137
141
" select 'a' " +
138
142
" select 'b' " ;
139
143
String sqlnocount =
140
- "create procedure # multi1nocount as " +
144
+ "create procedure multi1nocount as " +
141
145
" set nocount on " +
142
146
" select 'a' " +
143
147
" select 'b' " +
@@ -147,13 +151,13 @@ public void testProc2() throws Exception {
147
151
" insert into #multi1nocountt VALUES ('a') " +
148
152
" select 'a' " +
149
153
" select 'b' " ;
150
- dropProcedure ("# multi1withcount" );
151
- dropProcedure ("# multi1nocount" );
154
+ dropProcedure ("multi1withcount" );
155
+ dropProcedure ("multi1nocount" );
152
156
stmt .executeUpdate (sqlwithcount );
153
157
stmt .executeUpdate (sqlnocount );
154
158
stmt .close ();
155
159
156
- CallableStatement cstmt = con .prepareCall ("# multi1nocount" );
160
+ CallableStatement cstmt = con .prepareCall ("multi1nocount" );
157
161
assertTrue (cstmt .execute ());
158
162
ResultSet rs = cstmt .getResultSet ();
159
163
assertTrue (rs .next ());
@@ -175,7 +179,7 @@ public void testProc2() throws Exception {
175
179
assertTrue (!cstmt .getMoreResults () && cstmt .getUpdateCount () == -1 );
176
180
cstmt .close ();
177
181
178
- cstmt = con .prepareCall ("# multi1withcount" );
182
+ cstmt = con .prepareCall ("multi1withcount" );
179
183
180
184
// The JDBC-ODBC driver does not return update counts from stored
181
185
// procedures so we won't, either.
@@ -215,13 +219,16 @@ public void testProc2() throws Exception {
215
219
public void testProc3 ()
216
220
throws Exception
217
221
{
222
+ dropProcedure ( "spBug654" );
223
+ dropTable ( "Bug654" );
224
+
218
225
Statement stm = con .createStatement ();
219
- stm .executeUpdate ( "create table # Bug654 ( A int )" );
220
- stm .executeUpdate ( "insert into # Bug654 values ( 1 )" );
221
- stm .executeUpdate ( "create procedure # spBug654 as select * from # Bug654" );
226
+ stm .executeUpdate ( "create table Bug654 ( A int )" );
227
+ stm .executeUpdate ( "insert into Bug654 values ( 1 )" );
228
+ stm .executeUpdate ( "create procedure spBug654 as select * from Bug654" );
222
229
stm .close ();
223
230
224
- CallableStatement cstm = con .prepareCall ( "# spBug654" );
231
+ CallableStatement cstm = con .prepareCall ( "spBug654" );
225
232
226
233
ResultSet rs = cstm .executeQuery ();
227
234
assertNotNull ( rs );
@@ -336,11 +343,11 @@ public void testBatch1() throws Exception {
336
343
337
344
public void testBug457955 () throws Exception {
338
345
Statement stmt = con .createStatement ();
339
- dropProcedure ("# Bug457955" );
340
- stmt .executeUpdate (" create procedure # Bug457955 (@par1 VARCHAR(10)) as select @par1" );
346
+ dropProcedure ("Bug457955" );
347
+ stmt .executeUpdate (" create procedure Bug457955 (@par1 VARCHAR(10)) as select @par1" );
341
348
stmt .close ();
342
349
String param = "123456789" ;
343
- CallableStatement cstmt = con .prepareCall ("exec # Bug457955 ?" );
350
+ CallableStatement cstmt = con .prepareCall ("exec Bug457955 ?" );
344
351
cstmt .setString (1 , param );
345
352
cstmt .executeQuery ();
346
353
cstmt .close ();
@@ -489,17 +496,23 @@ public void testBigInt() throws Throwable {
489
496
}
490
497
491
498
public void testBoolean () throws Throwable {
492
- // String crtab = "create table #testBigInt (a bigint)";
493
- String crtab = "create table #testBit (a BIT NULL)" ;
499
+ // Sybase ASE doesn't support NULL values for fields of type BIT
500
+ String crtab = "create table #testBit (a BIT" + ( isMSSQL () ? " NULL" : "" ) + " )" ;
494
501
dropTable ("#testBit" );
495
502
Statement stmt = con .createStatement ();
496
503
stmt .executeUpdate (crtab );
497
- stmt .executeUpdate ("insert into #testBit values (NULL)" );
504
+ // Sybase ASE doesn't support NULL values for fields of type BIT
505
+ if ( isMSSQL () ) stmt .executeUpdate ("insert into #testBit values (NULL)" );
498
506
stmt .executeUpdate ("insert into #testBit values (0)" );
499
507
stmt .executeUpdate ("insert into #testBit values (1)" );
500
- ResultSet rs = stmt .executeQuery ("select * from #testBit where a is NULL" );
501
- rs .next ();
502
- rs .getBoolean (1 );
508
+ ResultSet rs ;
509
+ // Sybase ASE doesn't support NULL values for fields of type BIT
510
+ if ( isMSSQL () )
511
+ {
512
+ rs = stmt .executeQuery ("select * from #testBit where a is NULL" );
513
+ rs .next ();
514
+ rs .getBoolean (1 );
515
+ }
503
516
rs = stmt .executeQuery ("select * from #testBit where a = 0" );
504
517
rs .next ();
505
518
rs .getBoolean (1 );
0 commit comments