import org.postgresql.core.*;
/**
- * $Id: Connection.java,v 1.27 2001/09/06 03:13:34 momjian Exp $
+ * $Id: Connection.java,v 1.28 2001/09/07 22:17:02 momjian Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
if (autoCommit)
ExecSQL("end");
else {
- ExecSQL("begin; " + getIsolationLevelSQL());
+ if (haveMinimumServerVersion("7.1")){
+ ExecSQL("begin;"+getIsolationLevelSQL());
+ }else{
+ ExecSQL("begin");
+ ExecSQL(getIsolationLevelSQL());
+ }
}
this.autoCommit = autoCommit;
}
public void commit() throws SQLException {
if (autoCommit)
return;
- ExecSQL("commit; begin; " + getIsolationLevelSQL());
+ if (haveMinimumServerVersion("7.1")){
+ ExecSQL("commit;begin;"+getIsolationLevelSQL());
+ }else{
+ ExecSQL("commit");
+ ExecSQL("begin");
+ ExecSQL(getIsolationLevelSQL());
+ }
}
/**
public void rollback() throws SQLException {
if (autoCommit)
return;
- ExecSQL("rollback; begin; " + getIsolationLevelSQL());
+ if (haveMinimumServerVersion("7.1")){
+ ExecSQL("rollback; begin;"+getIsolationLevelSQL());
+ }else{
+ ExecSQL("rollback");
+ ExecSQL("begin");
+ ExecSQL(getIsolationLevelSQL());
+ }
}
/**
if (haveMinimumServerVersion("7.1")) {
return "";
}
- String q = "SET TRANSACTION ISOLATION LEVEL";
+ StringBuffer sb = new StringBuffer("SET TRANSACTION ISOLATION LEVEL");
switch(isolationLevel) {
case java.sql.Connection.TRANSACTION_READ_COMMITTED:
- q = q + " READ COMMITTED";
+ sb.append(" READ COMMITTED");
break;
case java.sql.Connection.TRANSACTION_SERIALIZABLE:
- q = q + " SERIALIZABLE";
+ sb.append(" SERIALIZABLE");
break;
default:
throw new PSQLException("postgresql.con.isolevel",new Integer(isolationLevel));
}
- return q;
+ return sb.toString();
}
/**