KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > smallsql > database > StoreNull


1 /* =============================================================
2  * SmallSQL : a free Java DBMS library for the Java(tm) platform
3  * =============================================================
4  *
5  * (C) Copyright 2004-2006, by Volker Berlin.
6  *
7  * Project Info: http://www.smallsql.de/
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------
28  * StoreNull.java
29  * ---------------
30  * Author: Volker Berlin
31  *
32  */

33 package smallsql.database;
34
35 import java.sql.*;
36
37 /*
38  * @author Volker Berlin
39  *
40  * This class is a implementation of the STore that returns only null.
41  * This is used for OUTER JOIN to return null values for tables with no
42  * row position.
43  *
44  */

45 class StoreNull extends Store {
46
47     private final long nextPagePos;
48     
49     
50     StoreNull(){
51         this(-1);
52     }
53     
54     
55     StoreNull(long nextPos){
56         nextPagePos = nextPos;
57     }
58     
59     
60     final boolean isNull(int offset) {
61         return true;
62     }
63
64     final boolean getBoolean(int offset, int dataType) throws Exception JavaDoc {
65         return false;
66     }
67
68     final byte[] getBytes(int offset, int dataType) throws Exception JavaDoc {
69         return null;
70     }
71
72     
73     final double getDouble(int offset, int dataType) throws Exception JavaDoc {
74         return 0;
75     }
76
77
78     final float getFloat(int offset, int dataType) throws Exception JavaDoc {
79         return 0;
80     }
81
82
83     final int getInt(int offset, int dataType) throws Exception JavaDoc {
84         return 0;
85     }
86
87     
88     final long getLong(int offset, int dataType) throws Exception JavaDoc {
89         return 0;
90     }
91
92
93     final long getMoney(int offset, int dataType) throws Exception JavaDoc {
94         return 0;
95     }
96
97
98     final MutableNumeric getNumeric(int offset, int dataType) throws Exception JavaDoc {
99         return null;
100     }
101
102
103     final Object JavaDoc getObject(int offset, int dataType) throws Exception JavaDoc {
104         return null;
105     }
106
107
108     final String JavaDoc getString(int offset, int dataType) throws Exception JavaDoc {
109         return null;
110     }
111
112
113
114     final void scanObjectOffsets(int[] offsets, int[] dataTypes) {/* there is nothing to scan */}
115
116
117     final int getUsedSize() {
118         return 0;
119     }
120
121     final long getNextPagePos(){
122         return nextPagePos;
123     }
124     
125     final void deleteRow(SSConnection con) throws SQLException{
126         if(nextPagePos >= 0){
127             throw Utils.createSQLException("Row already deleted.");
128         }
129         //TODO
130
throw new Error JavaDoc();
131     }
132 }
133
Popular Tags