ParaScripting::ParaDataProvider Class Reference
[ParaWorld]

List of all members.

Detailed Description

Wrapper of internal ParaWorld data provider.


Public Member Functions

bool IsValid ()
 check if the object is valid
 ParaDataProvider (void *pObj)
bool InsertPuzzleRecordFromString (const char *strRecord)
 Insert the new puzzle record to Puzzle_DB.
bool DeletePuzzleRecordByID (int ID)
 delete the existing puzzle record from Puzzle_DB
int GetNPCIDByName (const char *name)
 get NPC ID by name
int GetNPCCount ()
 the total number of NPC in the database.
bool DoesAttributeExists (const char *sName)
 whether a given attribute exists.
object GetAttribute (const char *sName, const object &sOut)
 get the attribute of the current attribute instance in the current table e.g.
bool UpdateAttribute (const char *sName, const object &sIn)
 update the attribute of the current attribute instance in the current table insert the attribute if it is not created before.
bool InsertAttribute (const char *sName, const object &sIn)
 insert by simple name value pair
bool DeleteAttribute (const char *sName)
 delete the attribute of the current attribute instance in the current table
void SetTableName (const char *sName)
 set current attribute table name, the table will be created if not exists.
const char * GetTableName ()
 get the current attribute table name

Static Public Member Functions

static void GetKidsDBProvider (ParaKidsDataProvider *pOut)

Public Attributes

union {
   void *   m_pDataProvider
   CCharacterDB *   m_pDbCharacter
   CKidsDBProvider *   m_pDbKidsProvider
   CNpcDatabase *   m_pDbNPC
   AttributeProvider *   m_pAttributeProvider
}; 


Member Function Documentation

bool ParaScripting::ParaDataProvider::InsertPuzzleRecordFromString ( const char *  strRecord  ) 

Insert the new puzzle record to Puzzle_DB.

Parameters:
record,: ID of record will be ignored and filled with actual ID if inserted successfully
Returns:
true if the record is inserted in database

bool ParaScripting::ParaDataProvider::DeletePuzzleRecordByID ( int  ID  ) 

delete the existing puzzle record from Puzzle_DB

Parameters:
ID,: ID of target record
Returns:
true if the record is deleted in database

int ParaScripting::ParaDataProvider::GetNPCIDByName ( const char *  name  ) 

get NPC ID by name

Parameters:
name name of character
Returns:
id is returned if found in database; otherwise non-positive value(-1) is returned.

int ParaScripting::ParaDataProvider::GetNPCCount (  ) 

the total number of NPC in the database.

There is no statement cached for this call.

Returns:

bool ParaScripting::ParaDataProvider::DoesAttributeExists ( const char *  sName  ) 

whether a given attribute exists.

This function is usually used internally. One common use of this function is to test if a field exists, so that we know if a object has been saved before or not.

Parameters:
sName : name of the attribute field
Returns:

object ParaScripting::ParaDataProvider::GetAttribute ( const char *  sName,
const object &  sOut 
)

get the attribute of the current attribute instance in the current table e.g.

suppose db is a ParaDataProvider object. local x = db:GetAttribute("PlayerX", 0); local name = db:GetAttribute("PlayerName", "no_name");

Parameters:
sName : name of the attribute field
sOut : [in|out] default value of the field. Currently it may be a string or a number
Returns:
the object is returned. Currently it may be a string, boolean or a number.

bool ParaScripting::ParaDataProvider::UpdateAttribute ( const char *  sName,
const object &  sIn 
)

update the attribute of the current attribute instance in the current table insert the attribute if it is not created before.

Parameters:
sName : name of the attribute field
sIn,: value of the attribute field. Currently it may be a string, boolean or a number.
Returns:
true if succeed.

bool ParaScripting::ParaDataProvider::InsertAttribute ( const char *  sName,
const object &  sIn 
)

insert by simple name value pair

Parameters:
sName : name of the attribute field
sIn,: value of the attribute field. Currently it may be a string, boolean or a number.
Returns:
true if succeed.

bool ParaScripting::ParaDataProvider::DeleteAttribute ( const char *  sName  ) 

delete the attribute of the current attribute instance in the current table

Parameters:
sName : name of the attribute field
Returns:
true if succeed.

void ParaScripting::ParaDataProvider::SetTableName ( const char *  sName  ) 

set current attribute table name, the table will be created if not exists.

Parameters:
sName table name

const char* ParaScripting::ParaDataProvider::GetTableName (  ) 

get the current attribute table name

Returns:
current attribute table name


Generated on Mon Dec 1 14:34:46 2008 for NPL Scripting Reference for ParaEngine by  doxygen 1.5.2