Changeset 15633

Show
Ignore:
Timestamp:
22.05.2008 13:48:55 (11 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Minor improvements to opendatabase() and an initial implementation of deletekey().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/lib/sqliteclass.cpp

    r15632 r15633  
    5858  delete[] filename_cstr; 
    5959 
    60   if (sqlitefile == NULL && logout != NULL) 
     60  if (sqlitefile == NULL) 
    6161  { 
    6262    outconvertclass text_t2ascii; 
    6363    (*logout) << text_t2ascii << "database open failed on: " << filename << "\n"; 
    64   } 
    65  
    66   if (sqlitefile != NULL && mode == DB_WRITER_CREATE) 
     64    return false; 
     65  } 
     66 
     67  if (mode == DB_WRITER_CREATE) 
    6768  { 
    6869    sqlexec("CREATE TABLE data (key TEXT, value TEXT, PRIMARY KEY(key))"); 
    6970  } 
    7071 
    71   return (sqlitefile != NULL); 
     72  return true; 
    7273} 
    7374 
     
    187188 
    188189 
    189 void sqliteclass::deletekey(const text_t &key) 
    190 { 
    191   if (sqlitefile == NULL) return;   
    192  
    193   // !! TO IMPLEMENT 
     190void sqliteclass::deletekey (const text_t &key) 
     191{ 
     192  text_t sql_cmd = "DELETE FROM data WHERE key='" + key + "'"; 
     193  sqlexec(sql_cmd); 
    194194} 
    195195