KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sqlmagic > tinysql > tinySQLTable


1 /*
2  * tinySQLTable - abstract class for physical table access under tinySQL
3  *
4  * Copyright 1996, Brian C. Jepson
5  * (bjepson@ids.net)
6  * $Author: davis $
7  * $Date: 2004/12/18 21:26:51 $
8  * $Revision: 1.1 $
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

25
26 package com.sqlmagic.tinysql;
27
28 import java.util.*;
29 import java.lang.*;
30 import java.io.*;
31
32 /**
33  * @author Thomas Morgner <mgs@sherito.org> ColType returns int (an value from
34  * java.sql.Types).
35  */

36 public abstract class tinySQLTable {
37
38   public String JavaDoc table; // the name of the table
39

40   public String JavaDoc tableAlias;
41
42   // Hashtable to contain info about columns in the table
43
//
44
public Hashtable column_info = null;
45
46   /**
47    *
48    * Returns the current number of records in this table
49    *
50    */

51   public abstract int GetRowCount() throws tinySQLException;
52   /**
53    *
54    * Closes the table.
55    *
56    */

57   public abstract void close() throws tinySQLException;
58   /**
59    *
60    * Checks to see if the file is Open or closed.
61    *
62    */

63   public abstract boolean isOpen() throws tinySQLException;
64
65   /**
66    *
67    * Returns the size of a column.
68    *
69    * @param column name of the column.
70    *
71    */

72   public abstract int ColSize(String JavaDoc column) throws tinySQLException;
73   /**
74    *
75    * Returns the decimal places for a column.
76    *
77    * @param column name of the column.
78    *
79    */

80   public abstract int ColDec(String JavaDoc column) throws tinySQLException;
81
82   /**
83   @return Length in bytes of one row
84   */

85   public abstract int getRecordLength();
86
87   /**
88    *
89    * Returns the datatype of a column.
90    *
91    * @param column name of the column.
92    *
93    */

94   public abstract int ColType(String JavaDoc column) throws tinySQLException;
95
96   /**
97    *
98    * Updates the current row in the table.
99    *
100    * @param c Ordered Vector of column names
101    * @param v Ordered Vector (must match order of c) of values
102    *
103    */

104   public abstract void UpdateCurrentRow(Vector c, Vector v)
105     throws tinySQLException;
106
107   /**
108    *
109    * Position the record pointer at the top of the table.
110    *
111    */

112   public abstract void GoTop() throws tinySQLException;
113
114   /**
115    *
116    * Advance the record pointer to the next record.
117    *
118    */

119   public abstract boolean NextRecord() throws tinySQLException;
120
121   /**
122    *
123    * Insert a row. If c or v == null, insert a blank row
124    *
125    * @param c Ordered Vector of column names
126    * @param v Ordered Vector (must match order of c) of values
127    * Insert a blank row.
128    *
129    */

130   public abstract void InsertRow(Vector c, Vector v) throws tinySQLException;
131
132   /**
133    *
134    * Retrieve a column's string value from the current row.
135    *
136    * @param column the column name
137    *
138    */

139   public abstract String JavaDoc GetCol ( String JavaDoc column ) throws tinySQLException ;
140
141   /**
142    *
143    * Update a single column.
144    *
145    * @param column the column name
146    * @param value the String value with which update the column
147    *
148    */

149   public abstract void UpdateCol( String JavaDoc column, String JavaDoc value )
150     throws tinySQLException;
151
152   /**
153    *
154    * Delete the current row.
155    *
156    */

157   public abstract void DeleteRow() throws tinySQLException;
158
159   /**
160    *
161    * Is the current row deleted?
162    *
163    */

164   public abstract boolean isDeleted() throws tinySQLException;
165
166 }
167
Popular Tags