OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | List of all members
OpenSim.Data.SQLite.SQLiteUtil Class Reference

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

Static Public Member Functions

static void createCol (DataTable dt, string name, Type type)
 
static SqliteCommand createInsertCommand (string table, DataTable dt)
 Create an insert command More...
 
static SqliteCommand createUpdateCommand (string table, string pk, DataTable dt)
 create an update command More...
 
static string defineTable (DataTable dt)
 
static SqliteParameter createSqliteParameter (string name, Type type)
 
static DbType dbtypeFromType (Type type)
 Type conversion function More...
 
static string sqliteType (Type type)
 

Detailed Description

A base class for methods needed by all SQLite database classes

Definition at line 41 of file SQLiteUtils.cs.

Member Function Documentation

static void OpenSim.Data.SQLite.SQLiteUtil.createCol ( DataTable  dt,
string  name,
Type  type 
)
inlinestatic

Parameters
dt
name
type

Definition at line 57 of file SQLiteUtils.cs.

static SqliteCommand OpenSim.Data.SQLite.SQLiteUtil.createInsertCommand ( string  table,
DataTable  dt 
)
inlinestatic

Create an insert command

Parameters
tabletable name
dtdata 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.

Definition at line 88 of file SQLiteUtils.cs.

static SqliteParameter OpenSim.Data.SQLite.SQLiteUtil.createSqliteParameter ( string  name,
Type  type 
)
inlinestatic

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

Definition at line 205 of file SQLiteUtils.cs.

static SqliteCommand OpenSim.Data.SQLite.SQLiteUtil.createUpdateCommand ( string  table,
string  pk,
DataTable  dt 
)
inlinestatic

create an update command

Parameters
tabletable name
pk
dt
Returns
the created command

Definition at line 122 of file SQLiteUtils.cs.

static DbType OpenSim.Data.SQLite.SQLiteUtil.dbtypeFromType ( Type  type)
inlinestatic

Type conversion function

Parameters
typea type
Returns
a DbType

Definition at line 226 of file SQLiteUtils.cs.

static string OpenSim.Data.SQLite.SQLiteUtil.defineTable ( DataTable  dt)
inlinestatic

Parameters
dtData Table
Returns

Definition at line 154 of file SQLiteUtils.cs.

static string OpenSim.Data.SQLite.SQLiteUtil.sqliteType ( Type  type)
inlinestatic

Parameters
typea Type
Returns
a string

this is something we'll need to implement for each db slightly differently.

Definition at line 271 of file SQLiteUtils.cs.


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