Skip to content

Commit 17580be

Browse files
author
sereda
committed
package move fix-ups
1 parent 1cc9b14 commit 17580be

17 files changed

Lines changed: 62 additions & 88 deletions

idea/sqlite4java.ipr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@
188188
<annotationProcessing enabled="false" useClasspath="true" />
189189
</component>
190190
<component name="CopyrightManager" default="">
191+
<copyright>
192+
<option name="notice" value="Copyright (c) &amp;#36;today.year. Lorem ipsum dolor sit amet, consectetur adipiscing elit. &#10;Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. &#10;Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. &#10;Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. &#10;Vestibulum commodo. Ut rhoncus gravida arcu." />
193+
<option name="keyword" value="Copyright" />
194+
<option name="allowReplaceKeyword" value="" />
195+
<option name="myName" value="Apache" />
196+
<option name="myLocal" value="true" />
197+
</copyright>
191198
<module2copyright />
192199
</component>
193200
<component name="DependenciesAnalyzeManager">
@@ -359,7 +366,7 @@
359366
</modules>
360367
</component>
361368
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="default" project-jdk-type="JavaSDK">
362-
<output url="file://$PROJECT_DIR$/../.build.idea" />
369+
<output url="file://$PROJECT_DIR$/../build.idea" />
363370
</component>
364371
<component name="ResourceManagerContainer">
365372
<option name="myResourceBundles">
@@ -368,6 +375,9 @@
368375
</value>
369376
</option>
370377
</component>
378+
<component name="SqlDialectMappings">
379+
<file url="file://$PROJECT_DIR$/.." dialect="SQLite" />
380+
</component>
371381
<component name="SvnBranchConfigurationManager">
372382
<option name="myConfigurationMap">
373383
<map>

java/com/almworks/sqlite4java/Internal.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
package com.almworks.sqlite4java;
22

3-
import sqlite._SQLiteSwigged;
4-
53
import java.io.File;
64
import java.net.URL;
75
import java.util.logging.Level;
86
import java.util.logging.Logger;
97

108
final class Internal {
11-
private static final Logger logger = Logger.getLogger("sqlite");
9+
private static final Logger logger = Logger.getLogger("com.almworks.sqlite4java");
1210
private static final String LOG_PREFIX = "[sqlite] ";
1311

14-
private static final String BASE_LIBRARY_NAME = "sqlite";
12+
private static final String BASE_LIBRARY_NAME = "sqlite4java";
1513
private static final String[] DEBUG_SUFFIXES = {"d", ""};
1614
private static final String[] RELEASE_SUFFIXES = {"", "d"};
1715

java/com/almworks/sqlite4java/SQLite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.almworks.sqlite4java;
22

3-
import sqlite._SQLiteSwigged;
3+
import static com.almworks.sqlite4java.SQLiteConstants.Wrapper;
44

55
public final class SQLite {
66
private static boolean preferDebugLibrary = "true".equalsIgnoreCase(System.getProperty("sqlite.prefer.debug.lib"));
@@ -22,7 +22,7 @@ public static synchronized void loadLibrary() throws SQLiteException {
2222
if (!libraryLoaded) {
2323
Throwable t = Internal.loadLibraryX();
2424
if (t != null)
25-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_CANNOT_LOAD_LIBRARY, "cannot load library: " + t, t);
25+
throw new SQLiteException(Wrapper.WRAPPER_CANNOT_LOAD_LIBRARY, "cannot load library: " + t, t);
2626
libraryLoaded = true;
2727
int threadSafe = _SQLiteSwigged.sqlite3_threadsafe();
2828
if (threadSafe == 0) {

java/com/almworks/sqlite4java/SQLiteBlob.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.almworks.sqlite4java;
22

3-
import sqlite.SWIGTYPE_p_sqlite3_blob;
4-
import sqlite._SQLiteSwigged;
5-
63
/**
74
* This class encapsulates blob handle which is open for direct reading / writing
85
*/
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package com.almworks.sqlite4java;
22

3+
import static com.almworks.sqlite4java.SQLiteConstants.Result;
4+
35
public class SQLiteBusyException extends SQLiteException {
46
public SQLiteBusyException(int errorCode, String errorMessage) {
57
super(errorCode, errorMessage);
6-
assert errorCode == SQLiteConstants.Result.SQLITE_BUSY || errorCode == SQLiteConstants.Result.SQLITE_IOERR_BLOCKED : errorCode;
8+
assert errorCode == Result.SQLITE_BUSY || errorCode == Result.SQLITE_IOERR_BLOCKED : errorCode;
79
}
810
}

java/com/almworks/sqlite4java/SQLiteConnection.java

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
import javolution.util.FastMap;
44
import javolution.util.FastTable;
5-
import sqlite.SWIGTYPE_p_sqlite3;
6-
import sqlite.SWIGTYPE_p_sqlite3_blob;
7-
import sqlite.SWIGTYPE_p_sqlite3_stmt;
8-
import sqlite._SQLiteSwigged;
95

106
import java.io.File;
117
import java.io.IOException;
@@ -15,6 +11,8 @@
1511
import java.util.Map;
1612
import java.util.logging.Level;
1713

14+
import static com.almworks.sqlite4java.SQLiteConstants.*;
15+
1816
/**
1917
* SQLiteConnection is a single connection to sqlite database. Most methods are thread-confined,
2018
* and will throw errors if called from alien thread. Confinement thread is defined at the
@@ -178,13 +176,13 @@ public SQLiteConnection open() throws SQLiteException {
178176
* be true
179177
*/
180178
public SQLiteConnection open(boolean allowCreate) throws SQLiteException {
181-
int flags = SQLiteConstants.Open.SQLITE_OPEN_READWRITE;
179+
int flags = Open.SQLITE_OPEN_READWRITE;
182180
if (!allowCreate) {
183181
if (isMemoryDatabase()) {
184-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_WEIRD, "cannot open memory database without creation");
182+
throw new SQLiteException(Wrapper.WRAPPER_WEIRD, "cannot open memory database without creation");
185183
}
186184
} else {
187-
flags |= SQLiteConstants.Open.SQLITE_OPEN_CREATE;
185+
flags |= Open.SQLITE_OPEN_CREATE;
188186
}
189187
openX(flags);
190188
return this;
@@ -195,9 +193,9 @@ public SQLiteConnection open(boolean allowCreate) throws SQLiteException {
195193
*/
196194
public SQLiteConnection openReadonly() throws SQLiteException {
197195
if (isMemoryDatabase()) {
198-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_WEIRD, "cannot open memory database in read-only mode");
196+
throw new SQLiteException(Wrapper.WRAPPER_WEIRD, "cannot open memory database in read-only mode");
199197
}
200-
openX(SQLiteConstants.Open.SQLITE_OPEN_READONLY);
198+
openX(Open.SQLITE_OPEN_READONLY);
201199
return this;
202200
}
203201

@@ -377,7 +375,7 @@ public SQLiteStatement prepare(SQLParts parts, boolean cached) throws SQLiteExce
377375
stmt = mySQLiteManual.sqlite3_prepare_v2(handle, parts.toString());
378376
throwResult(mySQLiteManual.getLastReturnCode(), "prepare()", parts);
379377
if (stmt == null)
380-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_WEIRD, "sqlite did not return stmt");
378+
throw new SQLiteException(Wrapper.WRAPPER_WEIRD, "sqlite did not return stmt");
381379
} else {
382380
if (Internal.isFineLogging())
383381
Internal.logFine(this, "using cached stmt for [" + parts + "]");
@@ -403,7 +401,7 @@ public SQLiteStatement prepare(SQLParts parts, boolean cached) throws SQLiteExce
403401
} catch (Exception e) {
404402
// ignore
405403
}
406-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_NOT_OPENED, "connection disposed");
404+
throw new SQLiteException(Wrapper.WRAPPER_NOT_OPENED, "connection disposed");
407405
}
408406
return statement;
409407
}
@@ -420,7 +418,7 @@ public SQLiteBlob blob(String dbname, String table, String column, long rowid, b
420418
SWIGTYPE_p_sqlite3_blob blob = mySQLiteManual.sqlite3_blob_open(handle, dbname, table, column, rowid, writeAccess);
421419
throwResult(mySQLiteManual.getLastReturnCode(), "openBlob()", null);
422420
if (blob == null)
423-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_WEIRD, "sqlite did not return blob");
421+
throw new SQLiteException(Wrapper.WRAPPER_WEIRD, "sqlite did not return blob");
424422
SQLiteBlob result = null;
425423
synchronized (myLock) {
426424
// the connection may close while openBlob in progress
@@ -439,7 +437,7 @@ public SQLiteBlob blob(String dbname, String table, String column, long rowid, b
439437
} catch (Exception e) {
440438
// ignore
441439
}
442-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_NOT_OPENED, "connection disposed");
440+
throw new SQLiteException(Wrapper.WRAPPER_NOT_OPENED, "connection disposed");
443441
}
444442
return result;
445443
}
@@ -596,14 +594,14 @@ private void finalizeBlob(SQLiteBlob blob) {
596594

597595
private void softFinalize(SWIGTYPE_p_sqlite3_stmt handle, Object source) {
598596
int rc = _SQLiteSwigged.sqlite3_finalize(handle);
599-
if (rc != SQLiteConstants.Result.SQLITE_OK) {
597+
if (rc != Result.SQLITE_OK) {
600598
Internal.logWarn(this, "error [" + rc + "] finishing " + source);
601599
}
602600
}
603601

604602
private void softClose(SWIGTYPE_p_sqlite3_blob handle, Object source) {
605603
int rc = _SQLiteSwigged.sqlite3_blob_close(handle);
606-
if (rc != SQLiteConstants.Result.SQLITE_OK) {
604+
if (rc != Result.SQLITE_OK) {
607605
Internal.logWarn(this, "error [" + rc + "] finishing " + source);
608606
}
609607
}
@@ -682,10 +680,10 @@ private void forgetBlob(SQLiteBlob blob) {
682680
private SWIGTYPE_p_sqlite3 handle() throws SQLiteException {
683681
synchronized (myLock) {
684682
if (myDisposed)
685-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_MISUSE, "connection is disposed");
683+
throw new SQLiteException(Wrapper.WRAPPER_MISUSE, "connection is disposed");
686684
SWIGTYPE_p_sqlite3 handle = myHandle;
687685
if (handle == null)
688-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_NOT_OPENED, null);
686+
throw new SQLiteException(Wrapper.WRAPPER_NOT_OPENED, null);
689687
return handle;
690688
}
691689
}
@@ -712,9 +710,9 @@ void throwResult(int resultCode, String operation, Object additional) throws SQL
712710
Internal.log(Level.WARNING, this, "cannot get sqlite3_errmsg", e);
713711
}
714712
}
715-
if (resultCode == SQLiteConstants.Result.SQLITE_BUSY || resultCode == SQLiteConstants.Result.SQLITE_IOERR_BLOCKED) {
713+
if (resultCode == Result.SQLITE_BUSY || resultCode == Result.SQLITE_IOERR_BLOCKED) {
716714
throw new SQLiteBusyException(resultCode, message);
717-
} else if (resultCode == SQLiteConstants.Result.SQLITE_INTERRUPT) {
715+
} else if (resultCode == Result.SQLITE_INTERRUPT) {
718716
throw new SQLiteCancelledException(resultCode, message);
719717
} else {
720718
throw new SQLiteException(resultCode, message);
@@ -729,7 +727,7 @@ private void openX(int flags) throws SQLiteException {
729727
SWIGTYPE_p_sqlite3 handle;
730728
synchronized (myLock) {
731729
if (myDisposed) {
732-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_MISUSE, "cannot reopen closed connection");
730+
throw new SQLiteException(Wrapper.WRAPPER_MISUSE, "cannot reopen closed connection");
733731
}
734732
if (myConfinement == null) {
735733
myConfinement = Thread.currentThread();
@@ -749,7 +747,7 @@ private void openX(int flags) throws SQLiteException {
749747
Internal.logFine(this, "dbname [" + dbname + "]");
750748
handle = mySQLiteManual.sqlite3_open_v2(dbname, flags);
751749
int rc = mySQLiteManual.getLastReturnCode();
752-
if (rc != SQLiteConstants.Result.SQLITE_OK) {
750+
if (rc != Result.SQLITE_OK) {
753751
if (handle != null) {
754752
if (Internal.isFineLogging())
755753
Internal.logFine(this, "error on open (" + rc + "), closing handle");
@@ -763,7 +761,7 @@ private void openX(int flags) throws SQLiteException {
763761
throw new SQLiteException(rc, errorMessage);
764762
}
765763
if (handle == null) {
766-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_WEIRD, "sqlite didn't return db handle");
764+
throw new SQLiteException(Wrapper.WRAPPER_WEIRD, "sqlite didn't return db handle");
767765
}
768766
synchronized (myLock) {
769767
myHandle = handle;
@@ -774,7 +772,7 @@ private void openX(int flags) throws SQLiteException {
774772

775773
private void configureConnection(SWIGTYPE_p_sqlite3 handle) {
776774
int rc = _SQLiteSwigged.sqlite3_extended_result_codes(handle, 1);
777-
if (rc != SQLiteConstants.Result.SQLITE_OK) {
775+
if (rc != Result.SQLITE_OK) {
778776
Internal.logWarn(this, "cannot enable extended result codes [" + rc + "]");
779777
}
780778
}
@@ -796,7 +794,7 @@ void checkThread() throws SQLiteException {
796794
Thread thread = Thread.currentThread();
797795
if (thread != confinement) {
798796
String message = this + " confined(" + confinement + ") used(" + thread + ")";
799-
throw new SQLiteException(SQLiteConstants.Wrapper.WRAPPER_CONFINEMENT_VIOLATED, message);
797+
throw new SQLiteException(Wrapper.WRAPPER_CONFINEMENT_VIOLATED, message);
800798
}
801799
}
802800

java/com/almworks/sqlite4java/SQLiteStatement.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
package com.almworks.sqlite4java;
22

33
import javolution.util.FastTable;
4-
import sqlite.SWIGTYPE_p_sqlite3_stmt;
5-
import sqlite._SQLiteSwigged;
6-
7-
import static com.almworks.sqlite4java.SQLiteConstants.*;
84

95
import java.io.IOException;
106
import java.io.InputStream;
117
import java.io.OutputStream;
128
import java.nio.BufferUnderflowException;
139
import java.nio.ByteBuffer;
1410

11+
import static com.almworks.sqlite4java.SQLiteConstants.*;
12+
1513
/**
1614
* This class encapsulates sqlite statement. It is linked to the opening connection through controller, and confined to
1715
* the same thread.

java/com/almworks/sqlite4java/_SQLiteManual.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package com.almworks.sqlite4java;
22

3-
import sqlite.SWIGTYPE_p_sqlite3;
4-
import sqlite.SWIGTYPE_p_sqlite3_blob;
5-
import sqlite.SWIGTYPE_p_sqlite3_stmt;
6-
73
import java.nio.ByteBuffer;
84

95
final class _SQLiteManual {

0 commit comments

Comments
 (0)