mirror of
https://codeberg.org/vlw/wp.git
synced 2026-02-26 03:51:58 +01:00
feat: add method for querying the current AUTO_INCREMENT for a table
This commit is contained in:
parent
b14c14d9b3
commit
873c1d592b
1 changed files with 13 additions and 0 deletions
|
|
@ -76,6 +76,19 @@
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current AUTO_INCREMENT value for a given table
|
||||||
|
*
|
||||||
|
* @param string $table
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function latest(string $table): int {
|
||||||
|
return $this->execute_query("SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?", [
|
||||||
|
self::$name,
|
||||||
|
self::get_table($table)
|
||||||
|
])->fetch_assoc()["AUTO_INCREMENT"];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch and set the WordPress siteurl from the options table
|
* Fetch and set the WordPress siteurl from the options table
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue