Thursday, January 3rd, 2008
Let s take a closer look at what s going on here. The first thing we do is create a Statement object to fake out the ResultSet object that we will be creating to return back to the application. The ResultSet object is dependent upon a Statement object, so we ll give it one. The next thing we do is create all of the column information. Note that all of the required columns are given in the JDBC API specification. The add method simply adds a SimpleTextColumn object to the Hashtable of columns: protected void add( Hashtable h, int col, String name, int type) { h.put(new Integer(col), new SimpleTextColumn(name,type)); } Next, we create another Hashtable to hold all of the data for all of the catalog rows. The Hashtable contains an entry for each row of data. The entry contains the key, which is the row number, and the data value, which is yet another Hashtable whose key is the column number and whose data value is a CommonValue object containing the actual data. Remember that the CommonValue class provides us with the mechanism to store data and coerce it as requested by the application. If a column is null, we simply cannot store any information in the Hashtable for that column number. After some sanity checking to ensure that we really need to look for the catalog information, we get a list of all of the tables. The getTables method in the Connection class provides us with a list of all of the SimpleText data files: public Hashtable getTables( String dir, String table) { Hashtable list = new Hashtable(); // Create a FilenameFilter object. This object will only allow // files with the .SDF extension to be seen. FilenameFilter filter = new SimpleTextEndsWith( SimpleTextDefine.DATA_FILE_EXT); File file = new File(dir); if (file.isDirectory()) { // List all of the files in the directory with the .SDF extension String entries[] = file.list(filter); SimpleTextTable tableEntry; // Create a SimpleTextTable entry for each, and put in // the Hashtable. for (int i = 0; i < entries.length; i++) { // A complete driver needs to further filter the table
If you need complete reliable cheap web hosting package, you come to right place. We offer all you need just check our cheap web hosting package section.