001: /*
002: * tinySQLTable - abstract class for physical table access under tinySQL
003: *
004: * Copyright 1996, Brian C. Jepson
005: * (bjepson@ids.net)
006: * $Author: davis $
007: * $Date: 2004/12/18 21:26:51 $
008: * $Revision: 1.1 $
009: *
010: * This library is free software; you can redistribute it and/or
011: * modify it under the terms of the GNU Lesser General Public
012: * License as published by the Free Software Foundation; either
013: * version 2.1 of the License, or (at your option) any later version.
014: *
015: * This library is distributed in the hope that it will be useful,
016: * but WITHOUT ANY WARRANTY; without even the implied warranty of
017: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
018: * Lesser General Public License for more details.
019: *
020: * You should have received a copy of the GNU Lesser General Public
021: * License along with this library; if not, write to the Free Software
022: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
023: *
024: */
025:
026: package com.sqlmagic.tinysql;
027:
028: import java.util.*;
029: import java.lang.*;
030: import java.io.*;
031:
032: /**
033: * @author Thomas Morgner <mgs@sherito.org> ColType returns int (an value from
034: * java.sql.Types).
035: */
036: public abstract class tinySQLTable {
037:
038: public String table; // the name of the table
039:
040: public String tableAlias;
041:
042: // Hashtable to contain info about columns in the table
043: //
044: public Hashtable column_info = null;
045: public Vector columnNameKeys = null;
046:
047: /**
048: *
049: * Returns the current number of records in this table
050: *
051: */
052: public abstract int GetRowCount() throws tinySQLException;
053:
054: /**
055: *
056: * Closes the table.
057: *
058: */
059: public abstract void close() throws tinySQLException;
060:
061: /**
062: *
063: * Checks to see if the file is Open or closed.
064: *
065: */
066: public abstract boolean isOpen() throws tinySQLException;
067:
068: /**
069: *
070: * Returns the size of a column.
071: *
072: * @param column name of the column.
073: *
074: */
075: public abstract int ColSize(String column) throws tinySQLException;
076:
077: /**
078: *
079: * Returns the decimal places for a column.
080: *
081: * @param column name of the column.
082: *
083: */
084: public abstract int ColDec(String column) throws tinySQLException;
085:
086: /**
087: @return Length in bytes of one row
088: */
089: public abstract int getRecordLength();
090:
091: /**
092: *
093: * Returns the datatype of a column.
094: *
095: * @param column name of the column.
096: *
097: */
098: public abstract int ColType(String column) throws tinySQLException;
099:
100: /**
101: *
102: * Updates the current row in the table.
103: *
104: * @param c Ordered Vector of column names
105: * @param v Ordered Vector (must match order of c) of values
106: *
107: */
108: public abstract void UpdateCurrentRow(Vector c, Vector v)
109: throws tinySQLException;
110:
111: /**
112: *
113: * Position the record pointer at the top of the table.
114: *
115: */
116: public abstract void GoTop() throws tinySQLException;
117:
118: /**
119: *
120: * Advance the record pointer to the next record.
121: *
122: */
123: public abstract boolean NextRecord() throws tinySQLException;
124:
125: /**
126: *
127: * Insert a row. If c or v == null, insert a blank row
128: *
129: * @param c Ordered Vector of column names
130: * @param v Ordered Vector (must match order of c) of values
131: * Insert a blank row.
132: *
133: */
134: public abstract void InsertRow(Vector c, Vector v)
135: throws tinySQLException;
136:
137: /**
138: *
139: * Retrieve a column's string value from the current row.
140: *
141: * @param column the column name
142: *
143: */
144: public abstract String GetCol(String column)
145: throws tinySQLException;
146:
147: /**
148: *
149: * Update a single column.
150: *
151: * @param column the column name
152: * @param value the String value with which update the column
153: *
154: */
155: public abstract void UpdateCol(String column, String value)
156: throws tinySQLException;
157:
158: /**
159: *
160: * Delete the current row.
161: *
162: */
163: public abstract void DeleteRow() throws tinySQLException;
164:
165: /**
166: *
167: * Is the current row deleted?
168: *
169: */
170: public abstract boolean isDeleted() throws tinySQLException;
171:
172: }
|