Driver specific BEGIN

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1490 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2010-04-23 23:49:21 +00:00
parent 4681cc56b0
commit d0c72eca93
5 changed files with 21 additions and 2 deletions

View file

@ -394,6 +394,10 @@ WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table)
return " IDENTITY"; return " IDENTITY";
} }
function begin() {
return queries("BEGIN TRANSACTION");
}
function insert_into($table, $set) { function insert_into($table, $set) {
return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }

View file

@ -680,6 +680,13 @@ if (!defined("DRIVER")) {
); );
} }
/** Begin transaction
* @return bool
*/
function begin() {
return queries("BEGIN");
}
/** Insert data into table /** Insert data into table
* @param string * @param string
* @param array * @param array

View file

@ -440,6 +440,10 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . $connection->qu
); );
} }
function begin() {
return queries("BEGIN");
}
function insert_into($table, $set) { function insert_into($table, $set) {
return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }

View file

@ -474,6 +474,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
); );
} }
function begin() {
return queries("BEGIN");
}
function insert_into($table, $set) { function insert_into($table, $set) {
return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }

View file

@ -126,7 +126,7 @@ if ($_POST && !$error) {
$cols = array_keys($fields); $cols = array_keys($fields);
preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches); preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches);
$affected = count($matches[0]); $affected = count($matches[0]);
queries("START TRANSACTION"); begin();
$separator = ($_POST["separator"] == "csv" ? "," : ";"); $separator = ($_POST["separator"] == "csv" ? "," : ";");
foreach ($matches[0] as $key => $val) { foreach ($matches[0] as $key => $val) {
preg_match_all("~((\"[^\"]*\")+|[^$separator]*)$separator~", $val . $separator, $matches2); preg_match_all("~((\"[^\"]*\")+|[^$separator]*)$separator~", $val . $separator, $matches2);
@ -313,7 +313,7 @@ if (!$columns) {
$id = h("val[$unique_idf][" . bracket_escape($key) . "]"); $id = h("val[$unique_idf][" . bracket_escape($key) . "]");
$value = $_POST["val"][$unique_idf][bracket_escape($key)]; $value = $_POST["val"][$unique_idf][bracket_escape($key)];
$h_value = h(isset($value) ? $value : $row[$key]); $h_value = h(isset($value) ? $value : $row[$key]);
$editable = is_utf8($val) && !strpos($val, "<em>...</em>"); $editable = is_utf8($val) && !strpos($val, "<em>...</em>"); //! function results, not unique key
$text = ereg('text|blob', $field["type"]); $text = ereg('text|blob', $field["type"]);
echo (($_GET["modify"] && $editable) || isset($value) echo (($_GET["modify"] && $editable) || isset($value)
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>") ? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")