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 { |
65 | return false; |
66 | } |
67 | |
68 | final byte[] getBytes(int offset, int dataType) throws Exception { |
69 | return null; |
70 | } |
71 | |
72 | |
73 | final double getDouble(int offset, int dataType) throws Exception { |
74 | return 0; |
75 | } |
76 | |
77 | |
78 | final float getFloat(int offset, int dataType) throws Exception { |
79 | return 0; |
80 | } |
81 | |
82 | |
83 | final int getInt(int offset, int dataType) throws Exception { |
84 | return 0; |
85 | } |
86 | |
87 | |
88 | final long getLong(int offset, int dataType) throws Exception { |
89 | return 0; |
90 | } |
91 | |
92 | |
93 | final long getMoney(int offset, int dataType) throws Exception { |
94 | return 0; |
95 | } |
96 | |
97 | |
98 | final MutableNumeric getNumeric(int offset, int dataType) throws Exception { |
99 | return null; |
100 | } |
101 | |
102 | |
103 | final Object getObject(int offset, int dataType) throws Exception { |
104 | return null; |
105 | } |
106 | |
107 | |
108 | final String getString(int offset, int dataType) throws Exception { |
109 | return null; |
110 | } |
111 | |
112 | |
113 | |
114 | final void scanObjectOffsets(int[] offsets, int[] dataTypes) { |
115 | } |
116 | |
117 | |
118 | final int getUsedSize() { |
119 | return 0; |
120 | } |
121 | |
122 | final long getNextPagePos(){ |
123 | return nextPagePos; |
124 | } |
125 | |
126 | final void deleteRow(SSConnection con) throws SQLException{ |
127 | if(nextPagePos >= 0){ |
128 | throw Utils.createSQLException("Row allready deleted."); |
129 | } |
130 | //TODO |
131 | throw new Error(); |
132 | } |
133 | } |