diff options
author | David M <davidmj@users.sourceforge.net> | 2006-09-19 04:50:02 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-09-19 04:50:02 +0000 |
commit | b7dab9cdab72b6463121856d26dcfea0eb0df376 (patch) | |
tree | 661d707f54a7c4b4dfb37c3a01de548446d52dfe /phpBB/includes/db/oracle.php | |
parent | ea065f3e67ee0c0cb28c88569042461dd8cf2c27 (diff) | |
download | forums-b7dab9cdab72b6463121856d26dcfea0eb0df376.tar forums-b7dab9cdab72b6463121856d26dcfea0eb0df376.tar.gz forums-b7dab9cdab72b6463121856d26dcfea0eb0df376.tar.bz2 forums-b7dab9cdab72b6463121856d26dcfea0eb0df376.tar.xz forums-b7dab9cdab72b6463121856d26dcfea0eb0df376.zip |
- Oracle now works with large amounts of text
- MSSQL now works :P (sans UTF-8 support)
- The current schema files work well enough to install, etc. but must be tightened. Will get to it when I get some time...
git-svn-id: file:///svn/phpbb/trunk@6381 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/oracle.php')
-rw-r--r-- | phpBB/includes/db/oracle.php | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index b988bc6a3c..1d14d7b793 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -116,7 +116,63 @@ class dbal_oracle extends dbal $in_transaction = true; } + $array = array(); + + // We overcome Oracle's 4000 char limit by binding vars + if (preg_match('/^(INSERT INTO[^(]+)\\(([^()]+)\\) VALUES[^(]+\\(([^()]+)\\)$/', $query, $regs)) + { + if (strlen($regs[3]) > 4000) + { + $cols = explode(', ', $regs[2]); + $vals = explode(', ', $regs[3]); + foreach ($vals as $key => $value) + { + if (strlen($value) > 4002) // check to see if this thing is greater than the max + 'x2 + { + $vals[$key] = ':' . strtoupper($cols[$key]); + $array[$vals[$key]] = substr($value, 1, -1); + } + } + $query = $regs[1] . '(' . implode(', ', $cols) . ') VALUES (' . implode(', ', $vals) . ')'; + } + } + else if (preg_match('/^(UPDATE.*?)SET (.*)(\\sWHERE.*)$/s', $query, $regs)) + { + if (strlen($regs[2]) > 4000) + { + $args = explode(', ', $regs[2]); + $cols = array(); + foreach ($args as $value) + { + $temp_array = explode('=', $value); + $cols[$temp_array[0]] = $temp_array[1]; + } + + foreach ($cols as $col => $val) + { + if (strlen($val) > 4003) // check to see if this thing is greater than the max + 'x2 + a space + { + $cols[$col] = ' :' . strtoupper(rtrim($col)); + $array[ltrim($cols[$col])] = substr(trim($val), 2, -1); + } + } + + $art = array(); + foreach ($cols as $col => $val) + { + $art[] = $col . '=' . $val; + } + $query = $regs[1] . 'SET ' . implode(', ', $art) . $regs[3]; + } + } + $this->query_result = @ociparse($this->db_connect_id, $query); + + foreach ($array as $key => $value) + { + @ocibindbyname($this->query_result, $key, $array[$key], -1); + } + $success = @ociexecute($this->query_result, OCI_DEFAULT); if (!$success) @@ -383,7 +439,7 @@ class dbal_oracle extends dbal { $query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL'; $stmt = @ociparse($this->db_connect_id, $query); - @ociexecute($stmt, OCI_DEFAULT ); + @ociexecute($stmt, OCI_DEFAULT); $temp_result = @ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); @ocifreestatement($stmt); |