示例#1
0
//删除表格
//@示例语句sqlstr="drop table name";
void DBUtil::deleteTable( string sql,string name )
{
    if (tableIsExist(name))
    {
        result = sqlite3_exec(pDB,sql.c_str(),NULL,NULL,&errMsg);
        if( result != SQLITE_OK )
            CCLOG( "创建表失败,错误码:%d ,错误原因:%s\n" , result, errMsg );
    }
}
示例#2
0
//删除表格  
//@示例语句sqlstr="drop table name";  
void DBUtil::deleteTable( string sql,string name )  
{  
    if (tableIsExist(name))  
    {  
        result = sqlite3_exec(pDB,sql.c_str(),NULL,NULL,&errMsg);  
        if( result != SQLITE_OK )  
            CCLOG( "failed to create table,error code:%d ,Message:%s\n" , result, errMsg );  
    }  
}  
示例#3
0
//在数据库中判断名为name的表示否存在,如果不存在则创建这张表
//@示例语句string sqls = "create table user(id integer,username text,password text)";
void DBUtil::createTable( string sql,string name )
{
    if (!tableIsExist(name))
    {
        //创建表,设置ID为主键,且自动增加
        result = sqlite3_exec(pDB,sql.c_str(),NULL,NULL,&errMsg);
        if( result != SQLITE_OK )
            CCLOG( "创建表失败,错误码:%d ,错误原因:%s\n" , result, errMsg );
    }
    
}
示例#4
0
//在数据库中判断名为name的表示否存在,如果不存在则创建这张表  
//@示例语句string sqls = "create table user(id integer,username text,password text)";  
void DBUtil::createTable( string sql,string name )  
{  
    if (!tableIsExist(name))  
    {  
        //创建表,设置ID为主键,且自动增加  
        result = sqlite3_exec(pDB,sql.c_str(),NULL,NULL,&errMsg);  
        if( result != SQLITE_OK )  
            CCLOG( "failed to create table,error code:%d ,Msg:%s\n" , result, errMsg );  
    }  
      
}