summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-03-22 18:36:40 +0100
committerBart Visscher <bartv@thisnet.nl>2013-07-21 23:17:36 +0200
commite3c5fea989f26a4ad16b841be25ea485c8aad8c4 (patch)
tree5586ad0984c0a3bf594c8101e02910195580c29d /lib/db.php
parentcd98ff1eafabf5b10ff67594b65d979a943afe09 (diff)
downloadnextcloud-server-e3c5fea989f26a4ad16b841be25ea485c8aad8c4.tar.gz
nextcloud-server-e3c5fea989f26a4ad16b841be25ea485c8aad8c4.zip
Move lastInsertId to adapter classes
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php29
1 files changed, 1 insertions, 28 deletions
diff --git a/lib/db.php b/lib/db.php
index a3233706109..c1c419df545 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -345,34 +345,7 @@ class OC_DB {
*/
public static function insertid($table=null) {
self::connect();
- $type = OC_Config::getValue( "dbtype", "sqlite" );
- if( $type === 'pgsql' ) {
- $result = self::executeAudited('SELECT lastval() AS id');
- $row = $result->fetchRow();
- self::raiseExceptionOnError($row, 'fetching row for insertid failed');
- return $row['id'];
- } else if( $type === 'mssql') {
- if($table !== null) {
- $table = self::$connection->replaceTablePrefix( $table );
- }
- return self::$connection->lastInsertId($table);
- }
- if( $type === 'oci' ) {
- if($table !== null) {
- $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
- $suffix = '_SEQ';
- $table = '"'.str_replace( '*PREFIX*', $prefix, $table ).$suffix.'"';
- }
- return self::$connection->lastInsertId($table);
- } else {
- if($table !== null) {
- $suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" );
- $table = self::$connection->replaceTablePrefix( $table ).$suffix;
- }
- $result = self::$connection->lastInsertId($table);
- }
- self::raiseExceptionOnError($result, 'insertid failed');
- return $result;
+ return self::$connection->lastInsertId($table);
}
/**