Commit d61612df authored by rongzhj's avatar rongzhj

re-formatted code

parent 75030a1e
...@@ -821,20 +821,20 @@ class MysqliDb ...@@ -821,20 +821,20 @@ class MysqliDb
} }
foreach ($this->_updateColumns as $column) { foreach ($this->_updateColumns as $column) {
$this->_query .= "`" . $column . "` = "; $this->_query .= "`" . $column . "` = ";
// Simple value // Simple value
if (!is_array ($tableData[$column])) { if (!is_array ($tableData[$column])) {
$this->_bindParam($tableData[$column]); $this->_bindParam($tableData[$column]);
$this->_query .= '?, '; $this->_query .= '?, ';
continue; continue;
} }
// Function value // Function value
$arr = $tableData[$column]; $arr = $tableData[$column];
$key = key($arr); $key = key($arr);
$val = $arr[$key]; $val = $arr[$key];
switch ($key) { switch ($key) {
case '[I]': case '[I]':
$this->_query .= $column . $val . ", "; $this->_query .= $column . $val . ", ";
break; break;
...@@ -851,7 +851,7 @@ class MysqliDb ...@@ -851,7 +851,7 @@ class MysqliDb
break; break;
default: default:
die ("Wrong operation"); die ("Wrong operation");
} }
} }
$this->_query = rtrim($this->_query, ', '); $this->_query = rtrim($this->_query, ', ');
} }
......
...@@ -32,7 +32,7 @@ $tables = Array ( ...@@ -32,7 +32,7 @@ $tables = Array (
'updatedAt' => 'datetime', 'updatedAt' => 'datetime',
'expires' => 'datetime', 'expires' => 'datetime',
'loginCount' => 'int(10) default 0', 'loginCount' => 'int(10) default 0',
'unique key' => 'login (login)' 'unique key' => 'login (login)'
), ),
'products' => Array ( 'products' => Array (
'customerId' => 'int(10) not null', 'customerId' => 'int(10) not null',
...@@ -178,16 +178,16 @@ if ($db->count != 3) { ...@@ -178,16 +178,16 @@ if ($db->count != 3) {
// insert with on duplicate key update // insert with on duplicate key update
$user = Array ('login' => 'user3', $user = Array ('login' => 'user3',
'active' => true, 'active' => true,
'customerId' => 11, 'customerId' => 11,
'firstName' => 'Pete', 'firstName' => 'Pete',
'lastName' => 'D', 'lastName' => 'D',
'password' => $db->func('SHA1(?)',Array ("secretpassword2+salt")), 'password' => $db->func('SHA1(?)',Array ("secretpassword2+salt")),
'createdAt' => $db->now(), 'createdAt' => $db->now(),
'updatedAt' => $db->now(), 'updatedAt' => $db->now(),
'expires' => $db->now('+1Y'), 'expires' => $db->now('+1Y'),
'loginCount' => $db->inc(3) 'loginCount' => $db->inc(3)
); );
$updateColumns = Array ("updatedAt"); $updateColumns = Array ("updatedAt");
$insertLastId = "id"; $insertLastId = "id";
$db->onDuplicate($updateColumns, "id"); $db->onDuplicate($updateColumns, "id");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment