Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÒÆÖ²×ÊÁÏ

sqlite-3.3.6±àÒë°²×°Óë½»²æ±àÒëÈ«¹ý³ÌÏêϸ¼Ç¼
ÏÂÎĽéÉܵÄÄÚÈݶ¼ÊÇ»ùÓÚ Linux RedHat 9.0 ƽ̨µÄ¡£
Ò»¡¢PC»ú±àÒë°²×°
ÇëÔĶÁÔÚ°²×°°üÀïµÄ INSTALL Îļþ¡£»òÕßʹÓÃPEAR installer with "pear install sqlite"¡£SQLiteÒѾ­ÄÚÖÃÁË£¬Äã²»ÐèÒª°²×°Èκθ½¼ÓµÄÈí¼þ£¨additional software£©¡£
Windows users¿ÉÒÔÏÂÔØSQLiteÀ©Õ¹ ......

SQLite3 C/C++ ¿ª·¢½Ó¿Ú¼ò½é£¨APIº¯Êý£©


SQLite3ÊÇSQLiteÒ»¸öȫеİ汾,ËüËäÈ»ÊÇÔÚSQLite 2.8.13µÄ´úÂë»ù´¡Ö®ÉÏ¿ª·¢µÄ,µ«ÊÇʹÓÃÁ˺Í֮ǰµÄ°æ±¾²»¼æÈݵÄÊý¾Ý¿â¸ñʽºÍAPI. SQLite3ÊÇΪÁËÂú×ãÒÔϵÄÐèÇó¶ø¿ª·¢µÄ:
Ö§³ÖUTF-16±àÂë.
Óû§×Ô¶¨ÒåµÄÎı¾ÅÅÐò·½·¨.
¿ÉÒÔ¶ÔBLOBs×ֶν¨Á¢Ë÷Òý.
Òò´ËΪÁËÖ§³ÖÕâЩÌØÐÔÎҸıäÁËÊý¾Ý¿âµÄ¸ñʽ,½¨Á¢ÁËÒ»¸öÓë֮ǰ°æ±¾²»¼æÈݵ ......

SQLite ³õ̽

»¹Êdzõ̽£¬×öµÄÏîÄ¿ÒªÓõ½ÇáÇɵı¾µØÊý¾Ý¿â£¬ÓÚÊÇÕÒÁË sqlite 3 ÊÔÓÃÖ®£¬»¹²»´í£¬¹»ÇáÇÉ¡£
ÉÏÕâ¶ùÈ¥ÏÂÔسÌÐòºÍ²é¿´Îĵµ£º http://www.sqlite.org/download.html
Õâ»Ø¿ª·¢ÓõÄÊÇ C#£¬ÓÚÊÇÕÒÁ˸ö.NETµÄ¿â Finisar.SQLite £¬µ½Õâ¶ùÈ¥ÔØ http://adodotnetsqlite.sourceforge.net/
Òª¼ÇµÄÒ²²»ÊÇʲô´ó²»Á˵Ķ«Î÷£¬Ê¾ÀýÍøÕ¾É϶ ......

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

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