-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_SQLiteManual.java
More file actions
226 lines (196 loc) · 9.06 KB
/
Copy path_SQLiteManual.java
File metadata and controls
226 lines (196 loc) · 9.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
* Copyright 2010 ALM Works Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.almworks.sqlite4java;
import java.nio.ByteBuffer;
final class _SQLiteManual {
/**
* These arrays are used for return values. SQLiteConnection facade must ensure the methods are called
* from the same thread, so these values are confined.
*/
private final int[] myInt = {0};
private final long[] myLong = {0};
private final String[] myString = {null};
private final byte[][] myByteArray = {null};
private final Object[] myObject = {null, null};
/**
* Last return code received for non-static methods.
*/
private int myLastReturnCode = 0;
private String myLastOpenError = null;
public static String wrapper_version() {
return _SQLiteManualJNI.wrapper_version();
}
public static int sqlite3_exec(SWIGTYPE_p_sqlite3 db, String sql, String[] outError) {
assert outError == null || outError.length == 1 : outError.length;
return _SQLiteManualJNI.sqlite3_exec(SWIGTYPE_p_sqlite3.getCPtr(db), sql, outError);
}
public static int sqlite3_bind_text(SWIGTYPE_p_sqlite3_stmt stmt, int index, String value) {
return _SQLiteManualJNI.sqlite3_bind_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), index, value);
}
public static int sqlite3_bind_blob(SWIGTYPE_p_sqlite3_stmt stmt, int index, byte[] value, int offset, int length) {
return _SQLiteManualJNI.sqlite3_bind_blob(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), index, value, offset, length);
}
public static int sqlite3_blob_read(SWIGTYPE_p_sqlite3_blob blob, int blobOffset, byte[] buffer, int bufferOffset, int length) {
return _SQLiteManualJNI.sqlite3_blob_read(SWIGTYPE_p_sqlite3_blob.getCPtr(blob), blobOffset, buffer, bufferOffset, length);
}
public static int sqlite3_blob_write(SWIGTYPE_p_sqlite3_blob blob, int blobOffset, byte[] buffer, int bufferOffset, int length) {
return _SQLiteManualJNI.sqlite3_blob_write(SWIGTYPE_p_sqlite3_blob.getCPtr(blob), blobOffset, buffer, bufferOffset, length);
}
public int getLastReturnCode() {
return myLastReturnCode;
}
public String drainLastOpenError() {
String r = myLastOpenError;
myLastOpenError = null;
return r;
}
public SWIGTYPE_p_sqlite3 sqlite3_open_v2(String filename, int flags) {
myLastReturnCode = 0;
myLong[0] = 0;
myString[0] = null;
myLastReturnCode = _SQLiteManualJNI.sqlite3_open_v2(filename, myLong, flags, myString);
long ptr = myLong[0];
myLong[0] = 0;
myLastOpenError = myString[0];
myString[0] = null;
return ptr == 0 ? null : new SWIGTYPE_p_sqlite3(ptr, true);
}
public SWIGTYPE_p_sqlite3_stmt sqlite3_prepare_v2(SWIGTYPE_p_sqlite3 db, String sql) {
myLastReturnCode = 0;
myLong[0] = 0;
myLastReturnCode = _SQLiteManualJNI.sqlite3_prepare_v2(SWIGTYPE_p_sqlite3.getCPtr(db), sql, myLong);
long ptr = myLong[0];
myLong[0] = 0;
return ptr == 0 ? null : new SWIGTYPE_p_sqlite3_stmt(ptr, true);
}
public String sqlite3_column_text(SWIGTYPE_p_sqlite3_stmt stmt, int column) {
myLastReturnCode = 0;
myString[0] = null;
myLastReturnCode = _SQLiteManualJNI.sqlite3_column_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), column, myString);
String r = myString[0];
myString[0] = null;
return r;
}
public byte[] sqlite3_column_blob(SWIGTYPE_p_sqlite3_stmt stmt, int column) {
myLastReturnCode = 0;
myByteArray[0] = null;
myLastReturnCode = _SQLiteManualJNI.sqlite3_column_blob(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), column, myByteArray);
byte[] r = myByteArray[0];
myByteArray[0] = null;
return r;
}
public SWIGTYPE_p_sqlite3_blob sqlite3_blob_open(SWIGTYPE_p_sqlite3 db, String database, String table, String column, long rowid, boolean writeAccess) {
myLastReturnCode = 0;
myLong[0] = 0;
myLastReturnCode = _SQLiteManualJNI.sqlite3_blob_open(SWIGTYPE_p_sqlite3.getCPtr(db), database, table, column, rowid, writeAccess, myLong);
long ptr = myLong[0];
myLong[0] = 0;
return ptr == 0 ? null : new SWIGTYPE_p_sqlite3_blob(ptr, true);
}
public DirectBuffer wrapper_alloc(int size) {
myLastReturnCode = 0;
myLong[0] = 0;
myObject[0] = null;
myObject[1] = null;
myLastReturnCode = _SQLiteManualJNI.wrapper_alloc(size, myLong, myObject);
ByteBuffer controlBuffer = myObject[0] instanceof ByteBuffer ? (ByteBuffer) myObject[0] : null;
ByteBuffer dataBuffer = myObject[1] instanceof ByteBuffer ? (ByteBuffer) myObject[1] : null;
long ptr = myLong[0];
if (controlBuffer == null || dataBuffer == null || ptr == 0) {
return null;
}
return new DirectBuffer(new SWIGTYPE_p_direct_buffer(ptr, true), controlBuffer, dataBuffer, size);
}
public static int wrapper_free(DirectBuffer buffer) {
SWIGTYPE_p_direct_buffer handle = buffer.getHandle();
buffer.invalidate();
if (handle == null)
return 0;
int rc = _SQLiteManualJNI.wrapper_free(SWIGTYPE_p_direct_buffer.getCPtr(handle));
return rc;
}
public static int wrapper_bind_buffer(SWIGTYPE_p_sqlite3_stmt stmt, int index, DirectBuffer buffer) {
SWIGTYPE_p_direct_buffer handle = buffer.getHandle();
if (handle == null)
return SQLiteConstants.WRAPPER_WEIRD;
int size = buffer.getPosition();
return _SQLiteManualJNI.wrapper_bind_buffer(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), index, SWIGTYPE_p_direct_buffer.getCPtr(handle), size);
}
public ByteBuffer wrapper_column_buffer(SWIGTYPE_p_sqlite3_stmt stmt, int column) {
myLastReturnCode = 0;
myObject[0] = null;
myLastReturnCode = _SQLiteManualJNI.wrapper_column_buffer(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), column, myObject);
ByteBuffer r = myObject[0] instanceof ByteBuffer ? (ByteBuffer) myObject[0] : null;
myObject[0] = null;
return r;
}
public ProgressHandler install_progress_handler(SWIGTYPE_p_sqlite3 db, int stepsPerCallback) {
myLastReturnCode = 0;
myLong[0] = 0;
myObject[0] = null;
myLastReturnCode = _SQLiteManualJNI.install_progress_handler(SWIGTYPE_p_sqlite3.getCPtr(db), stepsPerCallback, myLong, myObject);
ByteBuffer r = myObject[0] instanceof ByteBuffer ? (ByteBuffer) myObject[0] : null;
myObject[0] = null;
long ptr = myLong[0];
myLong[0] = 0;
if (ptr == 0 || r == null)
return null;
return new ProgressHandler(new SWIGTYPE_p_direct_buffer(ptr, true), r, stepsPerCallback);
}
public static int uninstall_progress_handler(SWIGTYPE_p_sqlite3 db, ProgressHandler handler) {
SWIGTYPE_p_direct_buffer pointer = handler.dispose();
if (pointer == null)
return 0;
return _SQLiteManualJNI.uninstall_progress_handler(SWIGTYPE_p_sqlite3.getCPtr(db), SWIGTYPE_p_direct_buffer.getCPtr(pointer));
}
public int wrapper_load_ints(SWIGTYPE_p_sqlite3_stmt stmt, int column, int[] buffer, int offset, int count) {
myLastReturnCode = 0;
myInt[0] = 0;
myLastReturnCode = _SQLiteManualJNI.wrapper_load_ints(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), column, buffer, offset, count, myInt);
int r = myInt[0];
myInt[0] = 0;
return r;
}
public int wrapper_load_longs(SWIGTYPE_p_sqlite3_stmt stmt, int column, long[] buffer, int offset, int count) {
myLastReturnCode = 0;
myInt[0] = 0;
myLastReturnCode = _SQLiteManualJNI.wrapper_load_longs(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), column, buffer, offset, count, myInt);
int r = myInt[0];
myInt[0] = 0;
return r;
}
public SWIGTYPE_p_intarray_module sqlite3_intarray_register(SWIGTYPE_p_sqlite3 db) {
myLastReturnCode = 0;
myLong[0] = 0;
myLastReturnCode = _SQLiteManualJNI.sqlite3_intarray_register(SWIGTYPE_p_sqlite3.getCPtr(db), myLong);
return myLong[0] == 0 ? null : new SWIGTYPE_p_intarray_module(myLong[0], true);
}
public SWIGTYPE_p_intarray sqlite3_intarray_create(SWIGTYPE_p_intarray_module module, String name) {
myLastReturnCode = 0;
myLong[0] = 0;
myLastReturnCode = _SQLiteManualJNI.sqlite3_intarray_create(SWIGTYPE_p_intarray_module.getCPtr(module), name, myLong);
return myLong[0] == 0 ? null : new SWIGTYPE_p_intarray(myLong[0], true);
}
public static int sqlite3_intarray_bind(SWIGTYPE_p_intarray array, long[] values, int offset, int length, boolean ordered, boolean unique) {
return _SQLiteManualJNI.sqlite3_intarray_bind(SWIGTYPE_p_intarray.getCPtr(array), values, offset, length, ordered, unique);
}
public static int sqlite3_intarray_unbind(SWIGTYPE_p_intarray array) {
return _SQLiteManualJNI.sqlite3_intarray_unbind(SWIGTYPE_p_intarray.getCPtr(array));
}
public static int sqlite3_intarray_destroy(SWIGTYPE_p_intarray array) {
return _SQLiteManualJNI.sqlite3_intarray_destroy(SWIGTYPE_p_intarray.getCPtr(array));
}
}