@@ -84,7 +84,7 @@ public function TableExists($name)
8484
8585 public function QuoteIdentifier ($ str )
8686 {
87- return str_replace (array ("\"" , "? " ), array ( "\"\"" , "" ) , $ str );
87+ return str_replace (array ("' " , " \"" , "? " ), "" , $ str );
8888 }
8989
9090 // This function is used to get the last inserted sequence value by table name.
@@ -150,11 +150,22 @@ protected function GenerateSQL(&$master, &$sql, &$opts, $cmd, $queryinfo, $args,
150150 "PREINTO " => array (),
151151 "POSTVALUES " => array ("RETURNING " => "key_identifier " ),
152152 "SELECT " => true ,
153+ "BULKINSERT " => false
153154 );
154155
155156 $ result = $ this ->ProcessINSERT ($ master , $ sql , $ opts , $ queryinfo , $ args , $ subquery , $ supported );
156157 if ($ result ["success " ] && isset ($ queryinfo ["AUTO INCREMENT " ])) $ result ["filter_opts " ] = array ("mode " => "INSERT " , "queryinfo " => $ queryinfo );
157158
159+ // Handle bulk insert by rewriting the queries because, well, Oracle.
160+ // http://stackoverflow.com/questions/39576/best-way-to-do-multi-row-insert-in-oracle
161+ if ($ result ["success " ] && is_array ($ sql ))
162+ {
163+ $ sql2 = "INSERT ALL " ;
164+ foreach ($ sql as $ entry ) $ sql2 .= substr ($ entry , 6 );
165+ $ sql2 .= " SELECT 1 FROM DUAL " ;
166+ $ sql = $ sql2 ;
167+ }
168+
158169 return $ result ;
159170 }
160171 case "UPDATE " :
@@ -344,6 +355,12 @@ protected function GenerateSQL(&$master, &$sql, &$opts, $cmd, $queryinfo, $args,
344355
345356 return array ("success " => true , "filter_opts " => array ("mode " => "SHOW CREATE TABLE " , "hints " => (isset ($ queryinfo ["EXPORT HINTS " ]) ? $ queryinfo ["EXPORT HINTS " ] : array ())));
346357 }
358+ case "BULK IMPORT MODE " :
359+ {
360+ $ master = true ;
361+
362+ return array ("success " => false , "errorcode " => "skip_sql_query " );
363+ }
347364 }
348365
349366 return array ("success " => false , "error " => CSDB ::DB_Translate ("Unknown query command '%s'. " , $ cmd ), "errorcode " => "unknown_query_command " );
0 commit comments