|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.tmatesoft.sqljet.core.internal.table.SqlJetTable
public class SqlJetTable
Implementation of ISqlJetTable.
| Constructor Summary | |
|---|---|
SqlJetTable(SqlJetDb db,
ISqlJetBtree btree,
java.lang.String tableName,
boolean write)
|
|
| Method Summary | |
|---|---|
void |
clear()
Clear table. |
SqlJetDb |
getDataBase()
Get database connection. |
ISqlJetTableDef |
getDefinition()
Get table's schema definition. |
ISqlJetIndexDef |
getIndexDef(java.lang.String name)
Get definition of index by name. |
java.util.Set<ISqlJetIndexDef> |
getIndexesDefs()
Returns definitions of indices used in this table. |
java.util.Set<java.lang.String> |
getIndexesNames()
Get table indexes names. |
java.lang.String |
getPrimaryKeyIndexName()
Returns name of primary key index. |
long |
insert(java.lang.Object... values)
Add new record to the table with specified values. |
long |
insertByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values)
Insert record by values by names of fields. |
long |
insertByFieldNamesOr(SqlJetConflictAction onConflict,
java.util.Map<java.lang.String,java.lang.Object> values)
Insert record by values by names of fields. |
long |
insertOr(SqlJetConflictAction onConflict,
java.lang.Object... values)
Add new record to the table with specified values. |
long |
insertWithRowId(long rowId,
java.lang.Object... values)
Inserts record at specified rowId. |
long |
insertWithRowIdOr(SqlJetConflictAction onConflict,
long rowId,
java.lang.Object... values)
Inserts record at specified rowId. |
ISqlJetCursor |
lookup(java.lang.String indexName,
java.lang.Object... key)
Open cursor for records which have found by key on index. |
ISqlJetCursor |
open()
Open cursor for all table records. |
ISqlJetCursor |
order(java.lang.String indexName)
Open cursors which sorts table by index. |
ISqlJetCursor |
scope(java.lang.String indexName,
java.lang.Object[] firstKey,
java.lang.Object[] lastKey)
Open cursor which restricts table to some scope of index values. |
ISqlJetCursor |
scope(java.lang.String indexName,
SqlJetScope scope)
Open cursor which restricts table to some scope of index values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SqlJetTable(SqlJetDb db,
ISqlJetBtree btree,
java.lang.String tableName,
boolean write)
throws SqlJetException
SqlJetException| Method Detail |
|---|
public SqlJetDb getDataBase()
ISqlJetTable
getDataBase in interface ISqlJetTable
public java.lang.String getPrimaryKeyIndexName()
throws SqlJetException
ISqlJetTableISqlJetTable.lookup(String, Object...),
ISqlJetTable.scope(String, Object[], Object[]) or ISqlJetTable.order(String)
methods at first parameter.
getPrimaryKeyIndexName in interface ISqlJetTableSqlJetException
public ISqlJetTableDef getDefinition()
throws SqlJetException
ISqlJetTable
getDefinition in interface ISqlJetTableSqlJetException
public java.util.Set<ISqlJetIndexDef> getIndexesDefs()
throws SqlJetException
ISqlJetTable
getIndexesDefs in interface ISqlJetTableSqlJetException
public java.util.Set<java.lang.String> getIndexesNames()
throws SqlJetException
ISqlJetTable
getIndexesNames in interface ISqlJetTableSqlJetException
public ISqlJetIndexDef getIndexDef(java.lang.String name)
throws SqlJetException
ISqlJetTable
getIndexDef in interface ISqlJetTablename - name of index.
SqlJetException
public ISqlJetCursor open()
throws SqlJetException
ISqlJetTableOpen cursor for all table records.
Cursors can be opened only within active transaction. When transaction ends all cursors will be closed.
open in interface ISqlJetTableSqlJetException
public ISqlJetCursor lookup(java.lang.String indexName,
java.lang.Object... key)
throws SqlJetException
ISqlJetTableOpen cursor for records which have found by key on index.
If indexName is NULL then primary key will be used.
Cursors can be opened only within active transaction. When transaction ends all cursors will be closed.
lookup in interface ISqlJetTableindexName - Name of the searched index. If null then primary key will be
used.key - Key for the index lookup.
SqlJetException
public long insert(java.lang.Object... values)
throws SqlJetException
ISqlJetTableAdd new record to the table with specified values.
Values must be specified by position in table structure. If table have INTEGER PRIMARY KEY column then this column could be null and in this case it value will be defined automatically.
If field has DEFAULT value then it could be passed as null. If fields have DEFAULT value and are last in table structure then they could be not specified.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
insert in interface ISqlJetTablevalues - Values for the new record.
SqlJetException
public long insertByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values)
throws SqlJetException
ISqlJetTableInsert record by values by names of fields.
If table have INTEGER PRIMARY KEY column then this column could be null or even not specified and in this case it value will be defined automatically.
The ROWID of record could be passed by any of this names: ROWID, _ROWID_, OID. ROWID could be specified even if table haven't INTEGER PRIMARY KEY column.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
insertByFieldNames in interface ISqlJetTablevalues - map of field names with values.
SqlJetException
public long insertWithRowId(long rowId,
java.lang.Object... values)
throws SqlJetException
ISqlJetTableInserts record at specified rowId. If rowId is 0 then it generates new rowId.
If table has INTEGER PRIMARY KEY column and rowId isn't 0 then value for this field will be ignored and could be specified just as null. If table has INTEGER PRIMARY KEY column and rowId is 0 then value for this field used as rowId.
If field has DEFAULT value then it could be passed as null. If fields have DEFAULT value and are last in table structure then they could be not specified.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
insertWithRowId in interface ISqlJetTablerowId - ROWID of record.values - Values for the new record.
SqlJetException
public long insertOr(SqlJetConflictAction onConflict,
java.lang.Object... values)
throws SqlJetException
ISqlJetTableAdd new record to the table with specified values.
Values must be specified by position in table structure.
If table have INTEGER PRIMARY KEY column then this column could be null and in this case it value will be defined automatically.
If field has DEFAULT value then it could be passed as null. If fields have DEFAULT value and are last in table structure then they could be not specified.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
Implements ON CONFLICT clause. See SqlJetConflictAction.
insertOr in interface ISqlJetTableonConflict - SqlJetConflictAction.values - Values for the new record.
SqlJetException
public long insertByFieldNamesOr(SqlJetConflictAction onConflict,
java.util.Map<java.lang.String,java.lang.Object> values)
throws SqlJetException
ISqlJetTableInsert record by values by names of fields.
If table have INTEGER PRIMARY KEY column then this column could be null or even not specified and in this case it value will be defined automatically.
The ROWID of record could be passed by any of this names: ROWID, _ROWID_, OID. ROWID could be specified even if table haven't INTEGER PRIMARY KEY column.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
Implements ON CONFLICT clause. See SqlJetConflictAction.
insertByFieldNamesOr in interface ISqlJetTableonConflict - SqlJetConflictAction.values - Values for the new record.
SqlJetException
public long insertWithRowIdOr(SqlJetConflictAction onConflict,
long rowId,
java.lang.Object... values)
throws SqlJetException
ISqlJetTableInserts record at specified rowId.
If rowId is 0 then it generates new rowId.
If table has INTEGER PRIMARY KEY column and rowId isn't 0 then value for this field will be ignored and could be specified just as null. If table has INTEGER PRIMARY KEY column and rowId is 0 then value for this field used as rowId.
If field has DEFAULT value then it could be passed as null. If fields have DEFAULT value and are last in table structure then they could be not specified.
All relevant indexes are updated automatically.
Returns ROWID of inserted record.
Can be used without of active transaction, in this case method begins and ends own internal transaction.
Implements ON CONFLICT clause. See SqlJetConflictAction.
insertWithRowIdOr in interface ISqlJetTableonConflict - SqlJetConflictAction.rowId - ROWID of record.values - Values for the new record.
SqlJetException
public ISqlJetCursor order(java.lang.String indexName)
throws SqlJetException
ISqlJetTableOpen cursors which sorts table by index.
If indexName is NULL then primary key will be used.
Cursors can be opened only within active transaction. When transaction ends all cursors will be closed.
order in interface ISqlJetTableindexName - name of index which defines ordering.If null then primary key
will be used.
SqlJetException
public ISqlJetCursor scope(java.lang.String indexName,
java.lang.Object[] firstKey,
java.lang.Object[] lastKey)
throws SqlJetException
ISqlJetTableOpen cursor which restricts table to some scope of index values.
Scope is specified as pair of index keys. First key means start of scope and last key means end of scope. One of these keys (or even both) could be NULL. In this case scope is open from one side (or both sides). If first key is less of last key then cursor will be in reversed order. If indexName is NULL then primary key will be used.
Cursors can be opened only within active transaction. When transaction ends all cursors will be closed.
scope in interface ISqlJetTableindexName - Name of the searched index. If null then primary key will be
used.firstKey - first key of scope. Could be NULL.lastKey - first key of scope. Could be NULL.
SqlJetException
public ISqlJetCursor scope(java.lang.String indexName,
SqlJetScope scope)
throws SqlJetException
ISqlJetTableOpen cursor which restricts table to some scope of index values.
Scope is specified as pair of index keys. First key means start of scope and last key means end of scope. One of these keys (or even both) could be NULL. In this case scope is open from one side (or both sides). If first key is less of last key then cursor will be in reversed order. If indexName is NULL then primary key will be used.
Cursors can be opened only within active transaction. When transaction ends all cursors will be closed.
scope in interface ISqlJetTableindexName - Name of the searched index. If null then primary key will be
used.scope - structure that contains both left and right bounds of the requested scope.
SqlJetException
public void clear()
throws SqlJetException
ISqlJetTable
clear in interface ISqlJetTableSqlJetException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||