Changeset 328 in subversion
- Timestamp:
- Aug 30, 2006 1:41:21 PM (7 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 1 added
- 6 edited
-
SQL/mssql.initial.sql (added)
-
program/include/main.inc (modified) (2 diffs)
-
program/include/rcube_db.inc (modified) (4 diffs)
-
program/include/rcube_imap.inc (modified) (3 diffs)
-
program/include/session.inc (modified) (3 diffs)
-
program/steps/addressbook/save.inc (modified) (2 diffs)
-
program/steps/mail/addcontact.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r324 r328 467 467 // update user's record 468 468 $DB->query("UPDATE ".get_table_name('users')." 469 SET last_login= now()469 SET last_login=".$DB->now()." 470 470 WHERE user_id=?", 471 471 $user_id); … … 512 512 $DB->query("INSERT INTO ".get_table_name('users')." 513 513 (created, last_login, username, mail_host, alias, language) 514 VALUES ( now(), now(), ?, ?, ?, ?)",514 VALUES (".$DB->now().", ".$DB->now().", ?, ?, ?, ?)", 515 515 $user, 516 516 $host, -
trunk/roundcubemail/program/include/rcube_db.inc
r262 r328 293 293 { 294 294 case 'pgsql': 295 // PostgreSQL uses sequences296 295 $result = &$this->db_handle->getOne("SELECT CURRVAL('$sequence')"); 296 297 case 'mssql': 298 $result = &$this->db_handle->getOne("SELECT @@IDENTITY"); 299 297 300 if (DB::isError($result)) 298 {299 301 raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 300 302 'message' => $result->getMessage()), TRUE, FALSE); 301 }302 303 303 304 return $result; … … 422 423 423 424 425 /* 426 * Return SQL function for current time and date 427 * 428 * @return string SQL function to use in query 429 * @access public 430 */ 431 function now() 432 { 433 switch($this->db_provider) 434 { 435 case 'mssql': 436 return "getdate()"; 437 438 default: 439 return "now()"; 440 } 441 } 442 443 424 444 /** 425 445 * Return SQL statement to convert a field value into a unix timestamp … … 435 455 case 'pgsql': 436 456 return "EXTRACT (EPOCH FROM $field)"; 437 break; 457 458 case 'mssql': 459 return "datediff(s, '1970-01-01 00:00:00', $field)"; 438 460 439 461 default: … … 457 479 case 'mysql': 458 480 case 'sqlite': 459 return "FROM_UNIXTIME($timestamp)";481 return sprintf("FROM_UNIXTIME(%d)", $timestamp); 460 482 461 483 default: -
trunk/roundcubemail/program/include/rcube_imap.inc
r326 r328 1765 1765 $this->db->query( 1766 1766 "UPDATE ".get_table_name('cache')." 1767 SET created= now(),1767 SET created=".$this->db->now().", 1768 1768 data=? 1769 1769 WHERE user_id=? … … 1779 1779 "INSERT INTO ".get_table_name('cache')." 1780 1780 (created, user_id, cache_key, data) 1781 VALUES ( now(), ?, ?, ?)",1781 VALUES (".$this->db->now().", ?, ?, ?)", 1782 1782 $_SESSION['user_id'], 1783 1783 $key, … … 1968 1968 "INSERT INTO ".get_table_name('messages')." 1969 1969 (user_id, del, cache_key, created, idx, uid, subject, ".$this->db->quoteIdentifier('from').", ".$this->db->quoteIdentifier('to').", cc, date, size, headers, structure) 1970 VALUES (?, 0, ?, now(), ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?, ?)",1970 VALUES (?, 0, ?, ".$this->db->now().", ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?, ?)", 1971 1971 $_SESSION['user_id'], 1972 1972 $key, -
trunk/roundcubemail/program/include/session.inc
r132 r328 71 71 $DB->query("UPDATE ".get_table_name('session')." 72 72 SET vars=?, 73 changed= now()73 changed=".$DB->now()." 74 74 WHERE sess_id=?", 75 75 $vars, … … 80 80 $DB->query("INSERT INTO ".get_table_name('session')." 81 81 (sess_id, vars, ip, created, changed) 82 VALUES (?, ?, ?, now(), now())",82 VALUES (?, ?, ?, ".$DB->now().", ".$DB->now().")", 83 83 $key, 84 84 $vars, … … 119 119 $sql_result = $DB->query("SELECT sess_id 120 120 FROM ".get_table_name('session')." 121 WHERE ".$DB->unixtimestamp( 'now()')."-".$DB->unixtimestamp('changed')." > ?",121 WHERE ".$DB->unixtimestamp($DB->now())."-".$DB->unixtimestamp('changed')." > ?", 122 122 $maxlifetime); 123 123 -
trunk/roundcubemail/program/steps/addressbook/save.inc
r327 r328 51 51 { 52 52 $DB->query("UPDATE $contacts_table 53 SET changed= now(), ".join(', ', $a_write_sql)."53 SET changed=".$DB->now().", ".join(', ', $a_write_sql)." 54 54 WHERE contact_id=? 55 55 AND user_id=? … … 173 173 { 174 174 $DB->query("INSERT INTO $contacts_table 175 (user_id, changed, del, ".join(', ', $a_insert_cols).")176 VALUES (?, now(), 0, ".join(', ', $a_insert_values).")",175 (user_id, changed, del, ".join(', ', $a_insert_cols).") 176 VALUES (?, ".$DB->now().", 0, ".join(', ', $a_insert_values).")", 177 177 $_SESSION['user_id']); 178 178 -
trunk/roundcubemail/program/steps/mail/addcontact.inc
r160 r328 44 44 $DB->query("INSERT INTO ".get_table_name('contacts')." 45 45 (user_id, changed, del, name, email) 46 VALUES (?, now(), 0, ?, ?)",46 VALUES (?, ".$DB->now().", 0, ?, ?)", 47 47 $_SESSION['user_id'], 48 48 $contact['name'],
Note: See TracChangeset
for help on using the changeset viewer.
