Changeset 4791 for trunk/include/dblayer
- Timestamp:
- Jan 29, 2010, 12:36:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/dblayer/functions_sqlite.inc.php
r4781 r4791 40 40 $db_file = sprintf('%s/%s.db', $conf['local_data_dir'], $database); 41 41 42 $link = new SQLite3($db_file); 42 if (script_basename()=='install') 43 { 44 $sqlite_open_mode = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE; 45 } 46 else 47 { 48 $sqlite_open_mode = SQLITE3_OPEN_READWRITE; 49 } 50 try { 51 $link = new SQLite3($db_file, $sqlite_open_mode); 52 } catch (Exception $e) { 53 my_error('sqlite::open', true); 54 } 55 43 56 $link->createFunction('now', 'pwg_now', 0); 44 57 $link->createFunction('md5', 'md5', 1); … … 418 431 { 419 432 $boolean = true; 420 if ('f' == $string || 'false'== $string)433 if ('f' === $string || 'false' === $string) 421 434 { 422 435 $boolean = false; … … 433 446 function boolean_to_string($var) 434 447 { 435 if (!empty($var) && ($var == 't '))448 if (!empty($var) && ($var == 'true')) 436 449 { 437 450 return 'true'; … … 513 526 global $pwg_db_link; 514 527 515 $error = '[sqlite error]'.$pwg_db_link->lastErrorMsg()."\n"; 528 $error = ''; 529 if (isset($pwg_db_link)) 530 { 531 $error .= '[sqlite error]'.$pwg_db_link->lastErrorMsg()."\n"; 532 } 533 516 534 $error .= $header; 517 535
Note: See TracChangeset
for help on using the changeset viewer.