-
Notifications
You must be signed in to change notification settings - Fork 47
/
SQLite.java
65 lines (55 loc) · 1.5 KB
/
SQLite.java
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
package org.orman.sqlite;
import org.orman.datasource.DataTypeMapper;
import org.orman.datasource.Database;
import org.orman.datasource.QueryExecutionContainer;
import org.orman.sql.SQLGrammarProvider;
import org.orman.util.Log;
/**
* SQLite implementation with sqlite4java library
* {@link http://code.google.com/p/sqlite4java/}
*
* Known SQLite problems:
* - RIGHT and FULL OUTER JOIN unsupported.
* - Writing to VIEWs unsupported.
* - see http://www.sqlite.org/omitted.html for more.
*
* Known framework problems on SQLite
* - Full-text search extension fts3 not supported.
*
* @author alp
*/
public class SQLite implements Database {
private SQLiteSettingsImpl settings;
private DataTypeMapper typeMapper;
private QueryExecutionContainerImpl executer;
private SQLiteGrammar grammar;
public SQLite(String file){
setSettings(new SQLiteSettingsImpl(file));
typeMapper = new DataTypeMapperImpl();
executer = new QueryExecutionContainerImpl(getSettings());
grammar = new SQLiteGrammar();
}
private void setSettings(SQLiteSettingsImpl settings) {
this.settings = settings;
}
public SQLiteSettingsImpl getSettings() {
return settings;
}
@Override
public QueryExecutionContainer getExecuter() {
return executer;
}
@Override
public DataTypeMapper getTypeMapper() {
return typeMapper;
}
@Override
public void closeConnection() {
executer.close();
Log.info("Connection terminated successfully.");
}
@Override
public SQLGrammarProvider getSQLGrammar() {
return grammar;
}
}