KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > controller > virtualdatabase > VirtualDatabaseDynamicMetaData


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Julie Marguerite.
22  * Contributor(s): Emmanuel Cecchet, Nicolas Modrzyk.
23  */

24
25 package org.objectweb.cjdbc.controller.virtualdatabase;
26
27 import java.sql.Connection JavaDoc;
28 import java.sql.DatabaseMetaData JavaDoc;
29 import java.sql.ResultSet JavaDoc;
30 import java.sql.SQLException JavaDoc;
31 import java.sql.Types JavaDoc;
32 import java.util.ArrayList JavaDoc;
33 import java.util.ConcurrentModificationException JavaDoc;
34 import java.util.Iterator JavaDoc;
35
36 import org.objectweb.cjdbc.common.exceptions.NoMoreBackendException;
37 import org.objectweb.cjdbc.common.exceptions.UnreachableBackendException;
38 import org.objectweb.cjdbc.common.log.Trace;
39 import org.objectweb.cjdbc.common.sql.schema.DatabaseColumn;
40 import org.objectweb.cjdbc.common.sql.schema.DatabaseProcedure;
41 import org.objectweb.cjdbc.common.sql.schema.DatabaseProcedureParameter;
42 import org.objectweb.cjdbc.common.sql.schema.DatabaseSchema;
43 import org.objectweb.cjdbc.common.sql.schema.DatabaseTable;
44 import org.objectweb.cjdbc.common.users.VirtualDatabaseUser;
45 import org.objectweb.cjdbc.controller.authentication.AuthenticationManager;
46 import org.objectweb.cjdbc.controller.backend.DatabaseBackend;
47 import org.objectweb.cjdbc.controller.connection.AbstractConnectionManager;
48 import org.objectweb.cjdbc.controller.requestmanager.RAIDbLevels;
49 import org.objectweb.cjdbc.controller.requestmanager.RequestManager;
50 import org.objectweb.cjdbc.driver.DriverResultSet;
51 import org.objectweb.cjdbc.driver.Field;
52
53 /**
54  * Class that gathers the dynamic metadata for a virtual database, that means
55  * all the metadata subject to changes during the lifetime of the application.
56  *
57  * @author <a HREF="mailto:Julie.Marguerite@inria.fr">Julie.Marguerite </a>
58  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
59  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
60  */

61 public class VirtualDatabaseDynamicMetaData
62 {
63
64   /** Detect a null valu for int */
65   public static final int NULL_VALUE = -999;
66
67   private String JavaDoc vdbName;
68   private RequestManager requestManager;
69
70   /** Logger instance. */
71   private Trace logger = null;
72
73   /**
74    * Reference the database for this metadata. Do not fetch any data at this
75    * time
76    *
77    * @param database to link this metadata to
78    */

79   public VirtualDatabaseDynamicMetaData(VirtualDatabase database)
80   {
81     this.vdbName = database.getVirtualDatabaseName();
82     requestManager = database.getRequestManager();
83     if (requestManager == null)
84       throw new RuntimeException JavaDoc(
85           "Null request manager in VirtualDatabaseMetaData");
86
87     this.logger = Trace
88         .getLogger("org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread."
89             + vdbName + ".metadata");
90   }
91
92   /**
93    * @see java.sql.DatabaseMetaData#getAttributes(java.lang.String,
94    * java.lang.String, java.lang.String, java.lang.String)
95    */

96   public DriverResultSet getAttributes(String JavaDoc login, String JavaDoc catalog,
97       String JavaDoc schemaPattern, String JavaDoc typeNamePattern, String JavaDoc attributeNamePattern)
98       throws SQLException JavaDoc
99   {
100     // This is a JDBC 3.0 feature
101
try
102     {
103       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
104       if ((raidbLevel == RAIDbLevels.RAIDb1)
105           || (raidbLevel == RAIDbLevels.SingleDB))
106       { // Forward directly to the underlying backend
107
ConnectionAndDatabaseMetaData info = null;
108         try
109         {
110           info = getMetaDataFromFirstAvailableBackend(login);
111           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
112           ResultSet JavaDoc cols = m.getAttributes(catalog, schemaPattern,
113               typeNamePattern, attributeNamePattern);
114           ArrayList JavaDoc data = new ArrayList JavaDoc();
115           while (cols.next())
116           { // Unroll the loop for comments (and speed?)
117
Object JavaDoc[] row = new Object JavaDoc[21];
118             row[0] = cols.getObject(1); // TYPE_CAT
119
row[1] = cols.getObject(2); // TYPE_SCHEM
120
row[2] = cols.getObject(3); // TYPE_NAME
121
row[3] = cols.getObject(4); // DATA_TYPE
122
row[4] = cols.getObject(5); // ATTR_NAME
123
row[5] = cols.getObject(6); // ATTR_TYPE_NAME
124
row[6] = cols.getObject(7); // ATTR_SIZE
125
row[7] = cols.getObject(8); // DECIMAL_DIGITS
126
row[8] = cols.getObject(9); // NUM_PREC_RADIX
127
row[9] = cols.getObject(10); // NULLABLE
128
row[10] = cols.getObject(11); // REMARKS
129
row[11] = cols.getObject(12); // ATTR_DEF
130
row[12] = cols.getObject(13); // SQL_DATA_TYPE
131
row[13] = cols.getObject(14); // SQL_DATETIME_SUB
132
row[14] = cols.getObject(15); // CHAR_OCTET_LENGTH
133
row[15] = cols.getObject(16); // ORDINAL_POSITION
134
row[16] = cols.getObject(17); // IS_NULLABLE
135
row[17] = cols.getObject(18); // SCOPE_CATALOG
136
row[18] = cols.getObject(19); // SCOPE_SCHEMA
137
row[19] = cols.getObject(20); // SCOPE_TABLE
138
row[20] = cols.getObject(21); // SOURCE_DATA_TYPE
139
data.add(row);
140           }
141           return new DriverResultSet(getAttributesFields, data);
142         }
143         catch (SQLException JavaDoc e)
144         {
145           throw e;
146         }
147         finally
148         {
149           releaseConnection(info);
150         }
151       }
152     }
153     catch (NoMoreBackendException ignore)
154     {
155       // No backend is available, try with the default method
156
}
157
158     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
159

160     ArrayList JavaDoc data = new ArrayList JavaDoc();
161     DriverResultSet rs = new DriverResultSet(getAttributesFields, data);
162     return rs;
163   }
164
165   /**
166    * @see java.sql.DatabaseMetaData#getBestRowIdentifier(java.lang.String,
167    * java.lang.String, java.lang.String, int, boolean)
168    */

169   public DriverResultSet getBestRowIdentifier(String JavaDoc login, String JavaDoc catalog,
170       String JavaDoc schema, String JavaDoc table, int scope, boolean nullable)
171       throws SQLException JavaDoc
172   {
173     try
174     {
175       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
176       if ((raidbLevel == RAIDbLevels.RAIDb1)
177           || (raidbLevel == RAIDbLevels.SingleDB))
178       { // Forward directly to the underlying backend
179
ConnectionAndDatabaseMetaData info = null;
180         try
181         {
182           info = getMetaDataFromFirstAvailableBackend(login);
183           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
184           ResultSet JavaDoc cols = m.getBestRowIdentifier(catalog, schema, table,
185               scope, nullable);
186           ArrayList JavaDoc data = new ArrayList JavaDoc();
187           while (cols.next())
188           { // Unroll the loop for comments (and speed?)
189
Object JavaDoc[] row = new Object JavaDoc[8];
190             row[0] = cols.getObject(1); // SCOPE
191
row[1] = cols.getObject(2); // COLUMN_NAME
192
row[2] = cols.getObject(3); // DATA_TYPE
193
row[3] = cols.getObject(4); // TYPE_NAME
194
row[4] = cols.getObject(5); // COLUMN_SIZE
195
row[5] = cols.getObject(6); // BUFFER_LENGTH
196
row[6] = cols.getObject(7); // DECIMAL_DIGITS
197
row[7] = cols.getObject(8); // PSEUDO_COLUMN
198
data.add(row);
199           }
200           return new DriverResultSet(
201               getBestRowIdentifierAndVersionColumnsFields, data);
202         }
203         catch (SQLException JavaDoc e)
204         {
205           throw e;
206         }
207         finally
208         {
209           releaseConnection(info);
210         }
211       }
212     }
213     catch (NoMoreBackendException ignore)
214     {
215       // No backend is available, try with the default method
216
}
217
218     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
219

220     ArrayList JavaDoc data = new ArrayList JavaDoc();
221     DriverResultSet rs = new DriverResultSet(
222         getBestRowIdentifierAndVersionColumnsFields, data);
223     return rs;
224   }
225
226   /**
227    * Build a list of Catalogs from a givem list of virtual database names
228    *
229    * @param list of virtual database from the controller
230    * @return <code>ResultSet</code> with list of catalogs
231    */

232   public DriverResultSet getCatalogs(ArrayList JavaDoc list)
233   {
234     int size = list.size();
235     ArrayList JavaDoc data = new ArrayList JavaDoc(size);
236     for (int i = 0; i < size; i++)
237     {
238       Object JavaDoc[] row = new Object JavaDoc[1];
239       row[0] = (String JavaDoc) list.get(i);
240       data.add(row);
241     }
242     DriverResultSet rs = new DriverResultSet(getCatalogsFields, data);
243     return rs;
244   }
245
246   /**
247    * @see java.sql.DatabaseMetaData#getColumnPrivileges(java.lang.String,
248    * java.lang.String, java.lang.String, java.lang.String)
249    */

250   public DriverResultSet getColumnPrivileges(String JavaDoc login, String JavaDoc catalog,
251       String JavaDoc schema, String JavaDoc table, String JavaDoc columnNamePattern)
252       throws SQLException JavaDoc
253   {
254     try
255     {
256       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
257       if ((raidbLevel == RAIDbLevels.RAIDb1)
258           || (raidbLevel == RAIDbLevels.SingleDB))
259       { // Forward directly to the underlying backend
260
ConnectionAndDatabaseMetaData info = null;
261         try
262         {
263           info = getMetaDataFromFirstAvailableBackend(login);
264           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
265           ResultSet JavaDoc cols = m.getColumnPrivileges(catalog, schema, table,
266               columnNamePattern);
267           ArrayList JavaDoc data = new ArrayList JavaDoc();
268           while (cols.next())
269           { // Unroll the loop for comments (and speed?)
270
Object JavaDoc[] row = new Object JavaDoc[8];
271             row[0] = cols.getObject(1); // TABLE_CAT
272
row[1] = cols.getObject(2); // TABLE_SCHEM
273
row[2] = cols.getObject(3); // TABLE_NAME
274
row[3] = cols.getObject(4); // COLUMN_NAME
275
row[4] = cols.getObject(5); // GRANTOR
276
row[5] = cols.getObject(6); // GRANTEE
277
row[6] = cols.getObject(7); // PRIVILEGE
278
row[7] = cols.getObject(8); // IS_GRANTABLE
279
data.add(row);
280           }
281           return new DriverResultSet(getColumnPrivilegesFields, data);
282         }
283         catch (SQLException JavaDoc e)
284         {
285           throw e;
286         }
287         finally
288         {
289           releaseConnection(info);
290         }
291       }
292     }
293     catch (NoMoreBackendException ignore)
294     {
295       // No backend is available, try with the default method
296
}
297
298     AuthenticationManager manager = requestManager.getVirtualDatabase()
299         .getAuthenticationManager();
300
301     DatabaseSchema dbs = requestManager.getDatabaseSchema();
302     if (dbs == null)
303       throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
304
305     if (columnNamePattern == null)
306       // if null is passed then select all tables
307
columnNamePattern = "%";
308
309     DatabaseTable dbTable = dbs.getTable(table);
310     if (dbTable == null)
311       throw new SQLException JavaDoc("Unable to find table " + table);
312
313     ArrayList JavaDoc columns = dbTable.getColumns();
314     int size = columns.size();
315     ArrayList JavaDoc data = new ArrayList JavaDoc();
316
317     ArrayList JavaDoc virtualLogins = manager.getVirtualLogins();
318     int vsize = virtualLogins.size();
319     VirtualDatabaseUser vu;
320
321     for (int i = 0; i < size; i++)
322     {
323       DatabaseColumn c = (DatabaseColumn) columns.get(i);
324       if (columnNamePattern.equals("%")
325           || columnNamePattern.equals(c.getName()))
326       {
327         for (int j = 0; j < vsize; j++)
328         {
329           vu = (VirtualDatabaseUser) virtualLogins.get(0);
330
331           if (logger.isDebugEnabled())
332             logger.debug("Found privilege for user:" + vu.getLogin()
333                 + " on column:" + c.getName());
334           Object JavaDoc[] row = new Object JavaDoc[8];
335           row[0] = vdbName; // table cat
336
row[1] = null; // table schema
337
row[2] = table; // table name
338
row[3] = c.getName(); // column name
339
row[4] = null; // grantor
340
row[5] = vu.getLogin(); // grantee
341
row[6] = "UPDATE"; // privilege
342
row[7] = "NO"; // IS_GRANTABLE
343
data.add(row);
344         }
345       }
346     }
347
348     DriverResultSet rs = new DriverResultSet(getColumnPrivilegesFields, data);
349     return rs;
350   }
351
352   /**
353    * @see java.sql.DatabaseMetaData#getColumns(java.lang.String,
354    * java.lang.String, java.lang.String, java.lang.String)
355    */

356   public DriverResultSet getColumns(String JavaDoc login, String JavaDoc catalog,
357       String JavaDoc schemaPattern, String JavaDoc tableNamePattern, String JavaDoc columnNamePattern)
358       throws SQLException JavaDoc
359   {
360     if (logger.isDebugEnabled())
361       logger.debug("Getting columns for " + vdbName);
362
363     try
364     {
365       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
366       if ((raidbLevel == RAIDbLevels.RAIDb1)
367           || (raidbLevel == RAIDbLevels.SingleDB))
368       { // Forward directly to the underlying backend
369
ConnectionAndDatabaseMetaData info = null;
370         try
371         {
372           info = getMetaDataFromFirstAvailableBackend(login);
373           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
374           ResultSet JavaDoc cols = m.getColumns(catalog, schemaPattern,
375               tableNamePattern, columnNamePattern);
376           ArrayList JavaDoc data = new ArrayList JavaDoc();
377           while (cols.next())
378           { // Unroll the loop for comments (and speed?)
379
Object JavaDoc[] row = new Object JavaDoc[22];
380             row[0] = cols.getObject(1); // TABLE_CAT
381
row[1] = cols.getObject(2); // TABLE_SCHEM
382
row[2] = cols.getObject(3); // TABLE_NAME
383
row[3] = cols.getObject(4); // COLUMN_NAME
384
row[4] = cols.getObject(5); // DATA_TYPE
385
row[5] = cols.getObject(6); // TYPE_NAME
386
row[6] = cols.getObject(7); // COLUMN_SIZE
387
row[7] = cols.getObject(8); // BUFFER_LENGTH
388
row[8] = cols.getObject(9); // DECIMAL_DIGITS
389
row[9] = cols.getObject(10); // NUM_PREC_RADIX
390
row[10] = cols.getObject(11); // NULLABLE
391
row[11] = cols.getObject(12); // REMARKS
392
row[12] = cols.getObject(13); // COLUMN_DEF
393
row[13] = cols.getObject(14); // SQL_DATA_TYPE
394
row[14] = cols.getObject(15); // SQL_DATETIME_SUB
395
row[15] = cols.getObject(16); // CHAR_OCTET_LENGTH
396
row[16] = cols.getObject(17); // ORDINAL_POSITION
397
row[17] = cols.getObject(18); // IS_NULLABLE
398
// JDBC 3.0 starts here
399
try
400             {
401               row[18] = cols.getObject(19); // SCOPE_CATALOG
402
row[19] = cols.getObject(20); // SCOPE_SCHEMA
403
row[20] = cols.getObject(21); // SCOPE_TABLE
404
row[21] = cols.getObject(22); // SOURCE_DATA_TYPE
405
}
406             catch (Exception JavaDoc e)
407             { // Driver does not support JDBC 3.0 cut here
408
row[18] = null; // SCOPE_CATALOG
409
row[19] = null;// SCOPE_SCHEMA
410
row[20] = null;// SCOPE_TABLE
411
row[21] = null; // SOURCE_DATA_TYPE
412
}
413             data.add(row);
414           }
415           return new DriverResultSet(getColumnsFields, data);
416         }
417         catch (SQLException JavaDoc e)
418         {
419           throw e;
420         }
421         finally
422         {
423           releaseConnection(info);
424         }
425       }
426     }
427     catch (NoMoreBackendException ignore)
428     {
429       // No backend is available, try with the default method
430
}
431
432     // Ok from this point on, this is RAIDb-0 or RAIDb-2 and we have to build
433
// the results ourselves.
434
DatabaseSchema dbs = requestManager.getDatabaseSchema();
435     if (dbs == null)
436       throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
437
438     if (tableNamePattern == null)
439       tableNamePattern = "%"; // if null is passed then select
440
// all tables
441

442     if (columnNamePattern == null)
443       columnNamePattern = "%"; // if null is passed then
444

445     // Build the ResultSet
446
ArrayList JavaDoc tables = dbs.getTables();
447     int size = tables.size();
448     ArrayList JavaDoc data = new ArrayList JavaDoc();
449
450     for (int i = 0; i < size; i++)
451     {
452       DatabaseTable t = (DatabaseTable) tables.get(i);
453
454       if (tableNamePattern.equals("%") || tableNamePattern.equals(t.getName()))
455       {
456         if (logger.isDebugEnabled())
457           logger.debug("Found table " + t.getName());
458         ArrayList JavaDoc columns = t.getColumns();
459         for (int j = 0; j < columns.size(); j++)
460         {
461           DatabaseColumn c = (DatabaseColumn) columns.get(j);
462           if (columnNamePattern.equals("%")
463               || columnNamePattern.equals(c.getName()))
464           {
465             if (logger.isDebugEnabled())
466               logger.debug("Found column " + c.getName());
467             Object JavaDoc[] row = new Object JavaDoc[22];
468             row[0] = vdbName; // TABLE_CAT
469
row[1] = null; // TABLE_SCHEM
470
row[2] = t.getName(); // TABLE_NAME
471
row[3] = c.getName(); // COLUMN_NAME
472
row[4] = new Integer JavaDoc(c.getType()); // DATA_TYPE
473
row[5] = null; // TYPE_NAME
474
row[6] = null; // COLUMN_SIZE
475
row[7] = null; // BUFFER_LENGTH
476
row[8] = null; // DECIMAL_DIGITS
477
row[9] = null; // NUM_PREC_RADIX
478
row[10] = null; // NULLABLE
479
row[11] = null; // REMARKS
480
row[12] = null; // COLUMN_DEF
481
row[13] = null; // SQL_DATA_TYPE
482
row[14] = null; // SQL_DATETIME_SUB
483
row[15] = null; // CHAR_OCTET_LENGTH
484
row[16] = null; // ORDINAL_POSITION
485
row[17] = ""; // IS_NULLABLE
486
row[18] = null; // SCOPE_CATALOG
487
row[19] = null;// SCOPE_SCHEMA
488
row[20] = null;// SCOPE_TABLE
489
row[21] = null; // SOURCE_DATA_TYPE
490
data.add(row);
491           }
492         }
493       }
494     }
495     DriverResultSet rs = new DriverResultSet(getColumnsFields, data);
496     return rs;
497   }
498
499   /**
500    * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String,
501    * java.lang.String, java.lang.String, java.lang.String,
502    * java.lang.String, java.lang.String)
503    */

504   public DriverResultSet getCrossReference(String JavaDoc login, String JavaDoc primaryCatalog,
505       String JavaDoc primarySchema, String JavaDoc primaryTable, String JavaDoc foreignCatalog,
506       String JavaDoc foreignSchema, String JavaDoc foreignTable) throws SQLException JavaDoc
507   {
508     try
509     {
510       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
511       if ((raidbLevel == RAIDbLevels.RAIDb1)
512           || (raidbLevel == RAIDbLevels.SingleDB))
513       { // Forward directly to the underlying backend
514
ConnectionAndDatabaseMetaData info = null;
515         try
516         {
517           info = getMetaDataFromFirstAvailableBackend(login);
518           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
519           ResultSet JavaDoc cols = m.getCrossReference(primaryCatalog, primarySchema,
520               primaryTable, foreignCatalog, foreignSchema, foreignTable);
521           ArrayList JavaDoc data = new ArrayList JavaDoc();
522           while (cols.next())
523           { // Unroll the loop for comments (and speed?)
524
Object JavaDoc[] row = new Object JavaDoc[14];
525             row[0] = cols.getObject(1); // PKTABLE_CAT
526
row[1] = cols.getObject(2); // PKTABLE_SCHEM
527
row[2] = cols.getObject(3); // PKTABLE_NAME
528
row[3] = cols.getObject(4); // PKCOLUMN_NAME
529
row[4] = cols.getObject(5); // FKTABLE_CAT
530
row[5] = cols.getObject(6); // FKTABLE_SCHEM
531
row[6] = cols.getObject(7); // FKTABLE_NAME
532
row[7] = cols.getObject(8); // FKCOLUMN_NAME
533
row[8] = cols.getObject(9); // KEY_SEQ
534
row[9] = cols.getObject(10); // UPDATE_RULE
535
row[10] = cols.getObject(11); // DELETE_RULE
536
row[11] = cols.getObject(12); // FK_NAME
537
row[12] = cols.getObject(13); // PK_NAME
538
row[13] = cols.getObject(14); // DEFERRABILITY
539
data.add(row);
540           }
541           return new DriverResultSet(
542               getCrossReferenceOrImportExportedKeysFields, data);
543         }
544         catch (SQLException JavaDoc e)
545         {
546           throw e;
547         }
548         finally
549         {
550           releaseConnection(info);
551         }
552       }
553     }
554     catch (NoMoreBackendException ignore)
555     {
556       // No backend is available, try with the default method
557
}
558
559     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
560

561     ArrayList JavaDoc data = new ArrayList JavaDoc();
562     DriverResultSet rs = new DriverResultSet(
563         getCrossReferenceOrImportExportedKeysFields, data);
564     return rs;
565   }
566
567   /**
568    * @see java.sql.DatabaseMetaData#getExportedKeys(java.lang.String,
569    * java.lang.String, java.lang.String)
570    */

571   public DriverResultSet getExportedKeys(String JavaDoc login, String JavaDoc catalog,
572       String JavaDoc schema, String JavaDoc table) throws SQLException JavaDoc
573   {
574     try
575     {
576       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
577       if ((raidbLevel == RAIDbLevels.RAIDb1)
578           || (raidbLevel == RAIDbLevels.SingleDB))
579       { // Forward directly to the underlying backend
580
ConnectionAndDatabaseMetaData info = null;
581         try
582         {
583           info = getMetaDataFromFirstAvailableBackend(login);
584           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
585           ResultSet JavaDoc cols = m.getExportedKeys(catalog, schema, table);
586           ArrayList JavaDoc data = new ArrayList JavaDoc();
587           while (cols.next())
588           { // Unroll the loop for comments (and speed?)
589
Object JavaDoc[] row = new Object JavaDoc[14];
590             row[0] = cols.getObject(1); // PKTABLE_CAT
591
row[1] = cols.getObject(2); // PKTABLE_SCHEM
592
row[2] = cols.getObject(3); // PKTABLE_NAME
593
row[3] = cols.getObject(4); // PKCOLUMN_NAME
594
row[4] = cols.getObject(5); // FKTABLE_CAT
595
row[5] = cols.getObject(6); // FKTABLE_SCHEM
596
row[6] = cols.getObject(7); // FKTABLE_NAME
597
row[7] = cols.getObject(8); // FKCOLUMN_NAME
598
row[8] = cols.getObject(9); // KEY_SEQ
599
row[9] = cols.getObject(10); // UPDATE_RULE
600
row[10] = cols.getObject(11); // DELETE_RULE
601
row[11] = cols.getObject(12); // FK_NAME
602
row[12] = cols.getObject(13); // PK_NAME
603
row[13] = cols.getObject(14); // DEFERRABILITY
604
data.add(row);
605           }
606           return new DriverResultSet(
607               getCrossReferenceOrImportExportedKeysFields, data);
608         }
609         catch (SQLException JavaDoc e)
610         {
611           throw e;
612         }
613         finally
614         {
615           releaseConnection(info);
616         }
617       }
618     }
619     catch (NoMoreBackendException ignore)
620     {
621       // No backend is available, try with the default method
622
}
623
624     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
625

626     ArrayList JavaDoc data = new ArrayList JavaDoc();
627     DriverResultSet rs = new DriverResultSet(
628         getCrossReferenceOrImportExportedKeysFields, data);
629     return rs;
630   }
631
632   /**
633    * @see java.sql.DatabaseMetaData#getImportedKeys(java.lang.String,
634    * java.lang.String, java.lang.String)
635    */

636   public DriverResultSet getImportedKeys(String JavaDoc login, String JavaDoc catalog,
637       String JavaDoc schema, String JavaDoc table) throws SQLException JavaDoc
638   {
639     try
640     {
641       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
642       if ((raidbLevel == RAIDbLevels.RAIDb1)
643           || (raidbLevel == RAIDbLevels.SingleDB))
644       { // Forward directly to the underlying backend
645
ConnectionAndDatabaseMetaData info = null;
646         try
647         {
648           info = getMetaDataFromFirstAvailableBackend(login);
649           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
650           ResultSet JavaDoc cols = m.getImportedKeys(catalog, schema, table);
651           ArrayList JavaDoc data = new ArrayList JavaDoc();
652           while (cols.next())
653           { // Unroll the loop for comments (and speed?)
654
Object JavaDoc[] row = new Object JavaDoc[14];
655             row[0] = cols.getObject(1); // PKTABLE_CAT
656
row[1] = cols.getObject(2); // PKTABLE_SCHEM
657
row[2] = cols.getObject(3); // PKTABLE_NAME
658
row[3] = cols.getObject(4); // PKCOLUMN_NAME
659
row[4] = cols.getObject(5); // FKTABLE_CAT
660
row[5] = cols.getObject(6); // FKTABLE_SCHEM
661
row[6] = cols.getObject(7); // FKTABLE_NAME
662
row[7] = cols.getObject(8); // FKCOLUMN_NAME
663
row[8] = cols.getObject(9); // KEY_SEQ
664
row[9] = cols.getObject(10); // UPDATE_RULE
665
row[10] = cols.getObject(11); // DELETE_RULE
666
row[11] = cols.getObject(12); // FK_NAME
667
row[12] = cols.getObject(13); // PK_NAME
668
row[13] = cols.getObject(14); // DEFERRABILITY
669
data.add(row);
670           }
671           return new DriverResultSet(
672               getCrossReferenceOrImportExportedKeysFields, data);
673         }
674         catch (SQLException JavaDoc e)
675         {
676           throw e;
677         }
678         finally
679         {
680           releaseConnection(info);
681         }
682       }
683     }
684     catch (NoMoreBackendException ignore)
685     {
686       // No backend is available, try with the default method
687
}
688
689     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
690

691     ArrayList JavaDoc data = new ArrayList JavaDoc();
692     DriverResultSet rs = new DriverResultSet(
693         getCrossReferenceOrImportExportedKeysFields, data);
694     return rs;
695   }
696
697   /**
698    * @see java.sql.DatabaseMetaData#getIndexInfo(java.lang.String,
699    * java.lang.String, java.lang.String, boolean, boolean)
700    */

701   public DriverResultSet getIndexInfo(String JavaDoc login, String JavaDoc catalog,
702       String JavaDoc schema, String JavaDoc table, boolean unique, boolean approximate)
703       throws SQLException JavaDoc
704   {
705     try
706     {
707       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
708       if ((raidbLevel == RAIDbLevels.RAIDb1)
709           || (raidbLevel == RAIDbLevels.SingleDB))
710       { // Forward directly to the underlying backend
711
ConnectionAndDatabaseMetaData info = null;
712         try
713         {
714           info = getMetaDataFromFirstAvailableBackend(login);
715           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
716           ResultSet JavaDoc cols = m.getIndexInfo(catalog, schema, table, unique,
717               approximate);
718           ArrayList JavaDoc data = new ArrayList JavaDoc();
719           while (cols.next())
720           { // Unroll the loop for comments (and speed?)
721
Object JavaDoc[] row = new Object JavaDoc[13];
722             row[0] = cols.getObject(1); // TABLE_CAT
723
row[1] = cols.getObject(2); // TABLE_SCHEM
724
row[2] = cols.getObject(3); // TABLE_NAME
725
row[3] = cols.getObject(4); // NON_UNIQUE
726
row[4] = cols.getObject(5); // INDEX_QUALIFIER
727
row[5] = cols.getObject(6); // INDEX_NAME
728
row[6] = cols.getObject(7); // TYPE
729
row[7] = cols.getObject(8); // ORDINAL_POSITION
730
row[8] = cols.getObject(9); // COLUMN_NAME
731
row[9] = cols.getObject(10); // ASC_OR_DESC
732
row[10] = cols.getObject(11); // CARDINALITY
733
row[11] = cols.getObject(12); // PAGES
734
row[12] = cols.getObject(13); // FILTER_CONDITION
735
data.add(row);
736           }
737           return new DriverResultSet(getIndexInfoFields, data);
738         }
739         catch (SQLException JavaDoc e)
740         {
741           throw e;
742         }
743         finally
744         {
745           releaseConnection(info);
746         }
747       }
748     }
749     catch (NoMoreBackendException ignore)
750     {
751       // No backend is available, try with the default method
752
}
753
754     // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
755
ArrayList JavaDoc data = new ArrayList JavaDoc();
756     DriverResultSet rs = new DriverResultSet(getIndexInfoFields, data);
757     return rs;
758   }
759
760   /**
761    * Gets a description of a table's primary key columns for the given login.
762    * Primary keys are ordered by COLUMN_NAME.
763    *
764    * @see java.sql.DatabaseMetaData#getPrimaryKeys(java.lang.String,
765    * java.lang.String, java.lang.String)
766    */

767   public DriverResultSet getPrimaryKeys(String JavaDoc login, String JavaDoc catalog,
768       String JavaDoc schema, String JavaDoc table) throws SQLException JavaDoc
769   {
770     if (logger.isDebugEnabled())
771       logger.debug("Getting getPrimaryKeys for " + vdbName);
772
773     try
774     {
775       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
776       if ((raidbLevel == RAIDbLevels.RAIDb1)
777           || (raidbLevel == RAIDbLevels.SingleDB))
778       { // Forward directly to the underlying backend
779
ConnectionAndDatabaseMetaData info = null;
780         try
781         {
782           info = getMetaDataFromFirstAvailableBackend(login);
783           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
784           ResultSet JavaDoc pks = m.getPrimaryKeys(catalog, schema, table);
785           ArrayList JavaDoc data = new ArrayList JavaDoc();
786           while (pks.next())
787           { // Unroll the loop for comments (and speed?)
788
Object JavaDoc[] row = new Object JavaDoc[6];
789             row[0] = pks.getObject(1); // TABLE_CAT
790
row[1] = pks.getObject(2); // TABLE_SCHEM
791
row[2] = pks.getObject(3); // TABLE_NAME
792
row[3] = pks.getObject(4); // COLUMN_NAME
793
row[4] = pks.getObject(5); // KEY_SEQ
794
row[5] = pks.getObject(6); // PK_NAME
795
data.add(row);
796           }
797           return new DriverResultSet(getPrimaryKeysFields, data);
798         }
799         catch (SQLException JavaDoc e)
800         {
801           throw e;
802         }
803         finally
804         {
805           releaseConnection(info);
806         }
807       }
808     }
809     catch (NoMoreBackendException ignore)
810     {
811       // No backend is available, try with the default method
812
}
813
814     // Ok from this point on, this is RAIDb-0 or RAIDb-2 and we have to build
815
// the results ourselves.
816
DatabaseSchema dbs = requestManager.getDatabaseSchema();
817     if (dbs == null)
818       throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
819
820     if (table == null)
821       table = "%"; // if null is passed then
822
// select all tables
823

824     // Build the ResultSet
825
ArrayList JavaDoc tables = dbs.getTables();
826     int size = tables.size();
827     ArrayList JavaDoc data = new ArrayList JavaDoc();
828
829     for (int i = 0; i < size; i++)
830     {
831       DatabaseTable t = (DatabaseTable) tables.get(i);
832       if (table.equals("%") || table.equals(t.getName()))
833       {
834         ArrayList JavaDoc columns = t.getColumns();
835         for (int j = 0; j < columns.size(); j++)
836         {
837           DatabaseColumn c = (DatabaseColumn) columns.get(j);
838           if (c.isUnique())
839           {
840             if (logger.isDebugEnabled())
841               logger.debug("Found primary key" + c.getName());
842             Object JavaDoc[] row = new Object JavaDoc[6];
843             row[0] = vdbName; // TABLE_CAT
844
row[1] = null; // TABLE_SCHEM
845
row[2] = t.getName(); // TABLE_NAME
846
row[3] = c.getName(); // COLUMN_NAME
847
row[4] = new Integer JavaDoc(c.getType()); // KEY_SEQ
848
row[5] = c.getName(); // PK_NAME
849
data.add(row);
850           }
851           else
852           {
853             if (logger.isDebugEnabled())
854               logger.debug("Key " + c.getName() + " is not unique");
855           }
856         }
857       }
858     }
859     DriverResultSet rs = new DriverResultSet(getPrimaryKeysFields, data);
860     return rs;
861   }
862
863   /**
864    * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getProcedureColumns
865    */

866   public DriverResultSet getProcedureColumns(String JavaDoc login, String JavaDoc catalog,
867       String JavaDoc schemaPattern, String JavaDoc procedureNamePattern,
868       String JavaDoc columnNamePattern) throws SQLException JavaDoc
869   {
870     try
871     {
872       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
873       if ((raidbLevel == RAIDbLevels.RAIDb1)
874           || (raidbLevel == RAIDbLevels.SingleDB))
875       { // Forward directly to the underlying backend
876
ConnectionAndDatabaseMetaData info = null;
877         try
878         {
879           info = getMetaDataFromFirstAvailableBackend(login);
880           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
881           ResultSet JavaDoc cols = m.getColumns(catalog, schemaPattern,
882               procedureNamePattern, columnNamePattern);
883           ArrayList JavaDoc data = new ArrayList JavaDoc();
884           while (cols.next())
885           { // Unroll the loop for comments (and speed?)
886
Object JavaDoc[] row = new Object JavaDoc[13];
887             row[0] = cols.getObject(1); // PROCEDURE_CAT
888
row[1] = cols.getObject(2); // PROCEDURE_SCHEM
889
row[2] = cols.getObject(3); // PROCEDURE_NAME
890
row[3] = cols.getObject(4); // COLUMN_NAME
891
row[4] = cols.getObject(5); // COLUMN_TYPE
892
row[5] = cols.getObject(6); // DATA_TYPE
893
row[6] = cols.getObject(7); // TYPE_NAME
894
row[7] = cols.getObject(8); // PRECISION
895
row[8] = cols.getObject(9); // LENGTH
896
row[9] = cols.getObject(10); // SCALE
897
row[10] = cols.getObject(11); // RADIX
898
row[11] = cols.getObject(12); // NULLABLE
899
row[12] = cols.getObject(13); // REMARKS
900
data.add(row);
901           }
902           return new DriverResultSet(getProcedureColumnsFields, data);
903         }
904         catch (SQLException JavaDoc e)
905         {
906           throw e;
907         }
908         finally
909         {
910           releaseConnection(info);
911         }
912       }
913     }
914     catch (NoMoreBackendException ignore)
915     {
916       // No backend is available, try with the default method
917
}
918
919     DatabaseSchema dbs = requestManager.getDatabaseSchema();
920     if (dbs == null)
921       throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
922
923     if (procedureNamePattern == null)
924       procedureNamePattern = "%";
925
926     if (columnNamePattern == null)
927       columnNamePattern = "%";
928
929     // Build the ResultSet
930
ArrayList JavaDoc procedures = dbs.getProcedures();
931     int size = procedures.size();
932     ArrayList JavaDoc data = new ArrayList JavaDoc();
933     for (int i = 0; i < size; i++)
934     {
935       DatabaseProcedure t = (DatabaseProcedure) procedures.get(i);
936       if (procedureNamePattern.equals("%")
937           || procedureNamePattern.equals(t.getName()))
938       {
939         if (logger.isDebugEnabled())
940           logger.debug("Found matching procedure " + t.getName());
941
942         ArrayList JavaDoc params = t.getParameters();
943         int sizep = params.size();
944         DatabaseProcedureParameter param;
945         for (int k = 0; k < sizep; k++)
946         {
947           param = (DatabaseProcedureParameter) params.get(k);
948           if (columnNamePattern.equals("%")
949               || columnNamePattern.equals(t.getName()))
950           {
951             if (logger.isDebugEnabled())
952               logger.debug("Found matching procedure parameter"
953                   + param.getName());
954
955             Object JavaDoc[] row = new Object JavaDoc[13];
956             row[0] = vdbName; // PROCEDURE_CAT
957
row[1] = null; // PROCEDURE_SCHEM
958
row[2] = t.getName(); // PROCEDURE_NAME
959
row[3] = param.getName(); // COLUMN_NAME
960
row[4] = new Integer JavaDoc(param.getColumnType()); // COLUMN_TYPE
961
row[5] = new Integer JavaDoc(param.getDataType()); // DATA_TYPE
962
row[6] = param.getTypeName(); // TYPE_NAME
963
row[7] = new Float JavaDoc(param.getPrecision()); // PRECISION
964
row[8] = new Integer JavaDoc(param.getLength()); // LENGTH
965
row[9] = new Integer JavaDoc(param.getScale()); // SCALE
966
row[10] = new Integer JavaDoc(param.getRadix()); // RADIX
967
row[11] = new Integer JavaDoc(param.getNullable()); // NULLABLE
968
row[12] = param.getRemarks();
969
970             data.add(row);
971           }
972         }
973       }
974     }
975     DriverResultSet rs = new DriverResultSet(getProcedureColumnsFields, data);
976     return rs;
977   }
978
979   /**
980    * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getProcedures(String,
981    * String, String)
982    */

983   public DriverResultSet getProcedures(String JavaDoc login, String JavaDoc catalog,
984       String JavaDoc schemaPattern, String JavaDoc procedureNamePattern) throws SQLException JavaDoc
985   {
986     try
987     {
988       int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
989       if ((raidbLevel == RAIDbLevels.RAIDb1)
990           || (raidbLevel == RAIDbLevels.SingleDB))
991       { // Forward directly to the underlying backend
992
ConnectionAndDatabaseMetaData info = null;
993         try
994         {
995           info = getMetaDataFromFirstAvailableBackend(login);
996           DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
997           ResultSet JavaDoc cols = m.getProcedures(catalog, schemaPattern,
998               procedureNamePattern);
999           ArrayList JavaDoc data = new ArrayList JavaDoc();
1000          while (cols.next())
1001          { // Unroll the loop for comments (and speed?)
1002
Object JavaDoc[] row = new Object JavaDoc[8];
1003            row[0] = cols.getObject(1); // PROCEDURE_CAT
1004
row[1] = cols.getObject(2); // PROCEDURE_SCHEM
1005
row[2] = cols.getObject(3); // PROCEDURE_NAME
1006
row[3] = cols.getObject(4); // reserved for future use
1007
row[4] = cols.getObject(5); // reserved for future use
1008
row[5] = cols.getObject(6); // reserved for future use
1009
row[6] = cols.getObject(7); // REMARKS
1010
row[7] = cols.getObject(8); // PROCEDURE_TYPE
1011
data.add(row);
1012          }
1013          return new DriverResultSet(getProceduresFields, data);
1014        }
1015        catch (SQLException JavaDoc e)
1016        {
1017          throw e;
1018        }
1019        finally
1020        {
1021          releaseConnection(info);
1022        }
1023      }
1024    }
1025    catch (NoMoreBackendException ignore)
1026    {
1027      // No backend is available, try with the default method
1028
}
1029
1030    DatabaseSchema dbs = requestManager.getDatabaseSchema();
1031    if (dbs == null)
1032      throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
1033
1034    if (procedureNamePattern == null)
1035      procedureNamePattern = "%"; // if null is passed then
1036
// select all procedures
1037

1038    // Build the ResultSet
1039
ArrayList JavaDoc procedures = dbs.getProcedures();
1040    int size = procedures.size();
1041    ArrayList JavaDoc data = new ArrayList JavaDoc();
1042    for (int i = 0; i < size; i++)
1043    {
1044      DatabaseProcedure t = (DatabaseProcedure) procedures.get(i);
1045      if (procedureNamePattern.equals("%")
1046          || procedureNamePattern.equals(t.getName()))
1047      {
1048        if (logger.isDebugEnabled())
1049          logger.debug("Found procedure " + t.getName());
1050        Object JavaDoc[] row = new Object JavaDoc[8];
1051        row[0] = vdbName; // PROCEDURE_CAT
1052
row[1] = null; // PROCEDURE_SCHEM
1053
row[2] = t.getName(); // PROCEDURE_NAME
1054
row[3] = null; // reserved for future use
1055
row[4] = null; // reserved for future use
1056
row[5] = null; // reserved for future use
1057
row[6] = t.getRemarks(); // REMARKS
1058
row[7] = new Integer JavaDoc(t.getProcedureType()); // PROCEDURE_TYPE
1059
data.add(row);
1060      }
1061    }
1062    DriverResultSet rs = new DriverResultSet(getProceduresFields, data);
1063    return rs;
1064  }
1065
1066  /**
1067   * Will return the schema from the call to getSchemas() on the first available
1068   * node.
1069   *
1070   * @see java.sql.DatabaseMetaData#getSchemas()
1071   */

1072  public DriverResultSet getSchemas(String JavaDoc login) throws SQLException JavaDoc
1073  {
1074    try
1075    { // Forward directly to the underlying backend
1076
ConnectionAndDatabaseMetaData info = null;
1077      try
1078      {
1079        info = getMetaDataFromFirstAvailableBackend(login);
1080        DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1081        ResultSet JavaDoc cols = m.getSchemas();
1082        ArrayList JavaDoc data = new ArrayList JavaDoc();
1083        while (cols.next())
1084        { // Unroll the loop for comments (and speed?)
1085
Object JavaDoc[] row = new Object JavaDoc[2];
1086          row[0] = cols.getObject(1); // TABLE_SCHEM
1087
// JDBC 3.0 starts here
1088
try
1089          {
1090            row[1] = cols.getObject(2); // TABLE_CATALOG
1091
}
1092          catch (Exception JavaDoc e)
1093          { // Driver does not support JDBC 3.0 cut here
1094
row[1] = null; // TABLE_SCHEM
1095
}
1096          data.add(row);
1097        }
1098        return new DriverResultSet(getSchemasFields, data);
1099      }
1100      catch (SQLException JavaDoc e)
1101      {
1102        throw e;
1103      }
1104      finally
1105      {
1106        releaseConnection(info);
1107      }
1108    }
1109    catch (NoMoreBackendException ignore)
1110    {
1111      // No backend is available, try with the default method
1112
}
1113
1114    Object JavaDoc[] row = new Object JavaDoc[2];
1115    row[0] = vdbName; // TABLE_SCHEM
1116
row[1] = null; // TABLE_CATALOG
1117
ArrayList JavaDoc data = new ArrayList JavaDoc();
1118    data.add(row);
1119    return new DriverResultSet(getSchemasFields, data);
1120  }
1121
1122  /**
1123   * @see java.sql.DatabaseMetaData#getSuperTables(java.lang.String,
1124   * java.lang.String, java.lang.String)
1125   */

1126  public DriverResultSet getSuperTables(String JavaDoc login, String JavaDoc catalog,
1127      String JavaDoc schemaPattern, String JavaDoc tableNamePattern) throws SQLException JavaDoc
1128  {
1129    try
1130    {
1131      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1132      if ((raidbLevel == RAIDbLevels.RAIDb1)
1133          || (raidbLevel == RAIDbLevels.SingleDB))
1134      { // Forward directly to the underlying backend
1135
ConnectionAndDatabaseMetaData info = null;
1136        try
1137        {
1138          info = getMetaDataFromFirstAvailableBackend(login);
1139          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1140          ResultSet JavaDoc cols = m.getSuperTables(catalog, schemaPattern,
1141              tableNamePattern);
1142          ArrayList JavaDoc data = new ArrayList JavaDoc();
1143          while (cols.next())
1144          { // Unroll the loop for comments (and speed?)
1145
Object JavaDoc[] row = new Object JavaDoc[4];
1146            row[0] = cols.getObject(1); // TABLE_CAT
1147
row[1] = cols.getObject(2); // TABLE_SCHEM
1148
row[2] = cols.getObject(3); // TABLE_NAME
1149
row[3] = cols.getObject(4); // SUPERTABLE_NAME
1150
data.add(row);
1151          }
1152          return new DriverResultSet(getSuperTablesFields, data);
1153        }
1154        catch (SQLException JavaDoc e)
1155        {
1156          throw e;
1157        }
1158        finally
1159        {
1160          releaseConnection(info);
1161        }
1162      }
1163    }
1164    catch (NoMoreBackendException ignore)
1165    {
1166      // No backend is available, try with the default method
1167
}
1168
1169    // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
1170

1171    ArrayList JavaDoc data = new ArrayList JavaDoc();
1172    DriverResultSet rs = new DriverResultSet(getSuperTablesFields, data);
1173    return rs;
1174  }
1175
1176  /**
1177   * @see java.sql.DatabaseMetaData#getSuperTypes(java.lang.String,
1178   * java.lang.String, java.lang.String)
1179   */

1180  public DriverResultSet getSuperTypes(String JavaDoc login, String JavaDoc catalog,
1181      String JavaDoc schemaPattern, String JavaDoc tableNamePattern) throws SQLException JavaDoc
1182  {
1183    try
1184    {
1185      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1186      if ((raidbLevel == RAIDbLevels.RAIDb1)
1187          || (raidbLevel == RAIDbLevels.SingleDB))
1188      { // Forward directly to the underlying backend
1189
ConnectionAndDatabaseMetaData info = null;
1190        try
1191        {
1192          info = getMetaDataFromFirstAvailableBackend(login);
1193          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1194          ResultSet JavaDoc cols = m.getSuperTypes(catalog, schemaPattern,
1195              tableNamePattern);
1196          ArrayList JavaDoc data = new ArrayList JavaDoc();
1197          while (cols.next())
1198          { // Unroll the loop for comments (and speed?)
1199
Object JavaDoc[] row = new Object JavaDoc[5];
1200            row[0] = cols.getObject(1); // TYPE_CAT
1201
row[1] = cols.getObject(2); // TYPE_SCHEM
1202
row[2] = cols.getObject(3); // TYPE_NAME
1203
row[3] = cols.getObject(4); // SUPERTYPE_CAT
1204
row[4] = cols.getObject(5); // SUPERTYPE_SCHEM
1205
data.add(row);
1206          }
1207          return new DriverResultSet(getSuperTypesFields, data);
1208        }
1209        catch (SQLException JavaDoc e)
1210        {
1211          throw e;
1212        }
1213        finally
1214        {
1215          releaseConnection(info);
1216        }
1217      }
1218    }
1219    catch (NoMoreBackendException ignore)
1220    {
1221      // No backend is available, try with the default method
1222
}
1223
1224    // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
1225

1226    ArrayList JavaDoc data = new ArrayList JavaDoc();
1227    DriverResultSet rs = new DriverResultSet(getSuperTypesFields, data);
1228    return rs;
1229  }
1230
1231  /**
1232   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTablePrivileges(String,
1233   * String, String)
1234   */

1235  public DriverResultSet getTablePrivileges(String JavaDoc login, String JavaDoc catalog,
1236      String JavaDoc schemaPattern, String JavaDoc tableNamePattern) throws SQLException JavaDoc
1237  {
1238    try
1239    {
1240      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1241      if ((raidbLevel == RAIDbLevels.RAIDb1)
1242          || (raidbLevel == RAIDbLevels.SingleDB))
1243      { // Forward directly to the underlying backend
1244
ConnectionAndDatabaseMetaData info = null;
1245        try
1246        {
1247          info = getMetaDataFromFirstAvailableBackend(login);
1248          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1249          ResultSet JavaDoc cols = m.getTablePrivileges(catalog, schemaPattern,
1250              tableNamePattern);
1251          ArrayList JavaDoc data = new ArrayList JavaDoc();
1252          while (cols.next())
1253          { // Unroll the loop for comments (and speed?)
1254
Object JavaDoc[] row = new Object JavaDoc[7];
1255            row[0] = cols.getObject(1); // TABLE_CAT
1256
row[1] = cols.getObject(2); // TABLE_SCHEM
1257
row[2] = cols.getObject(3); // TABLE_NAME
1258
row[3] = cols.getObject(4); // GRANTOR
1259
row[4] = cols.getObject(5); // GRANTEE
1260
row[5] = cols.getObject(6); // PRIVILEGE
1261
row[6] = cols.getObject(7); // IS_GRANTABLE
1262
data.add(row);
1263          }
1264          return new DriverResultSet(getTablePrivilegesFields, data);
1265        }
1266        catch (SQLException JavaDoc e)
1267        {
1268          throw e;
1269        }
1270        finally
1271        {
1272          releaseConnection(info);
1273        }
1274      }
1275    }
1276    catch (NoMoreBackendException ignore)
1277    {
1278      // No backend is available, try with the default method
1279
}
1280
1281    AuthenticationManager manager = requestManager.getVirtualDatabase()
1282        .getAuthenticationManager();
1283
1284    DatabaseSchema dbs = requestManager.getDatabaseSchema();
1285    if (dbs == null)
1286      throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
1287
1288    if (tableNamePattern == null)
1289      // if null is passed then select all tables
1290
tableNamePattern = "%";
1291
1292    ArrayList JavaDoc tables = dbs.getTables();
1293    int size = tables.size();
1294    ArrayList JavaDoc data = new ArrayList JavaDoc();
1295
1296    ArrayList JavaDoc virtualLogins = manager.getVirtualLogins();
1297    int vsize = virtualLogins.size();
1298    VirtualDatabaseUser vu;
1299
1300    for (int i = 0; i < size; i++)
1301    {
1302      DatabaseTable t = (DatabaseTable) tables.get(i);
1303      if (tableNamePattern.equals("%") || tableNamePattern.equals(t.getName()))
1304      {
1305        for (int j = 0; j < vsize; j++)
1306        {
1307          vu = (VirtualDatabaseUser) virtualLogins.get(0);
1308
1309          if (logger.isDebugEnabled())
1310            logger.debug("Found privilege for user:" + vu.getLogin()
1311                + " on table:" + t.getName());
1312          Object JavaDoc[] row = new Object JavaDoc[7];
1313          row[0] = vdbName; // table cat
1314
row[1] = null; // table schema
1315
row[2] = t.getName(); // table name
1316
row[3] = null; // grantor
1317
row[4] = vu.getLogin(); // grantee
1318
row[5] = "UPDATE"; // privilege
1319
row[6] = "NO"; // IS_GRANTABLE
1320
data.add(row);
1321        }
1322      }
1323    }
1324
1325    DriverResultSet rs = new DriverResultSet(getTablePrivilegesFields, data);
1326    return rs;
1327  }
1328
1329  /**
1330   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTables(String, String,
1331   * String, String[])
1332   */

1333  public DriverResultSet getTables(String JavaDoc login, String JavaDoc catalog,
1334      String JavaDoc schemaPattern, String JavaDoc tableNamePattern, String JavaDoc[] types)
1335      throws SQLException JavaDoc
1336  {
1337    try
1338    {
1339      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1340      if ((raidbLevel == RAIDbLevels.RAIDb1)
1341          || (raidbLevel == RAIDbLevels.SingleDB))
1342      { // Forward directly to the underlying backend
1343
ConnectionAndDatabaseMetaData info = null;
1344        try
1345        {
1346          info = getMetaDataFromFirstAvailableBackend(login);
1347          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1348          ResultSet JavaDoc cols = m.getTables(catalog, schemaPattern,
1349              tableNamePattern, types);
1350          ArrayList JavaDoc data = new ArrayList JavaDoc();
1351          while (cols.next())
1352          { // Unroll the loop for comments (and speed?)
1353
Object JavaDoc[] row = new Object JavaDoc[10];
1354            row[0] = cols.getObject(1); // TABLE_CAT
1355
row[1] = cols.getObject(2); // TABLE_SCHEM
1356
row[2] = cols.getObject(3); // TABLE_NAME
1357
row[3] = cols.getObject(4); // TABLE_TYPE
1358
row[4] = cols.getObject(5); // REMARKS
1359

1360            // JDBC 3.0 starts here
1361
try
1362            {
1363              row[5] = cols.getObject(6); // TYPE_CAT
1364
row[6] = cols.getObject(7); // TYPE_SCHEM
1365
row[7] = cols.getObject(8); // TYPE_NAME
1366
row[8] = cols.getObject(9); // SELF_REFERENCING_COL_NAME
1367
row[9] = cols.getObject(10); // REF_GENERATION
1368
}
1369            catch (Exception JavaDoc e)
1370            { // Driver does not support JDBC 3.0 cut here
1371
row[5] = null;
1372              row[6] = null;
1373              row[7] = null;
1374              row[8] = null;
1375              row[9] = null;
1376            }
1377            data.add(row);
1378          }
1379          return new DriverResultSet(getTablesFields, data);
1380        }
1381        catch (SQLException JavaDoc e)
1382        {
1383          throw e;
1384        }
1385        finally
1386        {
1387          releaseConnection(info);
1388        }
1389      }
1390    }
1391    catch (NoMoreBackendException ignore)
1392    {
1393      // No backend is available, try with the default method
1394
}
1395
1396    DatabaseSchema dbs = requestManager.getDatabaseSchema();
1397    if (dbs == null)
1398      throw new SQLException JavaDoc("Unable to fetch the virtual database schema");
1399
1400    if (tableNamePattern == null)
1401      // if null is passed then select all tables
1402
tableNamePattern = "%";
1403
1404    // Build the ResultSet
1405
ArrayList JavaDoc tables = dbs.getTables();
1406    int size = tables.size();
1407    ArrayList JavaDoc data = new ArrayList JavaDoc();
1408    for (int i = 0; i < size; i++)
1409    {
1410      DatabaseTable t = (DatabaseTable) tables.get(i);
1411      if (tableNamePattern.equals("%")
1412          || t.getName().indexOf(tableNamePattern) != -1)
1413      {
1414        if (logger.isDebugEnabled())
1415          logger.debug("Found table " + t.getName());
1416        Object JavaDoc[] row = new Object JavaDoc[10];
1417        row[0] = vdbName; // TABLE_CAT
1418
row[1] = null; // TABLE_SCHEM
1419
row[2] = t.getName(); // TABLE_NAME
1420
row[3] = "TABLE"; // TABLE_TYPE
1421
row[4] = null; // REMARKS
1422
row[5] = null; // TYPE_CAT
1423
row[6] = null; // TYPE_SCHEM
1424
row[7] = null; // TYPE_NAME
1425
row[8] = null; // SELF_REFERENCING_COL_NAME
1426
row[9] = "SYSTEM"; // REF_GENERATION
1427
data.add(row);
1428      }
1429    }
1430    DriverResultSet rs = new DriverResultSet(getTablesFields, data);
1431    return rs;
1432  }
1433
1434  /**
1435   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTableTypes()
1436   */

1437  public DriverResultSet getTableTypes(String JavaDoc login) throws SQLException JavaDoc
1438  {
1439    try
1440    {
1441      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1442      if ((raidbLevel == RAIDbLevels.RAIDb1)
1443          || (raidbLevel == RAIDbLevels.SingleDB))
1444      { // Forward directly to the underlying backend
1445
ConnectionAndDatabaseMetaData info = null;
1446        try
1447        {
1448          info = getMetaDataFromFirstAvailableBackend(login);
1449          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1450          ResultSet JavaDoc cols = m.getTableTypes();
1451          ArrayList JavaDoc data = new ArrayList JavaDoc();
1452          while (cols.next())
1453          { // Unroll the loop for comments (and speed?)
1454
Object JavaDoc[] row = new Object JavaDoc[1];
1455            row[0] = cols.getObject(1); // TABLE_TYPE
1456
data.add(row);
1457          }
1458          return new DriverResultSet(getTableTypesFields, data);
1459        }
1460        catch (SQLException JavaDoc e)
1461        {
1462          throw e;
1463        }
1464        finally
1465        {
1466          releaseConnection(info);
1467        }
1468      }
1469    }
1470    catch (NoMoreBackendException ignore)
1471    {
1472      // No backend is available, try with the default method
1473
}
1474
1475    ArrayList JavaDoc list = new ArrayList JavaDoc(1);
1476    Object JavaDoc[] row = new Object JavaDoc[1];
1477    row[0] = "TABLE"; // TABLE_TYPE
1478
list.add(row);
1479    DriverResultSet rs = new DriverResultSet(getTableTypesFields, list);
1480    return rs;
1481  }
1482
1483  /**
1484   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTypeInfo()
1485   */

1486  public DriverResultSet getTypeInfo(String JavaDoc login) throws SQLException JavaDoc
1487  {
1488    try
1489    {
1490      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1491      if ((raidbLevel == RAIDbLevels.RAIDb1)
1492          || (raidbLevel == RAIDbLevels.SingleDB))
1493      { // Forward directly to the underlying backend
1494
ConnectionAndDatabaseMetaData info = null;
1495        try
1496        {
1497          info = getMetaDataFromFirstAvailableBackend(login);
1498          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1499          ResultSet JavaDoc cols = m.getTypeInfo();
1500          ArrayList JavaDoc data = new ArrayList JavaDoc();
1501          while (cols.next())
1502          { // Unroll the loop for comments (and speed?)
1503
Object JavaDoc[] row = new Object JavaDoc[18];
1504            row[0] = cols.getObject(1); // TYPE_NAME
1505
row[1] = cols.getObject(2); // DATA_TYPE
1506
row[2] = cols.getObject(3); // PRECISION
1507
row[3] = cols.getObject(4); // LITERAL_PREFIX
1508
row[4] = cols.getObject(5); // LITERAL_SUFFIX
1509
row[5] = cols.getObject(6); // CREATE_PARAMS
1510
row[6] = cols.getObject(7); // NULLABLE
1511
row[7] = cols.getObject(8); // CASE_SENSITIVE
1512
row[8] = cols.getObject(9); // SEARCHABLE
1513
row[9] = cols.getObject(10); // UNSIGNED_ATTRIBUTE
1514
row[10] = cols.getObject(11); // FIXED_PREC_SCALE
1515
row[11] = cols.getObject(12); // AUTO_INCREMENT
1516
row[12] = cols.getObject(13); // LOCAL_TYPE_NAME
1517
row[13] = cols.getObject(14); // MINIMUM_SCALE
1518
row[14] = cols.getObject(15); // MAXIMUM_SCALE
1519
row[15] = cols.getObject(16); // SQL_DATA_TYPE
1520
row[16] = cols.getObject(17); // SQL_DATETIME_SUB
1521
row[17] = cols.getObject(18); // NUM_PREC_RADIX
1522
data.add(row);
1523          }
1524          return new DriverResultSet(getTypeInfoFields, data);
1525        }
1526        catch (SQLException JavaDoc e)
1527        {
1528          throw e;
1529        }
1530        finally
1531        {
1532          releaseConnection(info);
1533        }
1534      }
1535    }
1536    catch (NoMoreBackendException ignore)
1537    {
1538      // No backend is available, try with the default method
1539
}
1540
1541    // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
1542

1543    ArrayList JavaDoc data = new ArrayList JavaDoc();
1544    DriverResultSet rs = new DriverResultSet(getTypeInfoFields, data);
1545    return rs;
1546  }
1547
1548  /**
1549   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getUDTs(String, String,
1550   * String, int[])
1551   */

1552  public DriverResultSet getUDTs(String JavaDoc login, String JavaDoc catalog,
1553      String JavaDoc schemaPattern, String JavaDoc tableNamePattern, int[] types)
1554      throws SQLException JavaDoc
1555  {
1556    try
1557    {
1558      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1559      if ((raidbLevel == RAIDbLevels.RAIDb1)
1560          || (raidbLevel == RAIDbLevels.SingleDB))
1561      { // Forward directly to the underlying backend
1562
ConnectionAndDatabaseMetaData info = null;
1563        try
1564        {
1565          info = getMetaDataFromFirstAvailableBackend(login);
1566          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1567          ResultSet JavaDoc cols = m.getUDTs(catalog, schemaPattern, tableNamePattern,
1568              types);
1569          ArrayList JavaDoc data = new ArrayList JavaDoc();
1570          while (cols.next())
1571          { // Unroll the loop for comments (and speed?)
1572
Object JavaDoc[] row = new Object JavaDoc[6];
1573            row[0] = cols.getObject(1); // TYPE_CAT
1574
row[1] = cols.getObject(2); // TYPE_SCHEM
1575
row[2] = cols.getObject(3); // TYPE_NAME
1576
row[3] = cols.getObject(4); // CLASS_NAME
1577
row[4] = cols.getObject(5); // DATA_TYPE
1578
row[5] = cols.getObject(6); // REMARKS
1579

1580            // JDBC 3.0 starts here
1581
try
1582            {
1583              row[6] = cols.getObject(7); // BASE_TYPE
1584
}
1585            catch (Exception JavaDoc e)
1586            { // Driver does not support JDBC 3.0 cut here
1587
row[6] = null; // BASE_TYPE
1588
}
1589
1590            data.add(row);
1591          }
1592          return new DriverResultSet(getUDTsFields, data);
1593        }
1594        catch (SQLException JavaDoc e)
1595        {
1596          throw e;
1597        }
1598        finally
1599        {
1600          releaseConnection(info);
1601        }
1602      }
1603    }
1604    catch (NoMoreBackendException ignore)
1605    {
1606      // No backend is available, try with the default method
1607
}
1608
1609    // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
1610

1611    ArrayList JavaDoc data = new ArrayList JavaDoc();
1612    DriverResultSet rs = new DriverResultSet(getUDTsFields, data);
1613    return rs;
1614  }
1615
1616  /**
1617   * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getVersionColumns(String,
1618   * String, String)
1619   */

1620  public DriverResultSet getVersionColumns(String JavaDoc login, String JavaDoc catalog,
1621      String JavaDoc schema, String JavaDoc table) throws SQLException JavaDoc
1622  {
1623    try
1624    {
1625      int raidbLevel = requestManager.getLoadBalancer().getRAIDbLevel();
1626      if ((raidbLevel == RAIDbLevels.RAIDb1)
1627          || (raidbLevel == RAIDbLevels.SingleDB))
1628      { // Forward directly to the underlying backend
1629
ConnectionAndDatabaseMetaData info = null;
1630        try
1631        {
1632          info = getMetaDataFromFirstAvailableBackend(login);
1633          DatabaseMetaData JavaDoc m = info.getDatabaseMetaData();
1634          ResultSet JavaDoc cols = m.getVersionColumns(catalog, schema, table);
1635          ArrayList JavaDoc data = new ArrayList JavaDoc();
1636          while (cols.next())
1637          { // Unroll the loop for comments (and speed?)
1638
Object JavaDoc[] row = new Object JavaDoc[8];
1639            row[0] = cols.getObject(1); // SCOPE
1640
row[1] = cols.getObject(2); // COLUMN_NAME
1641
row[2] = cols.getObject(3); // DATA_TYPE
1642
row[3] = cols.getObject(4); // TYPE_NAME
1643
row[4] = cols.getObject(5); // COLUMN_SIZE
1644
row[5] = cols.getObject(6); // BUFFER_LENGTH
1645
row[6] = cols.getObject(7); // DECIMAL_DIGITS
1646
row[7] = cols.getObject(8); // PSEUDO_COLUMN
1647
data.add(row);
1648          }
1649          return new DriverResultSet(
1650              getBestRowIdentifierAndVersionColumnsFields, data);
1651        }
1652        catch (SQLException JavaDoc e)
1653        {
1654          throw e;
1655        }
1656        finally
1657        {
1658          releaseConnection(info);
1659        }
1660      }
1661    }
1662    catch (NoMoreBackendException ignore)
1663    {
1664      // No backend is available, try with the default method
1665
}
1666
1667    // Feature not supported in RAIDb-0 and RAIDb-2, return an empty ResultSet
1668

1669    ArrayList JavaDoc data = new ArrayList JavaDoc();
1670    DriverResultSet rs = new DriverResultSet(
1671        getBestRowIdentifierAndVersionColumnsFields, data);
1672    return rs;
1673  }
1674
1675  /**
1676   * Get the first available backend from the virtual database
1677   *
1678   * @return the first available backend or null if no backend enabled is found
1679   */

1680  private DatabaseBackend getFirstAvailableBackend()
1681  {
1682    // Parse the list in a failfast manner
1683
ArrayList JavaDoc backends = requestManager.getVirtualDatabase().getBackends();
1684    try
1685    {
1686      for (Iterator JavaDoc iter = backends.iterator(); iter.hasNext();)
1687      {
1688        DatabaseBackend b = (DatabaseBackend) iter.next();
1689        if (b.isReadEnabled())
1690          return b;
1691      }
1692    }
1693    catch (ConcurrentModificationException JavaDoc e)
1694    {
1695      return getFirstAvailableBackend();
1696    }
1697
1698    return null;
1699  }
1700
1701  /**
1702   * Get DatabaseMetaData from the first available backend.
1703   *
1704   * @param login the login to use to fetch metadata
1705   * @return the DatabaseMetaData obtained from the first available backend
1706   * among with the connection information
1707   * @throws NoMoreBackendException if no backend is enabled on this controller
1708   * @throws SQLException if an error occured while getting MetaData
1709   */

1710  private ConnectionAndDatabaseMetaData getMetaDataFromFirstAvailableBackend(
1711      String JavaDoc login) throws NoMoreBackendException, SQLException JavaDoc
1712  {
1713    DatabaseBackend b = getFirstAvailableBackend();
1714    if (b == null)
1715      throw new NoMoreBackendException(
1716          "No backend is enabled in virtual database " + vdbName);
1717    AbstractConnectionManager cm = b.getConnectionManager(login);
1718    if (cm == null)
1719      throw new SQLException JavaDoc("Invalid login " + login + " on backend "
1720          + b.getName());
1721    Connection JavaDoc c;
1722    try
1723    {
1724      c = cm.getConnection();
1725    }
1726    catch (UnreachableBackendException e)
1727    {
1728      throw new SQLException JavaDoc("Unable to get a connection for login " + login);
1729    }
1730    return new ConnectionAndDatabaseMetaData(c, cm, c.getMetaData());
1731  }
1732
1733  /**
1734   * Release the connection used to fetch the metadata
1735   *
1736   * @param info the connection information returned by
1737   * getMetaDataFromFirstAvailableBackend
1738   * @see #getMetaDataFromFirstAvailableBackend(String)
1739   */

1740  private void releaseConnection(ConnectionAndDatabaseMetaData info)
1741  {
1742    if (info == null)
1743      return;
1744    info.getConnectionManager().releaseConnection(info.getConnection());
1745  }
1746
1747  /**
1748   * This class defines a ConnectionAndDatabaseMetaData used to carry metadata
1749   * and connection related information to properly release the connection later
1750   * on.
1751   *
1752   * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet</a>
1753   * @version 1.0
1754   */

1755  private class ConnectionAndDatabaseMetaData
1756  {
1757    DatabaseMetaData JavaDoc databaseMetaData;
1758    AbstractConnectionManager connectionManager;
1759    Connection JavaDoc connection;
1760
1761    /**
1762     * Creates a new <code>ConnectionAndDatabaseMetaData</code> object
1763     *
1764     * @param c the connection used to get the metadata
1765     * @param cm the connection manager used to get the connection
1766     * @param metadata the metadata fetched from the connection
1767     */

1768    public ConnectionAndDatabaseMetaData(Connection JavaDoc c,
1769        AbstractConnectionManager cm, DatabaseMetaData JavaDoc metadata)
1770    {
1771      this.connection = c;
1772      this.connectionManager = cm;
1773      this.databaseMetaData = metadata;
1774    }
1775
1776    /**
1777     * Returns the connection value.
1778     *
1779     * @return Returns the connection.
1780     */

1781    public Connection JavaDoc getConnection()
1782    {
1783      return connection;
1784    }
1785
1786    /**
1787     * Returns the connectionManager value.
1788     *
1789     * @return Returns the connectionManager.
1790     */

1791    public AbstractConnectionManager getConnectionManager()
1792    {
1793      return connectionManager;
1794    }
1795
1796    /**
1797     * Returns the databaseMetaData value.
1798     *
1799     * @return Returns the databaseMetaData.
1800     */

1801    public DatabaseMetaData JavaDoc getDatabaseMetaData()
1802    {
1803      return databaseMetaData;
1804    }
1805
1806  }
1807
1808  /**
1809   * @see java.sql.DatabaseMetaData#getAttributes(java.lang.String,
1810   * java.lang.String, java.lang.String, java.lang.String)
1811   */

1812  private static Field[] getAttributesFields = new Field[]{
1813      new Field("TYPE_CAT", "TYPE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
1814      new Field("TYPE_SCHEM", "TYPE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1815          "String"),
1816      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
1817          "String"),
1818      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
1819          "Short"),
1820      new Field("ATTR_NAME", "ATTR_NAME", 10, Types.VARCHAR, "VARCHAR",
1821          "String"),
1822      new Field("ATTR_TYPE_NAME", "ATTR_TYPE_NAME", 10, Types.VARCHAR,
1823          "VARCHAR", "String"),
1824      new Field("ATTR_SIZE", "ATTR_SIZE", 10, Types.INTEGER, "INTEGER",
1825          "Integer"),
1826      new Field("DECIMAL_DIGITS", "DECIMAL_DIGITS", 10, Types.INTEGER,
1827          "INTEGER", "Integer"),
1828      new Field("NUM_PREC_RADIX", "NUM_PREC_RADIX", 10, Types.INTEGER,
1829          "INTEGER", "Integer"),
1830      new Field("NULLABLE", "NULLABLE", 10, Types.INTEGER, "INTEGER", "Integer"),
1831      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String"),
1832      new Field("ATTR_DEF", "ATTR_DEF", 10, Types.VARCHAR, "VARCHAR", "String"),
1833      new Field("SQL_DATA_TYPE", "SQL_DATA_TYPE", 10, Types.INTEGER, "INTEGER",
1834          "Integer"),
1835      new Field("SQL_DATETIME_SUB", "SQL_DATETIME_SUB", 10, Types.INTEGER,
1836          "INTEGER", "Integer"),
1837      new Field("CHAR_OCTET_LENGTH", "CHAR_OCTET_LENGTH", 10, Types.INTEGER,
1838          "INTEGER", "Integer"),
1839      new Field("ORDINAL_POSITION", "ORDINAL_POSITION", 10, Types.INTEGER,
1840          "INTEGER", "Integer"),
1841      new Field("IS_NULLABLE", "IS_NULLABLE", 10, Types.VARCHAR, "VARCHAR",
1842          "String"),
1843      new Field("SCOPE_CATALOG", "SCOPE_CATALOG", 10, Types.VARCHAR, "VARCHAR",
1844          "String"),
1845      new Field("SCOPE_SCHEMA", "SCOPE_SCHEMA", 10, Types.VARCHAR, "VARCHAR",
1846          "String"),
1847      new Field("SCOPE_TABLE", "SCOPE_TABLE", 10, Types.VARCHAR, "VARCHAR",
1848          "String") };
1849
1850  /**
1851   * @see java.sql.DatabaseMetaData#getBestRowIdentifier(java.lang.String,
1852   * java.lang.String, java.lang.String, int, boolean)
1853   */

1854  private static Field[] getBestRowIdentifierAndVersionColumnsFields = new Field[]{
1855      new Field("SCOPE", "SCOPE", 10, Types.SMALLINT, "SMALLINT", "Short"),
1856      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
1857          "String"),
1858      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
1859          "Short"),
1860      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
1861          "String"),
1862      new Field("COLUMN_SIZE", "COLUMN_SIZE", 10, Types.INTEGER, "INTEGER",
1863          "Integer"),
1864      new Field("BUFFER_LENGTH", "BUFFER_LENGTH", 10, Types.INTEGER, "INTEGER",
1865          "Integer"),
1866      new Field("DECIMAL_DIGITS", "DECIMAL_DIGITS", 10, Types.SMALLINT,
1867          "SMALLINT", "Short"),
1868      new Field("PSEUDO_COLUMN", "PSEUDO_COLUMN", 10, Types.SMALLINT,
1869          "SMALLINT", "Short") };
1870
1871  /**
1872   * @see java.sql.DatabaseMetaData#getCatalogs()
1873   */

1874  private static Field[] getCatalogsFields = new Field[]{new Field(
1875                                                                         "TABLE_CAT",
1876                                                                         "TABLE_CAT",
1877                                                                         9,
1878                                                                         Types.VARCHAR,
1879                                                                         "VARCHAR",
1880                                                                         "String")};
1881
1882  /**
1883   * @see java.sql.DatabaseMetaData#getColumnPrivileges(java.lang.String,
1884   * java.lang.String, java.lang.String, java.lang.String)
1885   */

1886  private static Field[] getColumnPrivilegesFields = new Field[]{
1887      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
1888      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1889          "String"),
1890      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
1891          "String"),
1892      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
1893          "String"),
1894      new Field("GRANTOR", "GRANTOR", 10, Types.VARCHAR, "VARCHAR", "String"),
1895      new Field("GRANTEE", "GRANTEE", 10, Types.VARCHAR, "VARCHAR", "String"),
1896      new Field("PRIVILEGE", "PRIVILEGE", 10, Types.VARCHAR, "VARCHAR",
1897          "String"),
1898      new Field("IS_GRANTABLE", "IS_GRANTABLE", 10, Types.VARCHAR, "VARCHAR",
1899          "String"), };
1900
1901  /**
1902   * @see java.sql.DatabaseMetaData#getColumns(java.lang.String,
1903   * java.lang.String, java.lang.String, java.lang.String)
1904   */

1905  private static Field[] getColumnsFields = new Field[]{
1906      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
1907      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1908          "String"),
1909      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
1910          "String"),
1911      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
1912          "String"),
1913      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
1914          "Short"),
1915      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
1916          "String"),
1917      new Field("COLUMN_SIZE", "COLUMN_SIZE", 10, Types.INTEGER, "INTEGER",
1918          "Integer"),
1919      new Field("BUFFER_LENGTH", "BUFFER_LENGTH", 10, Types.INTEGER, "INTEGER",
1920          "Integer"),
1921      new Field("DECIMAL_DIGITS", "DECIMAL_DIGITS", 10, Types.INTEGER,
1922          "INTEGER", "Integer"),
1923      new Field("NUM_PREC_RADIX", "NUM_PREC_RADIX", 10, Types.INTEGER,
1924          "INTEGER", "Integer"),
1925      new Field("NULLABLE", "NULLABLE", 10, Types.INTEGER, "INTEGER", "Integer"),
1926      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String"),
1927      new Field("COLUMN_DEF", "COLUMN_DEF", 10, Types.VARCHAR, "VARCHAR",
1928          "String"),
1929      new Field("SQL_DATA_TYPE", "SQL_DATA_TYPE", 10, Types.INTEGER, "INTEGER",
1930          "Integer"),
1931      new Field("SQL_DATETIME_SUB", "SQL_DATETIME_SUB", 10, Types.INTEGER,
1932          "INTEGER", "Integer"),
1933      new Field("CHAR_OCTET_LENGTH", "CHAR_OCTET_LENGTH", 10, Types.INTEGER,
1934          "INTEGER", "Integer"),
1935      new Field("ORDINAL_POSITION", "ORDINAL_POSITION", 10, Types.INTEGER,
1936          "INTEGER", "Integer"),
1937      new Field("IS_NULLABLE", "IS_NULLABLE", 10, Types.VARCHAR, "VARCHAR",
1938          "String"),
1939      new Field("SCOPE_CATALOG", "SCOPE_CATALOG", 10, Types.VARCHAR, "VARCHAR",
1940          "String"),
1941      new Field("SCOPE_SCHEMA", "SCOPE_SCHEMA", 10, Types.VARCHAR, "VARCHAR",
1942          "String"),
1943      new Field("SCOPE_TABLE", "SCOPE_TABLE", 10, Types.VARCHAR, "VARCHAR",
1944          "String"),
1945      new Field("SOURCE_DATA_TYPE", "SOURCE_DATA_TYPE", 10, Types.SMALLINT,
1946          "SMALLINT", "Short") };
1947
1948  /**
1949   * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String,
1950   * java.lang.String, java.lang.String, java.lang.String,
1951   * java.lang.String, java.lang.String)
1952   * @see java.sql.DatabaseMetaData#getImportedKeys(java.lang.String,
1953   * java.lang.String, java.lang.String)
1954   */

1955  private static Field[] getCrossReferenceOrImportExportedKeysFields = new Field[]{
1956      new Field("PKTABLE_CAT", "PKTABLE_CAT", 9, Types.VARCHAR, "VARCHAR",
1957          "String"),
1958      new Field("PKTABLE_SCHEM", "PKTABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1959          "String"),
1960      new Field("PKTABLE_NAME", "PKTABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
1961          "String"),
1962      new Field("PKCOLUMN_NAME", "PKCOLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
1963          "String"),
1964      new Field("FKTABLE_CAT", "FKTABLE_CAT", 9, Types.VARCHAR, "VARCHAR",
1965          "String"),
1966      new Field("FKTABLE_SCHEM", "FKTABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1967          "String"),
1968      new Field("FKTABLE_NAME", "FKTABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
1969          "String"),
1970      new Field("FKCOLUMN_NAME", "FKCOLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
1971          "String"),
1972      new Field("KEY_SEQ", "KEY_SEQ", 10, Types.SMALLINT, "SMALLINT", "Short"),
1973      new Field("UPDATE_RULE", "UPDATE_RULE", 10, Types.SMALLINT, "SMALLINT",
1974          "Short"),
1975      new Field("DELETE_RULE", "DELETE_RULE", 10, Types.SMALLINT, "SMALLINT",
1976          "Short"),
1977      new Field("FK_NAME", "FK_NAME", 10, Types.VARCHAR, "VARCHAR", "String"),
1978      new Field("PK_NAME", "PK_NAME", 10, Types.VARCHAR, "VARCHAR", "String"),
1979      new Field("DEFERRABILITY", "DEFERRABILITY", 10, Types.SMALLINT,
1980          "SMALLINT", "Short") };
1981
1982  /**
1983   * @see java.sql.DatabaseMetaData#getIndexInfo(java.lang.String,
1984   * java.lang.String, java.lang.String, boolean, boolean)
1985   */

1986  private static Field[] getIndexInfoFields = new Field[]{
1987      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
1988      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
1989          "String"),
1990      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
1991          "String"),
1992      new Field("NON_UNIQUE", "NON_UNIQUE", 10, Types.INTEGER, "INTEGER",
1993          "Integer"),
1994      new Field("INDEX_QUALIFIER", "INDEX_QUALIFIER", 10, Types.VARCHAR,
1995          "VARCHAR", "String"),
1996      new Field("INDEX_NAME", "INDEX_NAME", 10, Types.VARCHAR, "VARCHAR",
1997          "String"),
1998      new Field("TYPE", "TYPE", 10, Types.SMALLINT, "SMALLINT", "Short"),
1999      new Field("ORDINAL_POSITION", "ORDINAL_POSITION", 10, Types.SMALLINT,
2000          "SMALLINT", "Short"),
2001      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
2002          "String"),
2003      new Field("ASC_OR_DESC", "ASC_OR_DESC", 10, Types.VARCHAR, "VARCHAR",
2004          "String"),
2005      new Field("CARDINALITY", "CARDINALITY", 10, Types.INTEGER, "INTEGER",
2006          "Integer"),
2007      new Field("PAGES", "PAGES", 10, Types.INTEGER, "INTEGER", "Integer"),
2008      new Field("FILTER_CONDITION", "FILTER_CONDITION", 10, Types.VARCHAR,
2009          "VARCHAR", "String") };
2010
2011  /**
2012   * @see java.sql.DatabaseMetaData#getPrimaryKeys(java.lang.String,
2013   * java.lang.String, java.lang.String)
2014   */

