Sleuth Kit Java Bindings (JNI)  4.11.0
Java bindings for using The Sleuth Kit
org.sleuthkit.datamodel.CaseDbAccessManager Class Reference

Classes

interface  CaseDbAccessQueryCallback
 

Public Member Functions

void alterTable (final String tableName, final String alterSQL) throws TskCoreException
 
void alterTable (final String tableName, final String alterSQL, final CaseDbTransaction transaction) throws TskCoreException
 
boolean columnExists (String tableName, String columnName) throws TskCoreException
 
boolean columnExists (String tableName, String columnName, CaseDbTransaction transaction) throws TskCoreException
 
void createIndex (final String indexName, final String tableName, final String colsSQL) throws TskCoreException
 
void createTable (final String tableName, final String tableSchema) throws TskCoreException
 
void delete (final String tableName, final String sql) throws TskCoreException
 
long insert (final String tableName, final String sql) throws TskCoreException
 
long insert (final String tableName, final String sql, final CaseDbTransaction transaction) throws TskCoreException
 
long insertOrUpdate (final String tableName, final String sql) throws TskCoreException
 
long insertOrUpdate (final String tableName, final String sql, final CaseDbTransaction transaction) throws TskCoreException
 
void select (final String sql, final CaseDbAccessQueryCallback queryCallback) throws TskCoreException
 
boolean tableExists (String tableName) throws TskCoreException
 
boolean tableExists (String tableName, CaseDbTransaction transaction) throws TskCoreException
 
void update (final String tableName, final String sql) throws TskCoreException
 
void update (final String tableName, final String sql, CaseDbTransaction transaction) throws TskCoreException
 

Detailed Description

This class provides modules with access to the case database to create custom tables/indexes and to query them.

Definition at line 37 of file CaseDbAccessManager.java.

Member Function Documentation

void org.sleuthkit.datamodel.CaseDbAccessManager.alterTable ( final String  tableName,
final String  alterSQL 
) throws TskCoreException

Alters a table with the specified name.

Parameters
tableNamename of the table to alter
alterSQLSQL to alter the table
Exceptions
TskCoreException

Definition at line 271 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

void org.sleuthkit.datamodel.CaseDbAccessManager.alterTable ( final String  tableName,
final String  alterSQL,
final CaseDbTransaction  transaction 
) throws TskCoreException

Alters a table with the specified name.

Parameters
tableNamename of the table to alter
alterSQLSQL to alter the table
transactiontransaction
Exceptions
TskCoreException

Definition at line 298 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.getDatabaseType(), and org.sleuthkit.datamodel.TskData.DbType.SQLITE.

boolean org.sleuthkit.datamodel.CaseDbAccessManager.columnExists ( String  tableName,
String  columnName 
) throws TskCoreException

Checks if a column exists in a table.

Parameters
tableNamename of the table
columnNamecolumn name to check
Returns
true if the column already exists, false otherwise
Exceptions
TskCoreException

Definition at line 80 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

Referenced by org.sleuthkit.datamodel.CaseDbAccessManager.columnExists().

boolean org.sleuthkit.datamodel.CaseDbAccessManager.columnExists ( String  tableName,
String  columnName,
CaseDbTransaction  transaction 
) throws TskCoreException

Checks if a column exists in a table.

Parameters
tableNamename of the table
columnNamecolumn name to check
transactiontransaction
Returns
true if the column already exists, false otherwise
Exceptions
TskCoreException

Definition at line 112 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.CaseDbAccessManager.columnExists(), org.sleuthkit.datamodel.SleuthkitCase.getDatabaseType(), and org.sleuthkit.datamodel.TskData.DbType.SQLITE.

void org.sleuthkit.datamodel.CaseDbAccessManager.createIndex ( final String  indexName,
final String  tableName,
final String  colsSQL 
) throws TskCoreException

Creates an index on the specified table, on specified column(s).

If the index already exists, it does nothing, and no error is generated.

It is recommended that clients of the API use module specific prefixes to prevent name collisions.

Parameters
indexNamename of index to create
tableNamename of table to create the index on
colsSQL- columns on which to index
Exceptions
TskCoreException

Definition at line 341 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.acquireSingleUserCaseWriteLock(), and org.sleuthkit.datamodel.SleuthkitCase.releaseSingleUserCaseWriteLock().

void org.sleuthkit.datamodel.CaseDbAccessManager.createTable ( final String  tableName,
final String  tableSchema 
) throws TskCoreException

Creates a table with the specified name and schema.

If the table already exists, it does nothing, and no error is generated

It is recommended that clients of the API use module specific prefixes to prevent name collisions.

Parameters
tableNamename of the table to create
tableSchematable schema
Exceptions
TskCoreException

Definition at line 246 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.acquireSingleUserCaseWriteLock(), and org.sleuthkit.datamodel.SleuthkitCase.releaseSingleUserCaseWriteLock().

void org.sleuthkit.datamodel.CaseDbAccessManager.delete ( final String  tableName,
final String  sql 
) throws TskCoreException

Deletes a row in the specified table.

Parameters
tableNametable from which to delete the row
sql- SQL string specifying the condition to identify the row to delete
Exceptions
TskCoreException

Definition at line 613 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.acquireSingleUserCaseWriteLock(), and org.sleuthkit.datamodel.SleuthkitCase.releaseSingleUserCaseWriteLock().

long org.sleuthkit.datamodel.CaseDbAccessManager.insert ( final String  tableName,
final String  sql 
) throws TskCoreException

Inserts a row in the specified table.

Parameters
tableName- table to insert into.
sql- SQL string specifying column values.
Returns
- rowID of the row
Exceptions
TskCoreException

Definition at line 369 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

long org.sleuthkit.datamodel.CaseDbAccessManager.insert ( final String  tableName,
final String  sql,
final CaseDbTransaction  transaction 
) throws TskCoreException

Inserts a row in the specified table, as part of the specified transaction. If the primary key is duplicate, it does nothing.

Note: For PostGreSQL, the caller must include the ON CONFLICT DO NOTHING clause

Caller is responsible for committing the transaction.

Parameters
tableName- table to insert into.
sql- SQL string specifying column values.
transactiontransaction in which the insert/update is done
Returns
- rowID of the row inserted
Exceptions
TskCoreException

Definition at line 405 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.getDatabaseType(), and org.sleuthkit.datamodel.TskData.DbType.SQLITE.

long org.sleuthkit.datamodel.CaseDbAccessManager.insertOrUpdate ( final String  tableName,
final String  sql 
) throws TskCoreException

Inserts a row in the specified table. If the primary key is duplicate, the existing row is updated.

Note: For PostGreSQL, the caller must include the ON CONFLICT UPDATE clause to handle duplicates

Parameters
tableName- table to insert into.
sql- SQL string specifying column values.
Returns
- rowID of the row inserted/updated
Exceptions
TskCoreException

Definition at line 452 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

long org.sleuthkit.datamodel.CaseDbAccessManager.insertOrUpdate ( final String  tableName,
final String  sql,
final CaseDbTransaction  transaction 
) throws TskCoreException

Inserts a row in the specified table, as part of the specified transaction. If the primary key is duplicate, the existing row is updated. Caller is responsible for committing the transaction.

Note: For PostGreSQL, the caller must include the ON CONFLICT UPDATE clause to handle duplicates

Parameters
tableName- table to insert into.
sql- SQL string specifying column values.
transactiontransaction in which the insert/update is done
Returns
- rowID of the row inserted/updated
Exceptions
TskCoreException

Definition at line 488 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.getDatabaseType(), and org.sleuthkit.datamodel.TskData.DbType.SQLITE.

void org.sleuthkit.datamodel.CaseDbAccessManager.select ( final String  sql,
final CaseDbAccessQueryCallback  queryCallback 
) throws TskCoreException

Runs the specified SELECT query and then calls the specified callback with the result.

Parameters
sqlSQL string specifying the columns to select, tables to select from and the WHERE clause.
queryCallbackCallback object to process the result.
Exceptions
TskCoreException

Definition at line 584 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.acquireSingleUserCaseReadLock(), and org.sleuthkit.datamodel.SleuthkitCase.releaseSingleUserCaseReadLock().

boolean org.sleuthkit.datamodel.CaseDbAccessManager.tableExists ( String  tableName) throws TskCoreException

Checks if a table exists in the case database.

Parameters
tableNamename of the table to check
Returns
true if the table already exists, false otherwise
Exceptions
TskCoreException

Definition at line 162 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

Referenced by org.sleuthkit.datamodel.CaseDbAccessManager.tableExists().

boolean org.sleuthkit.datamodel.CaseDbAccessManager.tableExists ( String  tableName,
CaseDbTransaction  transaction 
) throws TskCoreException

Checks if a table exists in the case database.

Parameters
tableNamename of the table to check
transactiontransaction
Returns
true if the table already exists, false otherwise
Exceptions
TskCoreException

Definition at line 193 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.getDatabaseType(), org.sleuthkit.datamodel.TskData.DbType.SQLITE, and org.sleuthkit.datamodel.CaseDbAccessManager.tableExists().

void org.sleuthkit.datamodel.CaseDbAccessManager.update ( final String  tableName,
final String  sql 
) throws TskCoreException

Updates row(s) in the specified table.

Parameters
tableName- table to insert into.
sql- SQL string specifying column values and conditions.
Exceptions
TskCoreException

Definition at line 528 of file CaseDbAccessManager.java.

References org.sleuthkit.datamodel.SleuthkitCase.beginTransaction(), org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.commit(), and org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction.rollback().

void org.sleuthkit.datamodel.CaseDbAccessManager.update ( final String  tableName,
final String  sql,
CaseDbTransaction  transaction 
) throws TskCoreException

Updates row(s) in the specified table, as part of the specified transaction. Caller is responsible for committing the transaction.

Parameters
tableName- table to insert into.
sql- SQL string specifying column values and conditions.
transaction- transaction under which the update is performed.
Exceptions
TskCoreException

Definition at line 556 of file CaseDbAccessManager.java.


The documentation for this class was generated from the following file:

Copyright © 2011-2021 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.