Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0671b65

Browse files
author
Barry Lind
committed
Applied patch from Kim Ho at redhat to improve boolean and bit handling
in the jdbc driver Modified Files: jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java
1 parentce90c0f commit0671b65

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
importjava.sql.Types;
2727
importjava.util.Vector;
2828

29-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.36 2003/09/13 04:02:15 barry Exp $
29+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.37 2003/09/17 05:07:37 barry Exp $
3030
* This class defines methods of the jdbc1 specification. This class is
3131
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
3232
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -917,7 +917,7 @@ public void setNull(int parameterIndex, int sqlType) throws SQLException
917917
*/
918918
publicvoidsetBoolean(intparameterIndex,booleanx)throwsSQLException
919919
{
920-
bind(parameterIndex,x ?"'t'" :"'f'",PG_BOOLEAN);
920+
bind(parameterIndex,x ?"'1'" :"'0'",PG_BOOLEAN);
921921
}
922922

923923
/*
@@ -1551,11 +1551,15 @@ else if (x instanceof Integer || x instanceof Long ||
15511551
caseTypes.BIT:
15521552
if (xinstanceofBoolean)
15531553
{
1554-
bind(parameterIndex, ((Boolean)x).booleanValue() ?"TRUE" :"FALSE",PG_TEXT);
1554+
bind(parameterIndex, ((Boolean)x).booleanValue() ?"'1'" :"'0'",PG_BOOLEAN);
1555+
}
1556+
elseif (xinstanceofString)
1557+
{
1558+
bind(parameterIndex,Boolean.valueOf(x.toString()).booleanValue() ?"'1'" :"'0'",PG_BOOLEAN);
15551559
}
15561560
elseif (xinstanceofNumber)
15571561
{
1558-
bind(parameterIndex, ((Number)x).intValue()==1 ?"TRUE" :"FALSE",PG_TEXT);
1562+
bind(parameterIndex, ((Number)x).intValue()==1 ?"'1'" :"'0'",PG_BOOLEAN);
15591563
}
15601564
else
15611565
{

‎src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importjava.sql.*;
66
importjava.util.Calendar;
77

8-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Statement.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
8+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Statement.java,v 1.3 2003/09/17 05:07:38 barry Exp $
99
* This class defines methods of the jdbc3 specification. This class extends
1010
* org.postgresql.jdbc2.AbstractJdbc2Statement which provides the jdbc2
1111
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc3.Jdbc3Statement
@@ -1359,5 +1359,16 @@ public java.net.URL getURL(String parameterName) throws SQLException
13591359
{
13601360
throworg.postgresql.Driver.notImplemented();
13611361
}
1362+
1363+
publicvoidsetObject(intparameterIndex,Objectx,inttargetSqlType,intscale)throwsSQLException
1364+
{
1365+
switch (targetSqlType)
1366+
{
1367+
caseTypes.BOOLEAN:
1368+
super.setObject(parameterIndex,x,Types.BIT,scale);
1369+
default:
1370+
super.setObject(parameterIndex,x,targetSqlType,scale);
1371+
}
1372+
}
13621373

13631374
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp