// Added by Stefan Andreasen <stefan@linux.kapow.dk>
// If the pattern are null then set them to %
if(tableNamePattern==null)tableNamePattern="%";
if(columnNamePattern==null)columnNamePattern="%";
// Now form the query
// Modified by Stefan Andreasen <stefan@linux.kapow.dk>
r=connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod from pg_class c, pg_attribute a where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 order by c.relname,a.attnum");
byteremarks[];
while(r.next()){
byte[][]tuple=newbyte[18][0];
// Fetch the description for the table (if any)
ResultSetdr=connection.ExecSQL("select description from pg_description where objoid="+r.getInt(1));
if(dr.getTupleCount()==1){
dr.next();
tuple[11]=dr.getBytes(1);
}else
tuple[11]=defaultRemarks;
dr.close();
tuple[0]="".getBytes();// Catalog name
tuple[1]="".getBytes();// Schema name
tuple[2]=r.getBytes(2);// Table name
tuple[3]=r.getBytes(3);// Column name
dr=connection.ExecSQL("select typname from pg_type where oid = "+r.getString(4));
dr.next();
Stringtypname=dr.getString(1);
dr.close();
tuple[4]=Integer.toString(Field.getSQLType(typname)).getBytes();// Data type
tuple[5]=typname.getBytes();// Type name
// Column size
// Looking at the psql source,
// I think the length of a varchar as specified when the table was created
// should be extracted from atttypmod which contains this length + sizeof(int32)
ResultSetr=connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '"+table.toLowerCase()+"' ORDER BY relname");
//throw new PSQLException("postgresql.jvm.version",ex);
thrownewSQLException("The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding.\nException thrown was "+ex.toString());
}catch(Exceptionex2){
//throw new PSQLException("postgresql.unusual",ex2);
thrownewSQLException("Something unusual has occured to cause the driver to fail. Please report this exception: "+ex2.toString());
}
// The old call - remove before posting
...
...
@@ -346,6 +355,7 @@ public class Driver implements java.sql.Driver
*/
publicstaticSQLExceptionnotImplemented()
{
//return new PSQLException("postgresql.unimplemented");
returnnewSQLException("This method is not yet implemented.");
postgresql.jvm.version:Le fichier de postgresql.jar ne contient pas les classes correctes de JDBC pour ce JVM. Try que rebuilding.\nException jetées était {1}
postgresql.unusual:Quelque chose de peu commun s'est produit pour faire échouer le gestionnaire. Veuillez enregistrer cette exception: {1}
postgresql.unimplemented:Cette méthode n'est pas encore appliquée.