OpenSim::Data::SQLite::SQLiteUtil Class Reference

A base class for methods needed by all SQLite database classes. More...

Inheritance diagram for OpenSim::Data::SQLite::SQLiteUtil:

OpenSim::Data::SQLite::SQLiteInventoryStore OpenSim::Data::SQLite::SQLiteManager List of all members.

Static Public Member Functions

static void createCol (DataTable dt, string name, Type type)
static SqliteCommand createInsertCommand (string table, DataTable dt)
 Create an insert command.
static SqliteCommand createUpdateCommand (string table, string pk, DataTable dt)
 create an update command
static string defineTable (DataTable dt)
static SqliteParameter createSqliteParameter (string name, Type type)
 This is a convenience function that collapses 5 repetitive lines for defining SqliteParameters to 2 parameters: column name and database type.
static DbType dbtypeFromType (Type type)
 Type conversion function.
static string sqliteType (Type type)

Detailed Description

A base class for methods needed by all SQLite database classes.


Member Function Documentation

static void OpenSim::Data::SQLite::SQLiteUtil::createCol ( DataTable  dt,
string  name,
Type  type 
) [inline, static]

Parameters:
dt 
name 
type 

static SqliteCommand OpenSim::Data::SQLite::SQLiteUtil::createInsertCommand ( string  table,
DataTable  dt 
) [inline, static]

Create an insert command.

Parameters:
table table name
dt data table
Returns:
the created command

This is subtle enough to deserve some commentary. Instead of doing *lots* and *lots of hardcoded strings for database definitions we'll use the fact that realistically all insert statements look like "insert into A(b, c) values(:b, :c) on the parameterized query front. If we just have a list of b, c, etc... we can generate these strings instead of typing them out.

static SqliteCommand OpenSim::Data::SQLite::SQLiteUtil::createUpdateCommand ( string  table,
string  pk,
DataTable  dt 
) [inline, static]

create an update command

Parameters:
table table name
pk 
dt 
Returns:
the created command

static string OpenSim::Data::SQLite::SQLiteUtil::defineTable ( DataTable  dt  )  [inline, static]

Parameters:
dt Data Table
Returns:

static SqliteParameter OpenSim::Data::SQLite::SQLiteUtil::createSqliteParameter ( string  name,
Type  type 
) [inline, static]

This is a convenience function that collapses 5 repetitive lines for defining SqliteParameters to 2 parameters: column name and database type.

It assumes certain conventions like :param as the param name to replace in parametrized queries, and that source version is always current version, both of which are fine for us.

/summary>

Parameters:
name 
type 
returns>a built sqlite parameter

static DbType OpenSim::Data::SQLite::SQLiteUtil::dbtypeFromType ( Type  type  )  [inline, static]

Type conversion function.

Parameters:
type a type
Returns:
a DbType

static string OpenSim::Data::SQLite::SQLiteUtil::sqliteType ( Type  type  )  [inline, static]

Parameters:
type a Type
Returns:
a string
this is something we'll need to implement for each db slightly differently.


The documentation for this class was generated from the following file:
Generated on Mon Jan 5 01:00:39 2009 for OpenSim by  doxygen 1.5.1