当前位置: 首页>>代码示例>>C++>>正文


C++ CppSQLite3Buffer类代码示例

本文整理汇总了C++中CppSQLite3Buffer的典型用法代码示例。如果您正苦于以下问题:C++ CppSQLite3Buffer类的具体用法?C++ CppSQLite3Buffer怎么用?C++ CppSQLite3Buffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CppSQLite3Buffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetAllVisiter

void  GetAllVisiter(int64 ParentID, vector<int64>& VisiterList,int64 NotIncludeChildID/*=0*/){

	char TableName[30];
	int64toa(ParentID,TableName);
	if(!GetWorldDB().tableExists(TableName)){
		return ;
	}

	CppSQLite3Buffer SQL;
	SQL.format("select %s from \"%s\" where  %s>%d",
		ITEM_ID,
		TableName,
		ITEM_TYPE,
		OBJECT_SPACE
		);

	CppSQLite3Query Result = GetWorldDB().execQuery(SQL);
	if(Result.eof())return ;

	while(!Result.eof()){
		int64  ChildID = Result.getInt64Field(0);
		if (ChildID != NotIncludeChildID)
		{
			VisiterList.push_back(ChildID);			
		}
		Result.nextRow();
	}
}
开发者ID:GMIS,项目名称:GMIS,代码行数:28,代码来源:Space.cpp

示例2: GetChildID

