Skip to content

Commit

Permalink
Driver specific BEGIN
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1490 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Apr 23, 2010
1 parent 4681cc5 commit d0c72ec
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions adminer/drivers/mssql.inc.php
Expand Up @@ -394,6 +394,10 @@ function auto_increment() {
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"));
} }
Expand Down
7 changes: 7 additions & 0 deletions adminer/drivers/mysql.inc.php
Expand Up @@ -680,6 +680,13 @@ function trigger_options() {
); );
} }


/** 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
Expand Down
4 changes: 4 additions & 0 deletions adminer/drivers/pgsql.inc.php
Expand Up @@ -440,6 +440,10 @@ function trigger_options() {
); );
} }


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"));
} }
Expand Down
4 changes: 4 additions & 0 deletions adminer/drivers/sqlite.inc.php
Expand Up @@ -474,6 +474,10 @@ function trigger_options() {
); );
} }


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"));
} }
Expand Down
4 changes: 2 additions & 2 deletions adminer/select.inc.php
Expand Up @@ -126,7 +126,7 @@
$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);
Expand Down Expand Up @@ -313,7 +313,7 @@
$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]'>")
Expand Down

0 comments on commit d0c72ec

Please sign in to comment.