|
@@ 569-570 (lines=2) @@
|
| 566 |
|
queries("BEGIN");}function |
| 567 |
|
insert_into($h,$r){return |
| 568 |
|
queries("INSERT INTO ".table($h).($r?" (".implode(", ",array_keys($r)).")\nVALUES (".implode(", ",$r).")":"DEFAULT VALUES"));}function |
| 569 |
|
insert_update($h,$r,$Ma){global$g;$ra=array();$t=array();foreach($r |
| 570 |
|
as$d=>$b){$ra[]="$d = $b";if(isset($Ma[idf_unescape($d)])){$t[]="$d = $b";}}return($t&&queries("UPDATE ".table($h)." SET ".implode(", ",$ra)." WHERE ".implode(" AND ",$t))&&$g->affected_rows)||queries("INSERT INTO ".table($h)." (".implode(", ",array_keys($r)).") VALUES (".implode(", ",$r).")");}function |
| 571 |
|
last_id(){return |
| 572 |
|
0;}function |
| 573 |
|
explain($g,$i){return$g->query("EXPLAIN $i");}function |
|
@@ 812-813 (lines=2) @@
|
| 809 |
|
queries("BEGIN TRANSACTION");}function |
| 810 |
|
insert_into($h,$r){return |
| 811 |
|
queries("INSERT INTO ".table($h).($r?" (".implode(", ",array_keys($r)).")\nVALUES (".implode(", ",$r).")":"DEFAULT VALUES"));}function |
| 812 |
|
insert_update($h,$r,$Ma){$ra=array();$t=array();foreach($r |
| 813 |
|
as$d=>$b){$ra[]="$d = $b";if(isset($Ma[idf_unescape($d)])){$t[]="$d = $b";}}return |
| 814 |
|
queries("MERGE ".table($h)." USING (VALUES(".implode(", ",$r).")) AS source (c".implode(", c",range(1,count($r))).") ON ".implode(" AND ",$t)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$ra)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($r)).") VALUES (".implode(", ",$r).");");}function |
| 815 |
|
last_id(){global$g;return$g->result("SELECT SCOPE_IDENTITY()");}function |
| 816 |
|
explain($g,$i){$g->query("SET SHOWPLAN_ALL ON");$c=$g->query($i);$g->query("SET SHOWPLAN_ALL OFF");return$c;}function |