mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 17:14:07 +02:00
Allow disabling auto_increment value export
This commit is contained in:
@@ -828,11 +828,16 @@ if (!defined("DRIVER")) {
|
||||
|
||||
/** Get SQL command to create table
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return string
|
||||
*/
|
||||
function create_sql($table) {
|
||||
function create_sql($table, $auto_increment) {
|
||||
global $connection;
|
||||
return $connection->result("SHOW CREATE TABLE " . table($table), 1);
|
||||
$return = $connection->result("SHOW CREATE TABLE " . table($table), 1);
|
||||
if (!$auto_increment) {
|
||||
$return = preg_replace('~ AUTO_INCREMENT=[0-9]+~', '', $return); //! skip comments
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/** Get SQL command to truncate table
|
||||
|
@@ -521,9 +521,12 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function create_sql($table) {
|
||||
function create_sql($table, $auto_increment) {
|
||||
global $connection;
|
||||
return $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . $connection->quote($table));
|
||||
return ($auto_increment || $table != "sqlite_sequence" //! remove also INSERT
|
||||
? $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . $connection->quote($table))
|
||||
: ""
|
||||
);
|
||||
}
|
||||
|
||||
function truncate_sql($table) {
|
||||
|
Reference in New Issue
Block a user