Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqliteÊý¾Ý¿â»ù±¾²Ù×÷

//²åÈë¼°¸üвÙ×÷
 int nRet = 0;
 sqlite3 * db = NULL;
 CString strFilePath;  //Êý¾Ý¿â´æ´¢Â·¾¶
//·¾¶¸³Öµ£¨Ê¡ÂÔ£©
 //Á¬½ÓÊý¾Ý¿â
 nRet = sqlite3_open16(strFilePath, &db);    //Óм¸¸ö´ò¿ªº¯Êý¿É¹©µ÷Óã¬Ê¹ÓÃWCHARÀàÐÍ·¾¶ÓÃÕâ¸ö
 if(nRet != SQLITE_OK)
 {
 LogD(_Q_D,L"Êý¾Ý¿â´ò¿ªÊ§°Ü");
 return -4;
 }
 CString strSQLSentence;
char *szSQLSentence = NULL;
×éÖ¯SQLÓï¾ä
**********************
 {
  //¸üвÙ×÷
  strSQLSentence.Format(L"update tbl_ad set AD_TITLE='%s', AD_INFO='%s', BEGIN_TIME='%s', END_TIME='%s' where AD_ID='%s';", strADTitle, strADInfo, strADBeginTime, strADEndTime, strADId);
 }
 {
  //²åÈë²Ù×÷
  strSQLSentence.Format(L"insert into tbl_Advertisement values('%s','%s','%s','%s','%s');", strADId, strADTitle, strADInfo, strADBeginTime, strADEndTime);
 }
**********************
//½«SQLÓï¾äת»»³Ésqliteº¯ÊýÄÜÖ´ÐеÄUTF8¸ñʽ
  nLen = 0;
  nLen = WideCharToMultiByte(CP_UTF8, 0, strSQLSentence, -1, NULL, 0, NULL, 0);
  szSQLSentence = new char[nLen+1];
  if (szSQLSentence == NULL)
  {
   return -6;
  }
  memset(szSQLSentence, 0, nLen+1);
  WideCharToMultiByte(CP_UTF8, 0, strSQLSentence, -1, szSQLSentence, nLen+1, NULL, 0);
  //Ëø¶¨Êý¾Ý¿â
  if(SQLiteLock(L"terminalplat.db",30*1000) == 0)    //SQLiteLockΪ×ÔдµÄÒ»Ì×Ëø»úÖÆÖеĺ¯Êý
  {
   // ×¼±¸Ö´ÐÐSQL
   nRet = sqlite3_exec( db, "begin;", 0, 0, 0);
   if(nRet == SQLITE_OK)
   {
    BOOL bSuccess = TRUE;
    char * pErrMsg = NULL;
    // Ö´ÐÐSQL
    nRet = sqlite3_exec( db, szSQLSentence, 0, 0, &pErrMsg);
    if(nRet != SQLITE_OK)
   


Ïà¹ØÎĵµ£º

SQLiteÔÚVCϵÄʹÓÃ

Ò»¡¢SQLite¼ò½é
SQLite ÊÇÓÃCÓïÑÔ±àдµÄ¿ªÔ´Êý¾Ý¿â£¬Ö÷ÒªÓÃÓÚǶÈëʽ£¬ÄãÒ²¿ÉÒÔ°ÑËü¼¯³ÉÔÚ×Ô¼ºµÄ×ÀÃæ³ÌÐòÖУ¬Ò²ÓÐÈ˽«ÆäÌæ´úAccess£¬ÓÃ×÷ºǫ́Êý¾Ý¿â¡£
SQLite Ö§³Ö¶àÊýSQL92±ê×¼£¬ÀýÈ磺Ë÷Òý¡¢ÏÞÖÆ¡¢´¥·¢ºÍ²é¿´Ö§³Ö¡£
Ö§³Ö NULL¡¢INTEGER¡¢REAL¡¢TEXT ºÍ BLOB Êý¾ÝÀàÐÍ£¬Ö§³ÖÊÂÎñ¡£
¶þ¡¢ÏÂÔØSQLite
SQLite¿ÉÒÔµ½¹Ù·½Õ¾µ ......

SQLite ¼ò½é

SQLite ÊÇÒ»¸öʵÏÖÁËÍ걸µÄ£¨self-contained)£¬¿ÉǶÈëµÄ(embeddable)£¬ÁãÅäÖÃ(zero-configuration)µÄSQLÊý¾Ý¿âÒýÇæµÄСÐ͵ÄCº¯Êý¿â¡£Ëü°üº¬ÒÔϵÄÌص㣺
.
    ÊÂÎñ´¦ÀíÔ­×Ó»¯(atomic)£¬Ò»Ö»¯(consistent)£¬³Ö¾Ã»¯(isolated)£¬¾øÔµ»¯(durable)£¬¼´Ê¹ÊÇÔÚϵͳ±ÀÀ£ºÍµôµçʱ
    ÁãÅäÖ㬲» ......

2010ÄêSQLiteѧϰ±Ê¼ÇÖ®Èý

                                                   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