2015  private static Field[] getPrimaryKeysFields = new Field[]{
2016      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2017      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2018          "String"),
2019      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
2020          "String"),
2021      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
2022          "String"),
2023      new Field("KEY_SEQ", "KEY_SEQ", 10, Types.SMALLINT, "SMALLINT", "Short"),
2024      new Field("PK_NAME", "PK_NAME", 10, Types.VARCHAR, "VARCHAR", "String")};
2025  /**
2026   * @see java.sql.DatabaseMetaData#getProcedureColumns(java.lang.String,
2027   * java.lang.String, java.lang.String, java.lang.String)
2028   */

2029  private static Field[] getProcedureColumnsFields = new Field[]{
2030      new Field("PROCEDURE_CAT", "PROCEDURE_CAT", 9, Types.VARCHAR, "VARCHAR",
2031          "String"),
2032      new Field("PROCEDURE_SCHEM", "PROCEDURE_SCHEM", 10, Types.VARCHAR,
2033          "VARCHAR", "String"),
2034      new Field("PROCEDURE_NAME", "PROCEDURE_NAME", 10, Types.VARCHAR,
2035          "VARCHAR", "String"),
2036      new Field("COLUMN_NAME", "COLUMN_NAME", 10, Types.VARCHAR, "VARCHAR",
2037          "String"),
2038      new Field("COLUMN_TYPE", "COLUMN_TYPE", 10, Types.SMALLINT, "SMALLINT",
2039          "Short"),
2040      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
2041          "Short"),
2042      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
2043          "String"),
2044      new Field("PRECISION", "PRECISION", 10, Types.FLOAT, "FLOAT", "Float"),
2045      new Field("LENGTH", "LENGTH", 10, Types.INTEGER, "INTEGER", "Integer"),
2046      new Field("SCALE", "SCALE", 10, Types.SMALLINT, "SMALLINT", "Short"),
2047      new Field("RADIX", "RADIX", 10, Types.SMALLINT, "SMALLINT", "Short"),
2048      new Field("NULLABLE", "NULLABLE", 10, Types.SMALLINT, "SMALLINT", "Short"),
2049      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String")};
2050
2051  /**
2052   * @see java.sql.DatabaseMetaData#getProcedures(java.lang.String,
2053   * java.lang.String, java.lang.String)
2054   */

