Skip to content

Commit a4e3943

Browse files
committed
Back out Gunnar R|nning jdbc changes.
1 parent c4ccc61 commit a4e3943

File tree

13 files changed

+84
-412
lines changed

13 files changed

+84
-412
lines changed

src/interfaces/jdbc/org/postgresql/Connection.java

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.postgresql.util.*;
1111

1212
/**
13-
* $Id: Connection.java,v 1.7 2000/10/08 19:37:54 momjian Exp $
13+
* $Id: Connection.java,v 1.8 2000/10/09 16:48:16 momjian Exp $
1414
*
1515
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
1616
* JDBC2 versions of the Connection class.
@@ -81,11 +81,6 @@ public abstract class Connection
8181
// The PID an cancellation key we get from the backend process
8282
public int pid;
8383
public int ckey;
84-
85-
// This receive_sbuf should be used by the different methods
86-
// that call pg_stream.ReceiveString() in this Connection, so
87-
// so we avoid uneccesary new allocations.
88-
byte receive_sbuf[] = new byte[8192];
8984

9085
/**
9186
* This is called by Class.forName() from within org.postgresql.Driver
@@ -169,9 +164,8 @@ protected void openConnection(String host, int port, Properties info, String dat
169164
// The most common one to be thrown here is:
170165
// "User authentication failed"
171166
//
172-
String msg = pg_stream.ReceiveString(receive_sbuf, 4096,
173-
getEncoding());
174-
throw new SQLException(msg);
167+
throw new SQLException(pg_stream.ReceiveString
168+
(4096, getEncoding()));
175169

176170
case 'R':
177171
// Get the type of request
@@ -242,7 +236,7 @@ protected void openConnection(String host, int port, Properties info, String dat
242236
case 'E':
243237
case 'N':
244238
throw new SQLException(pg_stream.ReceiveString
245-
(receive_sbuf, 4096, getEncoding()));
239+
(4096, getEncoding()));
246240
default:
247241
throw new PSQLException("postgresql.con.setup");
248242
}
@@ -254,7 +248,7 @@ protected void openConnection(String host, int port, Properties info, String dat
254248
break;
255249
case 'E':
256250
case 'N':
257-
throw new SQLException(pg_stream.ReceiveString(receive_sbuf, 4096, getEncoding()));
251+
throw new SQLException(pg_stream.ReceiveString(4096));
258252
default:
259253
throw new PSQLException("postgresql.con.setup");
260254
}
@@ -269,7 +263,7 @@ protected void openConnection(String host, int port, Properties info, String dat
269263
//
270264
firstWarning = null;
271265

272-
ExecSQL(null, "set datestyle to 'ISO'");
266+
ExecSQL("set datestyle to 'ISO'");
273267

274268
// Initialise object handling
275269
initObjectTypes();
@@ -312,27 +306,23 @@ public void addWarning(String msg)
312306
//currentDateStyle=i+1; // this is the index of the format
313307
//}
314308
}
315-
316-
309+
317310
/**
318311
* Send a query to the backend. Returns one of the ResultSet
319312
* objects.
320313
*
321314
* <B>Note:</B> there does not seem to be any method currently
322315
* in existance to return the update count.
323316
*
324-
* @param stmt The statment object.
325317
* @param sql the SQL statement to be executed
326318
* @return a ResultSet holding the results
327319
* @exception SQLException if a database error occurs
328320
*/
329-
public java.sql.ResultSet ExecSQL(PGStatement stmt,
330-
String sql) throws SQLException
321+
public java.sql.ResultSet ExecSQL(String sql) throws SQLException
331322
{
332323
// added Oct 7 1998 to give us thread safety.
333324
synchronized(pg_stream) {
334-
pg_stream.setExecutingStatement(stmt);
335-
325+
336326
Field[] fields = null;
337327
Vector tuples = new Vector();
338328
byte[] buf = null;
@@ -362,7 +352,8 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
362352
try
363353
{
364354
pg_stream.SendChar('Q');
365-
pg_stream.Send(sql.getBytes());
355+
buf = sql.getBytes();
356+
pg_stream.Send(buf);
366357
pg_stream.SendChar(0);
367358
pg_stream.flush();
368359
} catch (IOException e) {
@@ -379,8 +370,7 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
379370
{
380371
case 'A': // Asynchronous Notify
381372
pid = pg_stream.ReceiveInteger(4);
382-
msg = pg_stream.ReceiveString(receive_sbuf, 8192,
383-
getEncoding());
373+
msg = pg_stream.ReceiveString(8192);
384374
break;
385375
case 'B': // Binary Data Transfer
386376
if (fields == null)
@@ -391,9 +381,7 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
391381
tuples.addElement(tup);
392382
break;
393383
case 'C': // Command Status
394-
recv_status =
395-
pg_stream.ReceiveString(receive_sbuf, 8192,
396-
getEncoding());
384+
recv_status = pg_stream.ReceiveString(8192);
397385

398386
// Now handle the update count correctly.
399387
if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")) {
@@ -435,8 +423,7 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
435423
tuples.addElement(tup);
436424
break;
437425
case 'E': // Error Message
438-
msg = pg_stream.ReceiveString(receive_sbuf, 4096,
439-
getEncoding());
426+
msg = pg_stream.ReceiveString(4096);
440427
final_error = new SQLException(msg);
441428
hfr = true;
442429
break;
@@ -451,14 +438,10 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
451438
hfr = true;
452439
break;
453440
case 'N': // Error Notification
454-
addWarning(pg_stream.ReceiveString(receive_sbuf,
455-
4096,
456-
getEncoding()));
441+
addWarning(pg_stream.ReceiveString(4096));
457442
break;
458443
case 'P': // Portal Name
459-
String pname =
460-
pg_stream.ReceiveString(receive_sbuf, 8192,
461-
getEncoding());
444+
String pname = pg_stream.ReceiveString(8192);
462445
break;
463446
case 'T': // MetaData Field Description
464447
if (fields != null)
@@ -478,8 +461,6 @@ public java.sql.ResultSet ExecSQL(PGStatement stmt,
478461
}
479462
}
480463

481-
482-
483464
/**
484465
* Receive the field descriptions from the back end
485466
*
@@ -493,8 +474,7 @@ private Field[] ReceiveFields() throws SQLException
493474

494475
for (i = 0 ; i < nf ; ++i)
495476
{
496-
String typname = pg_stream.ReceiveString(receive_sbuf, 8192,
497-
getEncoding());
477+
String typname = pg_stream.ReceiveString(8192);
498478
int typid = pg_stream.ReceiveIntegerR(4);
499479
int typlen = pg_stream.ReceiveIntegerR(2);
500480
int typmod = pg_stream.ReceiveIntegerR(4);

src/interfaces/jdbc/org/postgresql/Field.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ public int getSQLType() throws SQLException
7676
// it's not in the cache, so perform a query, and add the result to
7777
// the cache
7878
if(type_name==null) {
79-
ResultSet result = (org.postgresql.ResultSet)
80-
conn.ExecSQL(null, "select typname from pg_type where oid = "
81-
+ oid);
79+
ResultSet result = (org.postgresql.ResultSet)conn.ExecSQL("select typname from pg_type where oid = " + oid);
8280
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
8381
throw new PSQLException("postgresql.unexpected");
8482
result.next();

src/interfaces/jdbc/org/postgresql/ObjectPool.java

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/interfaces/jdbc/org/postgresql/PGStatement.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy