Skip to content

Commit 79325cb

Browse files
committed
attempt at a simpler version
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 0650cb5 commit 79325cb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/private/DB/AdapterOCI8.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public function fixupStatement($statement) {
2828
$statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
2929

3030
$statement = preg_replace(
31-
'/^INSERT INTO (".*")( ?\(.*) ?VALUES( ?\(.*)$/',
32-
'DECLARE vRowid ROWID; BEGIN INSERT INTO ${1} VALUES ${2}; RETURNING ROWID INTO vRowid dbms_output.put_line(vRowid); END;',
31+
'/^INSERT (INTO .+ VALUES \(.+\))$/',
32+
'INSERT ${1} RETURNING ROWID INTO vRowid',
3333
$statement
3434
);
3535

36+
var_dump($statement);
37+
3638
return $statement;
3739
}
3840
}

lib/private/DB/OracleConnection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public function tableExists($table) {
9696
*
9797
* This method supports PDO binding types as well as DBAL mapping types.
9898
*
99-
* @param string $sql The SQL query.
100-
* @param array $params The query parameters.
101-
* @param array $types The parameter types.
99+
* @param string $sql The SQL query.
100+
* @param array $params The query parameters.
101+
* @param array $types The parameter types.
102102
*
103103
* @return int The number of affected rows, if the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned
104104
*
@@ -108,7 +108,7 @@ public function executeStatement($sql, array $params = [], array $types = []): i
108108
$returned = parent::executeStatement($sql, $params, $types);
109109

110110
var_dump($sql);
111-
if (preg_match('/^DECLARE vRowid ROWID; BEGIN INSERT INTO (.*) VALUES (.*) INTO (.*)$/', $sql, $matches)) {
111+
if (preg_match('/INSERT INTO ([^ ]+) VALUES .* RETURNING ROWID INTO vRowid$/', $sql, $matches)) {
112112
var_dump($returned);
113113
$this->lastInsertId[$matches[1]] = $returned;
114114
var_dump($this->lastInsertId);

0 commit comments

Comments
 (0)