You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2003/01/15 12:23:02 UTC
cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/platforms PlatformPostgreSQLImpl.java
arminw 2003/01/15 03:23:01
Modified: src/java/org/apache/ojb/broker/platforms
PlatformPostgreSQLImpl.java
Log:
add patch from Anders Hermansen
- sequence support for PostgreSQL
Revision Changes Path
1.6 +28 -13 jakarta-ojb/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java
Index: PlatformPostgreSQLImpl.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PlatformPostgreSQLImpl.java 20 Nov 2002 18:25:48 -0000 1.5
+++ PlatformPostgreSQLImpl.java 15 Jan 2003 11:23:01 -0000 1.6
@@ -55,8 +55,8 @@
*/
import java.sql.PreparedStatement;
-import java.sql.Types;
import java.sql.SQLException;
+import java.sql.Types;
/**
* This class extends <code>PlatformDefaultImpl</code> and defines specific
@@ -68,15 +68,30 @@
public class PlatformPostgreSQLImpl extends PlatformDefaultImpl
{
- public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException
- {
- if ((value instanceof byte[]) && (sqlType == Types.LONGVARBINARY))
- {
- ps.setBytes(index, (byte[]) value);
- }
- else
- {
- super.setObjectForStatement(ps, index, value, sqlType);
- }
- }
+ public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException
+ {
+ if ((value instanceof byte[]) && (sqlType == Types.LONGVARBINARY))
+ {
+ ps.setBytes(index, (byte[]) value);
+ }
+ else
+ {
+ super.setObjectForStatement(ps, index, value, sqlType);
+ }
+ }
+
+ public String createSequenceQuery(String sequenceName)
+ {
+ return "create sequence " + sequenceName;
+ }
+
+ public String nextSequenceQuery(String sequenceName)
+ {
+ return "select nextval('" + sequenceName + "')";
+ }
+
+ public String dropSequenceQuery(String sequenceName)
+ {
+ return "drop sequence " + sequenceName;
+ }
}