it represents both a database entity and a database manager the static functions are for database manager basically use OpenDBEntity and CloseDBEntity; this class has two alias class ParaEngine::DBEntity and ParaEngine::CDBManager
More...
#include <ICDBManager.h>
|
static PE_CORE_DECL DBEntity * | GetDB (const char16_t *name) |
| get the database with a name or file path More...
|
|
static PE_CORE_DECL DBEntity * | OpenDBEntity () |
|
static PE_CORE_DECL DBEntity * | OpenDBEntity (const char16_t *dbname) |
| only load if not loaded before. More...
|
|
static PE_CORE_DECL DBEntity * | OpenDBEntity (const char *dbname) |
|
static PE_CORE_DECL DBEntity * | OpenDBEntity (const char16_t *name, const char16_t *dbname) |
|
static PE_CORE_DECL DBEntity * | OpenDBEntity (const char *name, const char *dbname) |
|
static PE_CORE_DECL bool | CloseDBEntity (DBEntity *pEntity) |
| close the database entity, one should never use a closed entity any more. More...
|
|
static PE_CORE_DECL void | Finalize () |
| delete all db managers
|
|
static PE_CORE_DECL void | StaticInit () |
|
|
class | CICMapTrace |
|
class | CICRoot |
|
class | CICGenManager |
|
it represents both a database entity and a database manager the static functions are for database manager basically use OpenDBEntity and CloseDBEntity; this class has two alias class ParaEngine::DBEntity and ParaEngine::CDBManager
- code sample.
- we suppose you already know how to open a database using CICGenManager, and the open operation is done before this sample CICRecordSet rs=new CICRecordSet("SELECT * FROM maptrace"); a new recordset always is BOF and EOF if (rs->IsBOF()) { NextRow go to the next row of the return, here we go to the first row return of NextRow is CICRecordSet::SOK if ok. it is CICRecordSet::SEOF if the next row is beyond the end of the rows rs->NextRow(); the sql string is not executed before the first call to NextRow } if (rs->IsEOF()) { nothing returns from the sql string, or the string is not correct throw; } while(!rs->IsEOF()){ remember to use (*rs)[x] to access the x-th column of the row if rs is (CICRecordSet *) here an auto-datatype-casting is done internally, so you don't need to care about it. int time=(*rs)[0]; double x,y,z; x=(*rs)[1]; y=(*rs)[2]; z=(*rs)[3]; const char id=(*rs)[4]; warning: do not put (*rs)[x] directly into the following function, you should always assign them to a clear type variable before using them because the type-casting function must know which type it is casting. OUTPUT_LOG("time = %d x=%f y=%f z=%f id=%s",time,x,y,z,id); rs->NextRow(); } when end of the recordset, the operation is automatically finalize so sqlite3_finalize is not needed.
§ CloseDBEntity()
bool CICDBManager::CloseDBEntity |
( |
DBEntity * |
pEntity | ) |
|
|
static |
close the database entity, one should never use a closed entity any more.
- Parameters
-
§ GetDB()
DBEntity * CICDBManager::GetDB |
( |
const char16_t * |
name | ) |
|
|
static |
get the database with a name or file path
- Parameters
-
- Returns
§ OpenDBEntity() [1/2]
DBEntity * CICDBManager::OpenDBEntity |
( |
const char16_t * |
dbname | ) |
|
|
static |
only load if not loaded before.
- Parameters
-
dbname | path of the database file |
- Returns
- database entity
§ OpenDBEntity() [2/2]
DBEntity * CICDBManager::OpenDBEntity |
( |
const char16_t * |
name, |
|
|
const char16_t * |
dbname |
|
) |
| |
|
static |
- Parameters
-
name | alias name |
dbname | database path |
- Returns
- database entity
The documentation for this class was generated from the following files:
- Client/trunk/ParaEngineClient/ic/ICDBManager.h
- Client/trunk/ParaEngineClient/ic/ICDBManager.cpp