void CBrainMemory::DeleteChild(int64 ParentTable,int64 ChildRoomValue,int64 ChildRoomType){
	int64 ChildID = GetChildID(ParentTable,ChildRoomValue,ChildRoomType);
    if(ChildID==0)return ;

    CppSQLite3Buffer SQL;
	char buf[30];
	int64toa(ChildID,buf);
   
	//先删除子表
	if(BrainDB.tableExists(buf)){		
		SQL.format("DROP TABLE \"%s\"",buf);
		BrainDB.execDML(SQL);
	}

	//然后删除子条目
	char Father[30];
	int64toa(ParentTable,Father);
    SQL.format("delete from \"%s\" where %s = \"%s\" ",Father,RB_SPACE_ID,buf);
    BrainDB.execDML(SQL);

	//最后删除索引
	ToLBrain(ChildRoomValue);
	int64toa(ChildRoomValue,Father);
    SQL.format("delete from \"%s\" where %s = \"%s\" ",Father,LB_CHILD_ID,buf);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:25,代码来源:BrainMemory.cpp

示例3: CheckCreateSettingTable

bool DBSetting::GetValue(long lKey,std::string &strValue)
{
	//打开数据库
	CppSQLite3DB dbTask;
	dbTask.open(m_strDB.c_str());
	CheckCreateSettingTable(dbTask);
	CppSQLite3Buffer strSql;

	try{
		strSql.format("select value from T_Setting where key=%d;",lKey);
		CppSQLite3Query q = dbTask.execQuery(strSql);
		if (q.eof())
		{
			return false;
		}
		strValue = q.getStringField(0);
	}
	catch(CppSQLite3Exception &exp)
	{
		exp;
		ATLTRACE("error:%s\n",exp.errorMessage());
		ATLASSERT(FALSE);
		return false;
	}
	return true;
}
开发者ID:blog2i2j,项目名称:greentimer,代码行数:26,代码来源:DBSetting.cpp

示例4: ToRBrain

/*
int32 CBrainMemory::GetAllMeaning(int64 ID, map<int64,int64> 
&MeaningList){

	   CppSQLite3Buffer SQL;
	   CppSQLite3Query  Result;
       char a[30];
	   char b[30];
      
       MeaningList.clear();
	
//	   if(!RBrainHasTable(ID))return 0;
	   
	   ToRBrain(ID);
	   SQL.format("select %s, %s  from \"%s\" where %s=\"%s\" ;",
						RB_SPACE_ID,
		                RB_SPACE_VALUE,
			            _i64toa(ID,a,10),
						RB_SPACE_TYPE,
						_i64toa(MEMORY_TYPE_MEANING,b,10)                  
						);
	   Result = BrainDB.execQuery(SQL);
       
	   while(!Result.eof())
	   {
          MeaningList[Result.getInt64Field(1)] = Result.getInt64Field(0);
		  Result.nextRow();
	   }
	   return MeaningList.size();
}
*/	
int32 CBrainMemory::GetAllMeaningRoomID(int64 ID, deque<int64>& MeaningRoomIDList){
	   CppSQLite3Buffer SQL;
	   CppSQLite3Query  Result;
       char a[30],b[30];      
       MeaningRoomIDList.clear();
	
//	   if(!RBrainHasTable(ID))return 0;
	   
	   ToRBrain(ID);

	   int64toa(ID,a);
	   int64toa(MEMORY_BODY,b);
	   SQL.format("select %s  from \"%s\" where %s > \"%s\";",
						RB_SPACE_ID,
			            a, 
						RB_SPACE_TYPE,
						b                   
						);
	   Result = BrainDB.execQuery(SQL);
       
	   while(!Result.eof())
	   {
          MeaningRoomIDList.push_back(Result.getInt64Field(0));
		  Result.nextRow();
	   }
	   return MeaningRoomIDList.size();
}
开发者ID:GMIS,项目名称:GMIS,代码行数:58,代码来源:BrainMemory.cpp

示例5: GetAllPartOfSpeech

uint32 CBrainMemory::GetAllPartOfSpeech(int64 ParentID){
	   CppSQLite3Buffer SQL;
       char a[30],b[30],c[30];
	   
	   uint32 PartOfSpeech = 0;
//	   if(!RBrainHasTable(ID))return 0;

	   ToRBrain(ParentID);
	   int64toa(ParentID,a);
	   int64toa(PARTOFSPEECH_START,b);
	   int64toa(PARTOFSPEECH_END,c);

	   SQL.format("select %s from \"%s\" where %s > \"%s\" AND %s< \"%s\";",
						RB_SPACE_TYPE,
			            a,
						RB_SPACE_TYPE,
						b, 
                        RB_SPACE_TYPE,
						c
						);
	   CppSQLite3Table t = BrainDB.getTable(SQL);

	   for (int row = 0; row < t.numRows(); row++)
	   {
			t.setRow(row);
			int64 type = t.getInt64Field(0);
            PartOfSpeech |= (uint32)((type-PARTOFSPEECH_START));  
	   }
	   return PartOfSpeech;
}
开发者ID:GMIS,项目名称:GMIS,代码行数:30,代码来源:BrainMemory.cpp

示例6: GetCustomCommandText

void  CBrainMemory::GetCustomCommandText(int64 LogicID, deque<tstring>& CommanTextList){
	int64 FatherID,ChildID,RoomType;
	char buf[30];
	CppSQLite3Buffer SQL;
	
	if(LBrainHasTable(LogicID)){
		//索引空间是否有表,有则表示其为其它空间的空间值
		//根据索引表得到其作为空间值时的空间存储ID,存入种子表
		ToLBrain(LogicID);
		int64toa(LogicID,buf);
		SQL.format("select %s,%s from  \"%s\"  ;",LB_FATHER_ID,LB_CHILD_ID,buf);
		CppSQLite3Table t0 = BrainDB.getTable(SQL);
		for (int row = 0; row < t0.numRows(); row++)
		{
			t0.setRow(row);
			FatherID = t0.getInt64Field(0);
			ChildID = t0.getInt64Field(1);
			if(ChildID == -LogicID)continue;
			RoomType = GetChildType(FatherID,ChildID);
			if(RoomType == MEMORY_INSTINCT){ //看是否文本空间修饰RoomID
                tstring Text;
				if(RetrieveAction(ChildID,LogicID,Text,false)){
					if(Text.size())CommanTextList.push_back(Text);
				}
			}
		}
	}
}
开发者ID:GMIS,项目名称:GMIS,代码行数:28,代码来源:BrainMemory.cpp

示例7: JoinTableDelete

int CDbMeter::JoinTableDelete(const char* dbfilename)
{
	try
	{
		CppSQLite3DB db;
		db.open(dbfilename);
		CppSQLite3Buffer bufSQL;
		CppSQLite3Table t;

		db.execDML("CREATE TABLE IF NOT EXISTS jointable (joinkey INTEGER PRIMARY KEY, EUI64ID CHAR(17), jointry INTEGER);");
		bufSQL.format("SELECT * FROM jointable;");
		t = db.getTable(bufSQL);

		if( t.numRows() == 0 )
		{
			XDEBUG("Failure: Don't have JoinTable\r\n");
		}
		else
		{
			db.execDML("DROP TABLE joinTable;");
		}
	}
	catch( CppSQLite3Exception& e )
	{
		XDEBUG("%s\r\n",e.errorMessage());
		return e.errorCode();
	}
	return SQLITE_OK;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:29,代码来源:DbMeter.cpp

示例8: GetActionRoom

int32 CLogicThread::GetActionRoom(int64 ParentID,ClauseLogicSense* cls){
	   CppSQLite3Buffer SQL;
       char a[30],b[30];
	   
	   uint32 PartOfSpeech = 0;
//	   if(!RBrainHasTable(ID))return 0;

	   map<int64,MeaningPos>& RoomList = cls->ClauseMeaning;

	   ToRBrain(ParentID);

	   int64toa(ParentID,a);
	   int64toa(MEMORY_INSTINCT,b);
	   SQL.format("select %s,%s from \"%s\" where %s = \"%s\" ;",
						RB_SPACE_ID,
						RB_SPACE_VALUE,
			            a,
						RB_SPACE_TYPE,
						b
						);
	   CppSQLite3Table t = BrainDB.getTable(SQL);

	   for (int row = 0; row < t.numRows(); row++)
	   {
			t.setRow(row);
			int64 ID = t.getInt64Field(0);
			int64 Value = t.getInt64Field(1);
			MeaningPos Pos;
			Pos.RoomID = ID;
			Pos.ParamTokenPos = cls->NextTokenPos;
            RoomList[Value] = Pos;
	   }
	   return RoomList.size();	
}
开发者ID:GMIS,项目名称:GMIS,代码行数:34,代码来源:LogicThread_Think.cpp

示例9: CheckCreateLogTable

void DBLog::Log( const char *pModel,int code,int value1,int value2, const char *pMessage )
{
	//打开数据库
	CppSQLite3DB dbTask;
	dbTask.open(m_strDB.c_str());
	CheckCreateLogTable(dbTask);

	CppSQLite3Buffer strSql;
	strSql.format("insert into T_Log values(NULL,'%q',%d,%d,%d,%d,'%q');",
		pModel,GlobeFuns::TimeToInt(CTime::GetCurrentTime()),code,value1,value2,pMessage
		);

	try{
		if(1!=dbTask.execDML(strSql))
		{
			ATLASSERT(FALSE);
			return;
		}
	}
	catch(CppSQLite3Exception &exp)
	{
		exp;
		ATLTRACE("error:%s\n",exp.errorMessage());
		ATLASSERT(FALSE);
		return;
	}
}
开发者ID:blog2i2j,项目名称:greentimer,代码行数:27,代码来源:DBLog.cpp

示例10: GetAllPartOfSpeechRoom

int32 CBrainMemory::GetAllPartOfSpeechRoom(int64 ParentID,map<int64,int64>& RoomList)
{
	   CppSQLite3Buffer SQL;
       char a[30],b[30],c[30];
	   
	   uint32 PartOfSpeech = 0;
//	   if(!RBrainHasTable(ID))return 0;

	   ToRBrain(ParentID);

	   int64toa(ParentID,a);
	   int64toa(PARTOFSPEECH_START,b); 
	   int64toa(PARTOFSPEECH_END,c);

	   SQL.format("select %s,%s from \"%s\" where %s > \"%s\" AND %s< \"%s\";",
						RB_SPACE_ID,
						RB_SPACE_TYPE,
			            a,
						RB_SPACE_TYPE,
						b,
                        RB_SPACE_TYPE,
						c
						);
	   CppSQLite3Table t = BrainDB.getTable(SQL);

	   for (int row = 0; row < t.numRows(); row++)
	   {
			t.setRow(row);
			int64 ID = t.getInt64Field(0);
			int64 Type = t.getInt64Field(1);
            RoomList[ID] = Type;
	   }
	   return RoomList.size();
}
开发者ID:GMIS,项目名称:GMIS,代码行数:34,代码来源:BrainMemory.cpp

示例11: values

void   CBrainMemory::SetSystemItem(int64 Item,AnsiString Info){
	CppSQLite3Buffer SQL;
	CppSQLite3Query  Result;
	char a[30],b[30];
     int64toa(ROOM_SYSTEM,a);
	 int64toa(Item,b);

    SQL.format("select b from \"%s\" where a = \"%s\";",a,b);				
	Result = BrainDB.execQuery(SQL);
	bool Find = !Result.eof();
    Result.finalize();

	if(!Find){
		SQL.format("insert into \"%s\" values (\"%s\", ?)",
			a,
			b);
	}else{
		SQL.format("update \"%s\" set b = ? where a = \"%s\";",
			a,
			b
			);
	}

	CppSQLite3Statement State = BrainDB.compileStatement(SQL);
	State.bind(1,Info.c_str()); //替换第一个问号
	State.execDML();

}
开发者ID:GMIS,项目名称:GMIS,代码行数:28,代码来源:BrainMemory.cpp

示例12: JoinTableShow

int CDbMeter::JoinTableShow(const char* dbfilename)
{
	try
	{
		CppSQLite3DB db;
		db.open(dbfilename);
		CppSQLite3Buffer bufSQL;
		CppSQLite3Table t;

		db.execDML("CREATE TABLE IF NOT EXISTS jointable (joinkey INTEGER PRIMARY KEY, EUI64ID CHAR(17), jointry INTEGER);");
		bufSQL.format("SELECT * FROM jointable;");

		t = db.getTable(bufSQL);

		for ( int row = 0; row < t.numRows(); row++)
		{
			t.setRow(row);
			for (int fld=0; fld<t.numFields(); fld++)
			{
				if( !t.fieldIsNull(fld))
					XDEBUG("%s | ", t.fieldValue(fld));
			}
			XDEBUG("\r\n");
		}

	}
	catch( CppSQLite3Exception& e )
	{
		XDEBUG("%s\r\n",e.errorMessage());
		return e.errorCode();
	}
	return SQLITE_OK;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:33,代码来源:DbMeter.cpp

示例13: JoinTableAdd

int CDbMeter::JoinTableAdd(const char* dbfilename, char* szID)
{
	try
	{
		CppSQLite3DB db;
		db.open(dbfilename);
		CppSQLite3Buffer bufSQL;
		CppSQLite3Table t;

		db.execDML("CREATE TABLE IF NOT EXISTS jointable (joinkey INTEGER PRIMARY KEY, EUI64ID CHAR(17), jointry INTEGER);");
		bufSQL.format("SELECT * FROM jointable WHERE EUI64ID=%Q", szID);
		t = db.getTable(bufSQL);
		if( t.numRows() == 0 )
		{
			bufSQL.clear();
			bufSQL.format("INSERT INTO jointable(EUI64ID, jointry) VALUES(%Q, %d);", szID, 0);
			db.execDML(bufSQL);
		}
		else
			XDEBUG("Jointable ID Duplicate!!\r\n");

		db.close();
	}
	catch( CppSQLite3Exception& e )
	{
		XDEBUG("%s\r\n",e.errorMessage());
		return e.errorCode();
	}
	return SQLITE_OK;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:30,代码来源:DbMeter.cpp

示例14: CreateTable

void CreateTable(int64 TableID)
{
	char     TableName[30]; 
    int64toa(TableID,TableName);
	CppSQLite3Buffer  SQL;          // 空间ID             空间名字         空间类型            空间指纹   空间属性   空间拥有者信息        
    SQL.format("CREATE TABLE \"%s\" ( a INTEGER NOT NULL ,b TEXT NOT NULL, c INTEGER NOT NULL,  d TEXT,   e TEXT,    f TEXT );",TableName);
    GetWorldDB().execDML(SQL);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:8,代码来源:Space.cpp

示例15: Query

CppSQLite3Query CBrainMemory::Query(const char* Select,const char* From, const char* Where, const char* Value )
{
    CppSQLite3Buffer SQL;
	if(!strcmp(Select,"*"))SQL.format("select * from \"%s\" where \"%s\" = \"%s\";",From,Where,Value);
	else SQL.format("select \"%s\" from \"%s\" where \"%s\" = \"%s\";",Select,From,Where,Value);
	
	return BrainDB.execQuery(SQL);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:8,代码来源:BrainMemory.cpp


注:本文中的CppSQLite3Buffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。