Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ba89a628
提交
ba89a628
authored
11月 27, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Android API support (work in progress).
上级
e98c67c8
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
1774 行增加
和
0 行删除
+1774
-0
H2AbortException.java
h2/src/tools/org/h2/android/H2AbortException.java
+22
-0
H2Closable.java
h2/src/tools/org/h2/android/H2Closable.java
+48
-0
H2ConstraintException.java
h2/src/tools/org/h2/android/H2ConstraintException.java
+22
-0
H2Cursor.java
h2/src/tools/org/h2/android/H2Cursor.java
+248
-0
H2CursorDriver.java
h2/src/tools/org/h2/android/H2CursorDriver.java
+48
-0
H2Database.java
h2/src/tools/org/h2/android/H2Database.java
+637
-0
H2DatabaseCorruptException.java
h2/src/tools/org/h2/android/H2DatabaseCorruptException.java
+16
-0
H2DiskIOException.java
h2/src/tools/org/h2/android/H2DiskIOException.java
+16
-0
H2DoneException.java
h2/src/tools/org/h2/android/H2DoneException.java
+18
-0
H2Exception.java
h2/src/tools/org/h2/android/H2Exception.java
+23
-0
H2FullException.java
h2/src/tools/org/h2/android/H2FullException.java
+21
-0
H2MisuseException.java
h2/src/tools/org/h2/android/H2MisuseException.java
+21
-0
H2OpenHelper.java
h2/src/tools/org/h2/android/H2OpenHelper.java
+79
-0
H2Program.java
h2/src/tools/org/h2/android/H2Program.java
+117
-0
H2Query.java
h2/src/tools/org/h2/android/H2Query.java
+65
-0
H2QueryBuilder.java
h2/src/tools/org/h2/android/H2QueryBuilder.java
+228
-0
H2Statement.java
h2/src/tools/org/h2/android/H2Statement.java
+77
-0
H2TransactionListener.java
h2/src/tools/org/h2/android/H2TransactionListener.java
+28
-0
H2Utils.java
h2/src/tools/org/h2/android/H2Utils.java
+25
-0
package.html
h2/src/tools/org/h2/android/package.html
+15
-0
没有找到文件。
h2/src/tools/org/h2/android/H2AbortException.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* This exception is thrown when the operation was aborted.
*/
public
class
H2AbortException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2AbortException
()
{
super
();
}
H2AbortException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2Closable.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
android.database.sqlite.SQLiteClosable
;
/**
* An object that can be closed.
*/
public
abstract
class
H2Closable
extends
SQLiteClosable
{
/**
* TODO
*/
public
void
acquireReference
()
{
// TODO
}
/**
* TODO
*/
public
void
releaseReference
()
{
// TODO
}
/**
* TODO
*/
public
void
releaseReferenceFromContainer
()
{
// TODO
}
/**
* TODO
*/
protected
abstract
void
onAllReferencesReleased
();
/**
* TODO
*/
protected
void
onAllReferencesReleasedFromContainer
()
{
// TODO
}
}
h2/src/tools/org/h2/android/H2ConstraintException.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* This exception is thrown when a constraint was violated.
*/
public
class
H2ConstraintException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2ConstraintException
()
{
super
();
}
H2ConstraintException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2Cursor.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
android.content.ContentResolver
;
import
android.database.AbstractWindowedCursor
;
import
android.database.CharArrayBuffer
;
import
android.database.ContentObserver
;
import
android.database.CursorWindow
;
import
android.database.DataSetObserver
;
import
android.net.Uri
;
import
android.os.Bundle
;
/**
* A cursor implementation.
*/
public
class
H2Cursor
extends
AbstractWindowedCursor
{
private
H2Database
database
;
H2Cursor
(
H2Database
db
,
H2CursorDriver
driver
,
String
editTable
,
H2Query
query
)
{
// TODO
}
public
void
close
()
{
// TODO
}
public
void
deactivate
()
{
// TODO
}
public
int
getColumnIndex
(
String
columnName
)
{
return
0
;
}
public
String
[]
getColumnNames
()
{
return
null
;
}
public
int
getCount
()
{
return
0
;
}
/**
* Get the database that created this cursor.
*
* @return the database
*/
public
H2Database
getDatabase
()
{
return
database
;
}
/**
* The cursor moved to a new position.
*
* @param oldPosition the previous position
* @param newPosition the new position
* @return TODO
*/
public
boolean
onMove
(
int
oldPosition
,
int
newPosition
)
{
return
false
;
}
public
void
registerDataSetObserver
(
DataSetObserver
observer
)
{
// TODO
}
public
boolean
requery
()
{
return
false
;
}
/**
* Set the parameter values.
*
* @param selectionArgs the parameter values
*/
public
void
setSelectionArguments
(
String
[]
selectionArgs
)
{
// TODO
}
/**
* TODO
*
* @param window the window
*/
public
void
setWindow
(
CursorWindow
window
)
{
// TODO
}
public
boolean
move
(
int
offset
)
{
return
false
;
}
public
void
copyStringToBuffer
(
int
columnIndex
,
CharArrayBuffer
buffer
)
{
// TODO
}
public
byte
[]
getBlob
(
int
columnIndex
)
{
// TODO
return
null
;
}
public
int
getColumnCount
()
{
// TODO
return
0
;
}
public
int
getColumnIndexOrThrow
(
String
columnName
)
{
// TODO
return
0
;
}
public
String
getColumnName
(
int
columnIndex
)
{
// TODO
return
null
;
}
public
double
getDouble
(
int
columnIndex
)
{
// TODO
return
0
;
}
public
Bundle
getExtras
()
{
// TODO
return
null
;
}
public
float
getFloat
(
int
columnIndex
)
{
// TODO
return
0
;
}
public
int
getInt
(
int
columnIndex
)
{
// TODO
return
0
;
}
public
long
getLong
(
int
columnIndex
)
{
// TODO
return
0
;
}
public
int
getPosition
()
{
// TODO
return
0
;
}
public
short
getShort
(
int
columnIndex
)
{
// TODO
return
0
;
}
public
String
getString
(
int
columnIndex
)
{
// TODO
return
null
;
}
public
boolean
getWantsAllOnMoveCalls
()
{
// TODO
return
false
;
}
public
boolean
isAfterLast
()
{
// TODO
return
false
;
}
public
boolean
isBeforeFirst
()
{
// TODO
return
false
;
}
public
boolean
isClosed
()
{
// TODO
return
false
;
}
public
boolean
isFirst
()
{
// TODO
return
false
;
}
public
boolean
isLast
()
{
// TODO
return
false
;
}
public
boolean
isNull
(
int
columnIndex
)
{
// TODO
return
false
;
}
public
boolean
moveToFirst
()
{
// TODO
return
false
;
}
public
boolean
moveToLast
()
{
// TODO
return
false
;
}
public
boolean
moveToNext
()
{
// TODO
return
false
;
}
public
boolean
moveToPosition
(
int
position
)
{
// TODO
return
false
;
}
public
boolean
moveToPrevious
()
{
// TODO
return
false
;
}
public
void
registerContentObserver
(
ContentObserver
observer
)
{
// TODO
}
public
Bundle
respond
(
Bundle
extras
)
{
// TODO
return
null
;
}
public
void
setNotificationUri
(
ContentResolver
cr
,
Uri
uri
)
{
// TODO
}
public
void
unregisterContentObserver
(
ContentObserver
observer
)
{
// TODO
}
public
void
unregisterDataSetObserver
(
DataSetObserver
observer
)
{
// TODO
}
}
h2/src/tools/org/h2/android/H2CursorDriver.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
android.database.Cursor
;
/**
* A factory and event listener for cursors.
*/
public
interface
H2CursorDriver
{
/**
* The cursor was closed.
*/
void
cursorClosed
();
/**
* The cursor was deactivated.
*/
void
cursorDeactivated
();
/**
* The query was re-run.
*
* @param cursor the old cursor
*/
void
cursorRequeried
(
Cursor
cursor
);
/**
* Execute the query.
*
* @param factory the cursor factory
* @param bindArgs the parameter values
* @return the cursor
*/
Cursor
query
(
H2Database
.
CursorFactory
factory
,
String
[]
bindArgs
);
/**
* Set the parameter values.
*
* @param bindArgs the parameter values.
*/
void
setBindArguments
(
String
[]
bindArgs
);
}
h2/src/tools/org/h2/android/H2Database.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
java.io.File
;
import
java.util.Locale
;
import
java.util.Map
;
import
org.h2.engine.ConnectionInfo
;
import
org.h2.engine.Engine
;
import
org.h2.engine.Session
;
import
android.content.ContentValues
;
import
android.database.Cursor
;
/**
* This class represents a database connection.
*/
public
class
H2Database
{
/**
* When a conflict occurs, abort the current statement, but don't roll back
* the transaction. This is the default value.
*/
public
static
final
int
CONFLICT_ABORT
=
2
;
/**
* When a conflict occurs, return SQLITE_CONSTRAINT, but don't roll back the
* transaction.
*/
public
static
final
int
CONFLICT_FAIL
=
3
;
/**
* When a conflict occurs, continue, but don't modify the conflicting row.
*/
public
static
final
int
CONFLICT_IGNORE
=
4
;
/**
* When a conflict occurs, do nothing.
*/
public
static
final
int
CONFLICT_NONE
=
0
;
/**
* When a conflict occurs, the existing rows are replaced.
*/
public
static
final
int
CONFLICT_REPLACE
=
5
;
/**
* When a conflict occurs, the transaction is rolled back.
*/
public
static
final
int
CONFLICT_ROLLBACK
=
1
;
/**
* Create a new database if it doesn't exist.
*/
public
static
final
int
CREATE_IF_NECESSARY
=
0x10000000
;
/**
* This flag has no effect.
*/
public
static
final
int
NO_LOCALIZED_COLLATORS
=
0x10
;
/**
* Open the database in read-only mode.
*/
public
static
final
int
OPEN_READONLY
=
1
;
/**
* Open the database in read-write mode (default).
*/
public
static
final
int
OPEN_READWRITE
=
0
;
private
final
Session
session
;
private
H2Database
(
Session
session
)
{
this
.
session
=
session
;
}
/**
* Create a new in-memory database.
*
* @param factory the cursor factory
* @return a connection to this database
*/
public
static
H2Database
create
(
H2Database
.
CursorFactory
factory
)
{
ConnectionInfo
ci
=
new
ConnectionInfo
(
"mem:"
);
Session
s
=
Engine
.
getInstance
().
createSession
(
ci
);
return
new
H2Database
(
s
);
}
/**
* Open a connection to the given database.
*
* @param path the database file name
* @param factory the cursor factory
* @param flags 0, or a combination of OPEN_READONLY and CREATE_IF_NECESSARY
* @return a connection to this database
*/
public
static
H2Database
openDatabase
(
String
path
,
H2Database
.
CursorFactory
factory
,
int
flags
)
{
ConnectionInfo
ci
=
new
ConnectionInfo
(
path
);
if
((
flags
&
OPEN_READWRITE
)
!=
0
)
{
// TODO readonly connections
}
if
((
flags
&
CREATE_IF_NECESSARY
)
==
0
)
{
ci
.
setProperty
(
"IFEXISTS"
,
"TRUE"
);
}
Session
s
=
Engine
.
getInstance
().
createSession
(
ci
);
return
new
H2Database
(
s
);
}
/**
* Open a connection to the given database. The database is created if it
* doesn't exist yet.
*
* @param file the database file
* @param factory the cursor factory
* @return a connection to this database
*/
public
static
H2Database
openOrCreateDatabase
(
File
file
,
H2Database
.
CursorFactory
factory
)
{
return
openDatabase
(
file
.
getPath
(),
factory
,
CREATE_IF_NECESSARY
);
}
/**
* Open a connection to the given database. The database is created if it
* doesn't exist yet.
*
* @param path the database file name
* @param factory the cursor factory
* @return a connection to this database
*/
public
static
H2Database
openOrCreateDatabase
(
String
path
,
H2Database
.
CursorFactory
factory
)
{
return
openDatabase
(
path
,
factory
,
CREATE_IF_NECESSARY
);
}
/**
* Start a transaction.
*/
public
void
beginTransaction
()
{
session
.
setAutoCommit
(
false
);
}
/**
* Start a transaction.
*
* @param transactionListener the transaction listener to use
*/
public
void
beginTransactionWithListener
(
H2TransactionListener
transactionListener
)
{
// TODO H2TransactionListener
session
.
setAutoCommit
(
false
);
}
/**
* Close the connection.
*/
public
void
close
()
{
session
.
close
();
}
/**
* Prepare a statement.
*
* @param sql the statement
* @return the prepared statement
*/
public
H2Statement
compileStatement
(
String
sql
)
{
return
new
H2Statement
(
session
.
prepare
(
sql
));
}
/**
* Delete a number of rows in this database.
*
* @param table the table
* @param whereClause the condition
* @param whereArgs the parameter values
* @return the number of rows deleted
*/
public
int
delete
(
String
table
,
String
whereClause
,
String
[]
whereArgs
)
{
return
0
;
}
/**
* End the transaction.
*/
public
void
endTransaction
()
{
// TODO
}
/**
* Execute the given statement.
*
* @param sql the statement
* @param bindArgs the parameter values
*/
public
void
execSQL
(
String
sql
,
Object
[]
bindArgs
)
{
// TODO
}
/**
* Execute the given statement.
*
* @param sql the statement
*/
public
void
execSQL
(
String
sql
)
{
// TODO
}
/**
* TODO
*
* @param tables the list of tables
* @return TODO
*/
public
static
String
findEditTable
(
String
tables
)
{
// TODO
return
null
;
}
/**
* Get the maximum size of the database file in bytes.
*
* @return the maximum size
*/
public
long
getMaximumSize
()
{
return
Long
.
MAX_VALUE
;
}
/**
* Get the page size of the database in bytes.
*
* @return the page size
*/
public
long
getPageSize
()
{
return
0
;
}
/**
* Get the name of the database file.
*
* @return the database file name
*/
public
String
getPath
()
{
return
null
;
}
/**
* TODO
*
* @return TODO
*/
public
Map
<
String
,
String
>
getSyncedTables
()
{
return
null
;
}
/**
* Get the database version.
*
* @return the database version
*/
public
int
getVersion
()
{
return
0
;
}
/**
* Check if there is an open transaction.
*
* @return true if there is
*/
public
boolean
inTransaction
()
{
return
false
;
}
/**
* Insert a row.
*
* @param table the table
* @param nullColumnHack not used
* @param values the values
* @return TODO
*/
public
long
insert
(
String
table
,
String
nullColumnHack
,
ContentValues
values
)
{
return
0
;
}
/**
* Try to insert a row.
*
* @param table the table
* @param nullColumnHack not used
* @param values the values
* @return TODO
*/
public
long
insertOrThrow
(
String
table
,
String
nullColumnHack
,
ContentValues
values
)
{
return
0
;
}
/**
* Try to insert a row, using the given conflict resolution option.
*
* @param table the table
* @param nullColumnHack not used
* @param initialValues the values
* @param conflictAlgorithm what conflict resolution to use
* @return TODO
*/
public
long
insertWithOnConflict
(
String
table
,
String
nullColumnHack
,
ContentValues
initialValues
,
int
conflictAlgorithm
)
{
return
0
;
}
/**
* Check if the database is locked by the current thread.
*
* @return true if it is
*/
public
boolean
isDbLockedByCurrentThread
()
{
return
false
;
}
/**
* Check if the database is locked by a different thread.
*
* @return true if it is
*/
public
boolean
isDbLockedByOtherThreads
()
{
return
false
;
}
/**
* Check if the connection is open.
*
* @return true if it is
*/
public
boolean
isOpen
()
{
return
false
;
}
/**
* Check if the connection is read-only.
*
* @return true if it is
*/
public
boolean
isReadOnly
()
{
return
false
;
}
/**
* TODO
*
* @param table the table
* @param deletedTable TODO
*/
public
void
markTableSyncable
(
String
table
,
String
deletedTable
)
{
// TODO
}
/**
* TODO
*
* @param table the table
* @param foreignKey the foreign key
* @param updateTable TODO
*/
public
void
markTableSyncable
(
String
table
,
String
foreignKey
,
String
updateTable
)
{
// TODO
}
/**
* Check if an upgrade is required.
*
* @param newVersion the new version
* @return true if the current version doesn't match
*/
public
boolean
needUpgrade
(
int
newVersion
)
{
return
false
;
}
/**
* Execute the SELECT statement for the given parameters.
*
* @param distinct if only distinct rows should be returned
* @param table the table
* @param columns the list of columns
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the cursor
*/
public
Cursor
query
(
boolean
distinct
,
String
table
,
String
[]
columns
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Execute the SELECT statement for the given parameters.
*
* @param table the table
* @param columns the list of columns
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @return the cursor
*/
public
Cursor
query
(
String
table
,
String
[]
columns
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
)
{
return
null
;
}
/**
* Execute the SELECT statement for the given parameters.
*
* @param table the table
* @param columns the list of columns
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the cursor
*/
public
Cursor
query
(
String
table
,
String
[]
columns
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Execute the SELECT statement for the given parameters.
*
* @param cursorFactory the cursor factory to use
* @param distinct if only distinct rows should be returned
* @param table the table
* @param columns the list of columns
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the cursor
*/
public
Cursor
queryWithFactory
(
H2Database
.
CursorFactory
cursorFactory
,
boolean
distinct
,
String
table
,
String
[]
columns
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Execute the query.
*
* @param sql the SQL statement
* @param selectionArgs the parameter values
* @return the cursor
*/
public
Cursor
rawQuery
(
String
sql
,
String
[]
selectionArgs
)
{
return
null
;
}
/**
* Execute the query using the given cursor factory.
*
* @param cursorFactory the cursor factory
* @param sql the SQL statement
* @param selectionArgs the parameter values
* @param editTable TODO
* @return the cursor
*/
public
Cursor
rawQueryWithFactory
(
H2Database
.
CursorFactory
cursorFactory
,
String
sql
,
String
[]
selectionArgs
,
String
editTable
)
{
return
null
;
}
/**
* Try to release memory.
*
* @return TODO
*/
public
static
int
releaseMemory
()
{
return
0
;
}
/**
* Replace an existing row in the database.
*
* @param table the table
* @param nullColumnHack ignored
* @param initialValues the values
* @return TODO
*/
public
long
replace
(
String
table
,
String
nullColumnHack
,
ContentValues
initialValues
)
{
return
0
;
}
/**
* Try to replace an existing row in the database.
*
* @param table the table
* @param nullColumnHack ignored
* @param initialValues the values
* @return TODO
*/
public
long
replaceOrThrow
(
String
table
,
String
nullColumnHack
,
ContentValues
initialValues
)
{
return
0
;
}
/**
* Set the locale.
*
* @param locale the new locale
*/
public
void
setLocale
(
Locale
locale
)
{
// TODO
}
/**
* Enable or disable thread safety.
*
* @param lockingEnabled the new value
*/
public
void
setLockingEnabled
(
boolean
lockingEnabled
)
{
// TODO
}
/**
* Set the maximum database file size.
*
* @param numBytes the file size in bytes
* @return the effective maximum size
*/
public
long
setMaximumSize
(
long
numBytes
)
{
return
0
;
}
/**
* Set the database page size. The value can not be changed once the
* database exists.
*
* @param numBytes the page size
*/
public
void
setPageSize
(
long
numBytes
)
{
// TODO
}
/**
* Mark the transaction as completed successfully.
*/
public
void
setTransactionSuccessful
()
{
// TODO
}
/**
* Update the database version.
*
* @param version the version
*/
public
void
setVersion
(
int
version
)
{
// TODO
}
/**
* Update one or multiple rows.
*
* @param table the table
* @param values the values
* @param whereClause the where condition
* @param whereArgs the parameter values
* @return the number of rows updated
*/
public
int
update
(
String
table
,
ContentValues
values
,
String
whereClause
,
String
[]
whereArgs
)
{
return
0
;
}
/**
* Update one or multiple rows.
*
* @param table the table
* @param values the values
* @param whereClause the where condition
* @param whereArgs the parameter values
* @param conflictAlgorithm the conflict resolution option
* @return the number of rows updated
*/
public
int
updateWithOnConflict
(
String
table
,
ContentValues
values
,
String
whereClause
,
String
[]
whereArgs
,
int
conflictAlgorithm
)
{
return
0
;
}
/**
* TODO
*
* @deprecated
* @return TODO
*/
public
boolean
yieldIfContended
()
{
return
false
;
}
/**
* Temporarily pause the transaction.
*
* @param sleepAfterYieldDelay TODO
* @return TODO
*/
public
boolean
yieldIfContendedSafely
(
long
sleepAfterYieldDelay
)
{
return
false
;
}
/**
* Temporarily pause the transaction.
*
* @return TODO
*/
public
boolean
yieldIfContendedSafely
()
{
return
false
;
}
/**
* The cursor factory.
*/
public
interface
CursorFactory
{
/**
* Create a new cursor.
*
* @param db the connection
* @param masterQuery TODO
* @param editTable TODO
* @param query TODO
* @return the cursor
*/
Cursor
newCursor
(
H2Database
db
,
H2CursorDriver
masterQuery
,
String
editTable
,
H2Query
query
);
}
}
h2/src/tools/org/h2/android/H2DatabaseCorruptException.java
0 → 100644
浏览文件 @
ba89a628
package
org
.
h2
.
android
;
/**
* This exception is thrown when the database file is corrupt.
*/
public
class
H2DatabaseCorruptException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2DatabaseCorruptException
()
{
super
();
}
H2DatabaseCorruptException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2DiskIOException.java
0 → 100644
浏览文件 @
ba89a628
package
org
.
h2
.
android
;
/**
* This exception is thrown when there was a IO exception.
*/
public
class
H2DiskIOException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2DiskIOException
()
{
super
();
}
H2DiskIOException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2DoneException.java
0 → 100644
浏览文件 @
ba89a628
package
org
.
h2
.
android
;
/**
* This exception is thrown the requested data is not available, for example
* when calling simpleQueryForString() or simpleQueryForLong() for a statement
* that doesn't return a value.
*/
public
class
H2DoneException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2DoneException
()
{
super
();
}
H2DoneException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2Exception.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
android.database.SQLException
;
/**
* This exception is thrown when there is a syntax error or similar problem.
*/
public
class
H2Exception
extends
SQLException
{
private
static
final
long
serialVersionUID
=
1L
;
public
H2Exception
()
{
super
();
}
public
H2Exception
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2FullException.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* This exception is thrown when the database file is full and can't grow.
*/
public
class
H2FullException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2FullException
()
{
super
();
}
H2FullException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2MisuseException.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* TODO
*/
public
class
H2MisuseException
extends
H2Exception
{
private
static
final
long
serialVersionUID
=
1L
;
H2MisuseException
()
{
super
();
}
H2MisuseException
(
String
error
)
{
super
(
error
);
}
}
h2/src/tools/org/h2/android/H2OpenHelper.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
android.content.Context
;
/**
* This helper class helps creating and managing databases. A subclass typically
* implements the "on" methods.
*/
public
abstract
class
H2OpenHelper
{
/**
* Construct a new instance.
*
* @param context the context to use
* @param name the name of the database (use null for an in-memory database)
* @param factory the cursor factory to use
* @param version the expected database version
*/
H2OpenHelper
(
Context
context
,
String
name
,
H2Database
.
CursorFactory
factory
,
int
version
)
{
// TODO
}
/**
* Close the connection.
*/
public
synchronized
void
close
()
{
// TODO
}
/**
* Open a read-only connection.
*
* @return a new read-only connection
*/
public
synchronized
H2Database
getReadableDatabase
()
{
return
null
;
}
/**
* Open a read-write connection.
*
* @return a new read-write connection
*/
public
synchronized
H2Database
getWritableDatabase
()
{
return
null
;
}
/**
* This method is called when the database did not already exist.
*
* @param db the connection
*/
public
abstract
void
onCreate
(
H2Database
db
);
/**
* This method is called after opening the database.
*
* @param db the connection
*/
public
void
onOpen
(
H2Database
db
)
{
// TODO
}
/**
* This method is called when the version stored in the database file does
* not match the expected value.
*
* @param db the connection
* @param oldVersion the current version
* @param newVersion the expected version
*/
public
abstract
void
onUpgrade
(
H2Database
db
,
int
oldVersion
,
int
newVersion
);
}
h2/src/tools/org/h2/android/H2Program.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
org.h2.command.Prepared
;
import
org.h2.expression.Parameter
;
import
org.h2.value.ValueBytes
;
/**
* This class represents a prepared statement.
*/
public
class
H2Program
extends
H2Closable
{
/**
* The prepared statement
*/
protected
final
Prepared
prepared
;
H2Program
(
Prepared
prepared
)
{
this
.
prepared
=
prepared
;
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindBlob
(
int
index
,
byte
[]
value
)
{
getParameter
(
index
).
setValue
(
ValueBytes
.
get
(
value
));
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindDouble
(
int
index
,
double
value
)
{
// TODO
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindLong
(
int
index
,
long
value
)
{
// TODO
}
/**
* Set the specified parameter to NULL.
*
* @param index the parameter index (0, 1,...)
*/
public
void
bindNull
(
int
index
)
{
// TODO
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindString
(
int
index
,
String
value
)
{
// TODO
}
/**
* Reset all parameter values.
*/
public
void
clearBindings
()
{
// TODO
}
/**
* Close the statement.
*/
public
void
close
()
{
// TODO
}
/**
* Get the unique id of this statement.
*
* @return the id
*/
public
final
int
getUniqueId
()
{
return
0
;
}
/**
* TODO
*/
protected
void
onAllReferencesReleased
()
{
// TODO
}
/**
* TODO
*/
protected
void
onAllReferencesReleasedFromContainer
()
{
// TODO
}
private
Parameter
getParameter
(
int
index
)
{
return
prepared
.
getParameters
().
get
(
index
);
}
}
h2/src/tools/org/h2/android/H2Query.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
org.h2.command.Prepared
;
/**
* This class represents a prepared statement that returns a result set.
*/
public
class
H2Query
extends
H2Program
{
H2Query
(
Prepared
prepared
)
{
super
(
prepared
);
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindDouble
(
int
index
,
double
value
)
{
// TODO
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindLong
(
int
index
,
long
value
)
{
// TODO
}
/**
* Set the specified parameter to NULL.
*
* @param index the parameter index (0, 1,...)
*/
public
void
bindNull
(
int
index
)
{
// TODO
}
/**
* Set the specified parameter value.
*
* @param index the parameter index (0, 1,...)
* @param value the new value
*/
public
void
bindString
(
int
index
,
String
value
)
{
// TODO
}
/**
* Close the statement.
*/
public
void
close
()
{
// TODO
}
}
h2/src/tools/org/h2/android/H2QueryBuilder.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
java.util.Map
;
import
java.util.Set
;
import
org.h2.util.StringUtils
;
import
android.database.Cursor
;
/**
* This helper class is used to build SQL statements.
*/
public
class
H2QueryBuilder
{
private
H2Database
.
CursorFactory
factory
;
private
boolean
distinct
;
private
String
tables
;
private
Map
<
String
,
String
>
columnMap
;
/**
* Append the column to the string builder. The columns are separated by
* comma.
*
* @param s the target string builder
* @param columns the columns
*/
static
void
appendColumns
(
StringBuilder
s
,
String
[]
columns
)
{
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
if
(
i
>
0
)
{
s
.
append
(
", "
);
}
s
.
append
(
StringUtils
.
quoteIdentifier
(
columns
[
i
]));
}
}
/**
* Return the SELECT statement for the given parameters.
*
* @param distinct if only distinct rows should be returned
* @param tables the list of tables
* @param columns the list of columns
* @param where the where condition or null
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the query
*/
static
String
buildQueryString
(
boolean
distinct
,
String
tables
,
String
[]
columns
,
String
where
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
StringBuilder
s
=
new
StringBuilder
();
s
.
append
(
"select "
);
if
(
distinct
)
{
s
.
append
(
"distinct "
);
}
appendColumns
(
s
,
columns
);
s
.
append
(
" from "
).
append
(
tables
);
if
(
where
!=
null
)
{
s
.
append
(
" where "
).
append
(
where
);
}
if
(
groupBy
!=
null
)
{
s
.
append
(
" group by "
).
append
(
groupBy
);
}
if
(
having
!=
null
)
{
s
.
append
(
" having "
).
append
(
having
);
}
if
(
orderBy
!=
null
)
{
s
.
append
(
" order by "
).
append
(
groupBy
);
}
if
(
limit
!=
null
)
{
s
.
append
(
" limit "
).
append
(
limit
);
}
return
s
.
toString
();
}
/**
* Append the text to the where clause.
*
* @param inWhere the text to append
*/
void
appendWhere
(
CharSequence
inWhere
)
{
// TODO
}
/**
* Append the text to the where clause. The text is escaped.
*
* @param inWhere the text to append
*/
void
appendWhereEscapeString
(
String
inWhere
)
{
// TODO how to escape
}
/**
* Return the SELECT UNION statement for the given parameters.
*
* @param projectionIn TODO
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the query
*/
String
buildQuery
(
String
[]
projectionIn
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Return the SELECT UNION statement for the given parameters.
*
* @param subQueries TODO
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the query
*/
String
buildUnionQuery
(
String
[]
subQueries
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Return the SELECT UNION statement for the given parameters.
*
* @param typeDiscriminatorColumn TODO
* @param unionColumns TODO
* @param columnsPresentInTable TODO
* @param computedColumnsOffset TODO
* @param typeDiscriminatorValue TODO
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @return the query
*/
String
buildUnionSubQuery
(
String
typeDiscriminatorColumn
,
String
[]
unionColumns
,
Set
<
String
>
columnsPresentInTable
,
int
computedColumnsOffset
,
String
typeDiscriminatorValue
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
)
{
return
null
;
}
/**
* Get the list of tables.
*
* @return the list of tables
*/
String
getTables
()
{
return
tables
;
}
/**
* Run the query for the given parameters.
*
* @param db the connection
* @param projectionIn TODO
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @return the cursor
*/
Cursor
query
(
H2Database
db
,
String
[]
projectionIn
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
)
{
return
null
;
}
/**
* Run the query for the given parameters.
*
* @param db the connection
* @param projectionIn TODO
* @param selection TODO
* @param selectionArgs TODO
* @param groupBy the group by list or null
* @param having the having condition or null
* @param orderBy the order by list or null
* @param limit the limit or null
* @return the cursor
*/
Cursor
query
(
H2Database
db
,
String
[]
projectionIn
,
String
selection
,
String
[]
selectionArgs
,
String
groupBy
,
String
having
,
String
orderBy
,
String
limit
)
{
return
null
;
}
/**
* Set the cursor factory.
*
* @param factory the new value
*/
void
setCursorFactory
(
H2Database
.
CursorFactory
factory
)
{
this
.
factory
=
factory
;
}
/**
* Enable or disable the DISTINCT flag.
*
* @param distinct the new value
*/
void
setDistinct
(
boolean
distinct
)
{
this
.
distinct
=
distinct
;
}
/**
* TODO
*
* @param columnMap TODO
*/
void
setProjectionMap
(
Map
<
String
,
String
>
columnMap
)
{
this
.
columnMap
=
columnMap
;
}
/**
* Set the list of tables.
*
* @param inTables the list of tables
*/
void
setTables
(
String
inTables
)
{
this
.
tables
=
inTables
;
}
}
h2/src/tools/org/h2/android/H2Statement.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
import
org.h2.command.Prepared
;
import
org.h2.result.ResultInterface
;
import
org.h2.value.Value
;
import
org.h2.value.ValueNull
;
/**
* Represents a prepared statement.
*/
public
class
H2Statement
extends
H2Program
{
H2Statement
(
Prepared
prepared
)
{
super
(
prepared
);
}
/**
* Execute the statement.
*/
public
void
execute
()
{
if
(
prepared
.
isQuery
())
{
prepared
.
query
(
0
);
}
else
{
prepared
.
update
();
}
}
/**
* Execute the insert statement and return the id of the inserted row.
*
* @return the id of the inserted row
*/
public
long
executeInsert
()
{
return
prepared
.
update
();
}
/**
* Execute the query and return the value of the first column and row as a
* long.
*
* @return the value
*/
public
long
simpleQueryForLong
()
{
return
simpleQuery
().
getLong
();
}
/**
* Execute the query and return the value of the first column and row as a
* string.
*
* @return the value
*/
public
String
simpleQueryForString
()
{
return
simpleQuery
().
getString
();
}
private
Value
simpleQuery
()
{
ResultInterface
result
=
prepared
.
query
(
1
);
try
{
if
(
result
.
next
())
{
Value
[]
row
=
result
.
currentRow
();
if
(
row
.
length
>
0
)
{
return
row
[
0
];
}
}
}
finally
{
result
.
close
();
}
return
ValueNull
.
INSTANCE
;
}
}
h2/src/tools/org/h2/android/H2TransactionListener.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* A class that implements this interface can listen to transaction begin and
* end events.
*/
public
interface
H2TransactionListener
{
/**
* The transaction has been started.
*/
void
onBegin
();
/**
* The transaction will be committed.
*/
void
onCommit
();
/**
* The transaction will be rolled back.
*/
void
onRollback
();
}
h2/src/tools/org/h2/android/H2Utils.java
0 → 100644
浏览文件 @
ba89a628
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version
* 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package
org
.
h2
.
android
;
/**
* Utility methods.
*/
public
class
H2Utils
{
/**
* A replacement for Context.openOrCreateDatabase.
*
* @param name the database name
* @param mode the access mode
* @param factory the cursor factory to use
* @return the database connection
*/
public
static
H2Database
openOrCreateDatabase
(
String
name
,
int
mode
,
H2Database
.
CursorFactory
factory
)
{
return
null
;
}
}
h2/src/tools/org/h2/android/package.html
0 → 100644
浏览文件 @
ba89a628
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html
xmlns=
"http://www.w3.org/1999/xhtml"
lang=
"en"
xml:lang=
"en"
>
<head><meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/><title>
Javadoc package documentation
</title></head><body
style=
"font: 9pt/130% Tahoma, Arial, Helvetica, sans-serif; font-weight: normal;"
><p>
This package contains the H2 Android database API.
</p></body></html>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论