|
2 | 2 |
|
3 | 3 | import java.sql.*;
|
4 | 4 |
|
5 |
| -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.2 2002/09/06 21:23:06 momjian Exp $ |
| 5 | +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.3 2003/05/07 03:03:30 barry Exp $ |
6 | 6 | * This class defines methods of the jdbc3 specification. This class extends
|
7 | 7 | * org.postgresql.jdbc2.AbstractJdbc2Connection which provides the jdbc2
|
8 | 8 | * methods. The real Connection class (for jdbc3) is org.postgresql.jdbc3.Jdbc3Connection
|
@@ -375,6 +375,82 @@ public PreparedStatement prepareStatement(String sql, String columnNames[])
|
375 | 375 | throw org.postgresql.Driver.notImplemented();
|
376 | 376 | }
|
377 | 377 |
|
| 378 | + /* |
| 379 | + * This implemetation uses the jdbc3Types array to support the jdbc3 |
| 380 | + * datatypes. Basically jdbc2 and jdbc3 are the same, except that |
| 381 | + * jdbc3 adds some |
| 382 | + */ |
| 383 | + public int getSQLType(String pgTypeName) |
| 384 | + { |
| 385 | + int sqlType = Types.OTHER; // default value |
| 386 | + for (int i = 0;i < jdbc3Types.length;i++) |
| 387 | + { |
| 388 | + if (pgTypeName.equals(jdbc3Types[i])) |
| 389 | + { |
| 390 | + sqlType = jdbc3Typei[i]; |
| 391 | + break; |
| 392 | + } |
| 393 | + } |
| 394 | + return sqlType; |
| 395 | + } |
| 396 | + |
| 397 | + /* |
| 398 | + * This table holds the org.postgresql names for the types supported. |
| 399 | + * Any types that map to Types.OTHER (eg POINT) don't go into this table. |
| 400 | + * They default automatically to Types.OTHER |
| 401 | + * |
| 402 | + * Note: This must be in the same order as below. |
| 403 | + * |
| 404 | + * Tip: keep these grouped together by the Types. value |
| 405 | + */ |
| 406 | + private static final String jdbc3Types[] = { |
| 407 | + "int2", |
| 408 | + "int4", "oid", |
| 409 | + "int8", |
| 410 | + "cash", "money", |
| 411 | + "numeric", |
| 412 | + "float4", |
| 413 | + "float8", |
| 414 | + "bpchar", "char", "char2", "char4", "char8", "char16", |
| 415 | + "varchar", "text", "name", "filename", |
| 416 | + "bytea", |
| 417 | + "bool", |
| 418 | + "date", |
| 419 | + "time", |
| 420 | + "abstime", "timestamp", "timestamptz", |
| 421 | + "_bool", "_char", "_int2", "_int4", "_text", |
| 422 | + "_oid", "_varchar", "_int8", "_float4", "_float8", |
| 423 | + "_abstime", "_date", "_time", "_timestamp", "_numeric", |
| 424 | + "_bytea" |
| 425 | + }; |
| 426 | + |
| 427 | + /* |
| 428 | + * This table holds the JDBC type for each entry above. |
| 429 | + * |
| 430 | + * Note: This must be in the same order as above |
| 431 | + * |
| 432 | + * Tip: keep these grouped together by the Types. value |
| 433 | + */ |
| 434 | + private static final int jdbc3Typei[] = { |
| 435 | + Types.SMALLINT, |
| 436 | + Types.INTEGER, Types.INTEGER, |
| 437 | + Types.BIGINT, |
| 438 | + Types.DOUBLE, Types.DOUBLE, |
| 439 | + Types.NUMERIC, |
| 440 | + Types.REAL, |
| 441 | + Types.DOUBLE, |
| 442 | + Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, |
| 443 | + Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, |
| 444 | + Types.BINARY, |
| 445 | + Types.BIT, |
| 446 | + Types.DATE, |
| 447 | + Types.TIME, |
| 448 | + Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP, |
| 449 | + Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, |
| 450 | + Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, |
| 451 | + Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, |
| 452 | + Types.ARRAY |
| 453 | + }; |
378 | 454 |
|
379 | 455 | }
|
380 | 456 |
|
|
0 commit comments