2055  private static Field[] getProceduresFields = new Field[]{
2056      new Field("PROCEDURE_CAT", "PROCEDURE_CAT", 9, Types.VARCHAR, "VARCHAR",
2057          "String"),
2058      new Field("PROCEDURE_SCHEM", "PROCEDURE_SCHEM", 10, Types.VARCHAR,
2059          "VARCHAR", "String"),
2060      new Field("PROCEDURE_NAME", "PROCEDURE_NAME", 10, Types.VARCHAR,
2061          "VARCHAR", "String"),
2062      new Field("", "", 0, Types.VARCHAR, "VARCHAR", "String"),
2063      new Field("", "", 0, Types.VARCHAR, "VARCHAR", "String"),
2064      new Field("", "", 0, Types.VARCHAR, "VARCHAR", "String"),
2065      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String"),
2066      new Field("PROCEDURE_TYPE", "PROCEDURE_TYPE", 10, Types.SMALLINT,
2067          "SMALLINT", "Short") };
2068
2069  /**
2070   * @see java.sql.DatabaseMetaData#getSchemas()
2071   */

2072  private static Field[] getSchemasFields = new Field[]{
2073      new Field("TABLE_SCHEM", "TABLE_SCHEM", 9, Types.VARCHAR, "VARCHAR",
2074          "String"),
2075      new Field("TABLE_CATALOG", "TABLE_CATALOG", 9, Types.VARCHAR, "VARCHAR",
2076          "String") };
2077
2078  /**
2079   * @see java.sql.DatabaseMetaData#getSuperTables(java.lang.String,
2080   * java.lang.String, java.lang.String)
2081   */

2082  private static Field[] getSuperTablesFields = new Field[]{
2083      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2084      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2085          "String"),
2086      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
2087          "String"),
2088      new Field("SUPERTABLE_NAME", "SUPERTABLE_NAME", 10, Types.VARCHAR,
2089          "VARCHAR", "String") };
2090
2091  /**
2092   * @see java.sql.DatabaseMetaData#getSuperTypes(java.lang.String,
2093   * java.lang.String, java.lang.String)
2094   */

2095  private static Field[] getSuperTypesFields = new Field[]{
2096      new Field("TYPE_CAT", "TYPE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2097      new Field("TYPE_SCHEM", "TYPE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2098          "String"),
2099      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
2100          "String"),
2101      new Field("SUPERTYPE_CAT", "SUPERTYPE_CAT", 10, Types.VARCHAR, "VARCHAR",
2102          "String"),
2103      new Field("SUPERTYPE_SCHEM", "SUPERTYPE_SCHEM", 10, Types.VARCHAR,
2104          "VARCHAR", "String") };
2105
2106  /**
2107   * @see java.sql.DatabaseMetaData#getTablePrivileges(java.lang.String,
2108   * java.lang.String, java.lang.String)
2109   */

2110  private static Field[] getTablePrivilegesFields = new Field[]{
2111      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2112      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2113          "String"),
2114      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
2115          "String"),
2116      new Field("GRANTOR", "GRANTOR", 10, Types.VARCHAR, "VARCHAR", "String"),
2117      new Field("GRANTEE", "GRANTEE", 10, Types.VARCHAR, "VARCHAR", "String"),
2118      new Field("PRIVILEGE", "PRIVILEGE", 10, Types.VARCHAR, "VARCHAR",
2119          "String"),
2120      new Field("IS_GRANTABLE", "IS_GRANTABLE", 10, Types.VARCHAR, "VARCHAR",
2121          "String"), };
2122
2123  /**
2124   * @see java.sql.DatabaseMetaData#getTables(String, String, String, String[])
2125   */

2126  private static Field[] getTablesFields = new Field[]{
2127      new Field("TABLE_CAT", "TABLE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2128      new Field("TABLE_SCHEM", "TABLE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2129          "String"),
2130      new Field("TABLE_NAME", "TABLE_NAME", 10, Types.VARCHAR, "VARCHAR",
2131          "String"),
2132      new Field("TABLE_TYPE", "TABLE_TYPE", 10, Types.VARCHAR, "VARCHAR",
2133          "String"),
2134      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String"),
2135      new Field("TYPE_CAT", "TYPE_CAT", 10, Types.VARCHAR, "VARCHAR", "String"),
2136      new Field("TYPE_SCHEM", "TYPE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2137          "String"),
2138      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
2139          "String"),
2140      new Field("SELF_REFERENCING_COL_NAME", "SELF_REFERENCING_COL_NAME", 25,
2141          Types.VARCHAR, "VARCHAR", "String"),
2142      new Field("REF_GENERATION", "REF_GENERATION", 15, Types.VARCHAR,
2143          "VARCHAR", "String") };
2144
2145  /**
2146   * @see java.sql.DatabaseMetaData#getTableTypes()
2147   */

2148  private static Field[] getTableTypesFields = new Field[]{new Field(
2149                                                                         "TABLE_TYPE",
2150                                                                         "TABLE_TYPE",
2151                                                                         9,
2152                                                                         Types.VARCHAR,
2153                                                                         "VARCHAR",
2154                                                                         "String")};
2155
2156  /**
2157   * @see java.sql.DatabaseMetaData#getTypeInfo()
2158   */

2159  private static Field[] getTypeInfoFields = new Field[]{
2160      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
2161          "String"),
2162      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
2163          "Short"),
2164      new Field("PRECISION", "PRECISION", 10, Types.INTEGER, "INTEGER",
2165          "Integer"),
2166      new Field("LITERAL_PREFIX", "LITERAL_PREFIX", 10, Types.VARCHAR,
2167          "VARCHAR", "String"),
2168      new Field("LITERAL_SUFFIX", "LITERAL_SUFFIX", 10, Types.VARCHAR,
2169          "VARCHAR", "String"),
2170      new Field("CREATE_PARAMS", "CREATE_PARAMS", 10, Types.VARCHAR, "VARCHAR",
2171          "String"),
2172      new Field("NULLABLE", "NULLABLE", 10, Types.INTEGER, "INTEGER", "Integer"),
2173      new Field("CASE_SENSITIVE", "CASE_SENSITIVE", 10, Types.INTEGER,
2174          "INTEGER", "Integer"),
2175      new Field("SEARCHABLE", "SEARCHABLE", 10, Types.SMALLINT, "SMALLINT",
2176          "Short"),
2177      new Field("UNSIGNED_ATTRIBUTE", "UNSIGNED_ATTRIBUTE", 10, Types.INTEGER,
2178          "INTEGER", "Integer"),
2179      new Field("FIXED_PREC_SCALE", "FIXED_PREC_SCALE", 10, Types.INTEGER,
2180          "INTEGER", "Integer"),
2181      new Field("AUTO_INCREMENT", "AUTO_INCREMENT", 10, Types.INTEGER,
2182          "INTEGER", "Integer"),
2183      new Field("LOCAL_TYPE_NAME", "LOCAL_TYPE_NAME", 10, Types.VARCHAR,
2184          "VARCHAR", "String"),
2185      new Field("MINIMUM_SCALE", "MINIMUM_SCALE", 10, Types.SMALLINT,
2186          "SMALLINT", "Short"),
2187      new Field("MAXIMUM_SCALE", "MAXIMUM_SCALE", 10, Types.SMALLINT,
2188          "SMALLINT", "Short"),
2189      new Field("SQL_DATA_TYPE", "SQL_DATA_TYPE", 10, Types.INTEGER, "INTEGER",
2190          "Integer"),
2191      new Field("SQL_DATETIME_SUB", "SQL_DATETIME_SUB", 10, Types.INTEGER,
2192          "INTEGER", "Integer"),
2193      new Field("NUM_PREC_RADIX", "NUM_PREC_RADIX", 10, Types.INTEGER,
2194          "INTEGER", "Integer") };
2195
2196  /**
2197   * @see java.sql.DatabaseMetaData#getUDTs(java.lang.String, java.lang.String,
2198   * java.lang.String, int[])
2199   */

2200  private static Field[] getUDTsFields = new Field[]{
2201      new Field("TYPE_CAT", "TYPE_CAT", 9, Types.VARCHAR, "VARCHAR", "String"),
2202      new Field("TYPE_SCHEM", "TYPE_SCHEM", 10, Types.VARCHAR, "VARCHAR",
2203          "String"),
2204      new Field("TYPE_NAME", "TYPE_NAME", 10, Types.VARCHAR, "VARCHAR",
2205          "String"),
2206      new Field("CLASS_NAME", "CLASS_NAME", 10, Types.VARCHAR, "VARCHAR",
2207          "String"),
2208      new Field("DATA_TYPE", "DATA_TYPE", 10, Types.SMALLINT, "SMALLINT",
2209          "Short"),
2210      new Field("REMARKS", "REMARKS", 10, Types.VARCHAR, "VARCHAR", "String"),
2211      new Field("BASE_TYPE", "BASE_TYPE", 10, Types.SMALLINT, "SMALLINT",
2212          "Short") };
2213
2214}
Popular Tags