Skip to content

Commit

Permalink
Remove ? (numerical) params
Browse files Browse the repository at this point in the history
  • Loading branch information
kikimor committed Mar 18, 2015
1 parent 7b9e0a9 commit 58974ef
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
20 changes: 0 additions & 20 deletions Oci8.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,6 @@ public function prepare($statement, $options = null)
$options = $this->_options;
}

// Skip replacing ? with a pseudo named parameter on alter/create table command
if ( ! preg_match('/^alter+ +table/', strtolower(trim($statement)))
and ! preg_match('/^create+ +table/', strtolower(trim($statement)))
)
{
// Replace ? with a pseudo named parameter
$newStatement = null;
$parameter = 0;
while ($newStatement !== $statement)
{
if ($newStatement !== null)
{
$statement = $newStatement;
}
$newStatement = preg_replace('/\?/', ':autoparam' . $parameter, $statement, 1);
$parameter++;
}
$statement = $newStatement;
}

// check if statement is insert function
if (strpos(strtolower($statement), 'insert into') !== false)
{
Expand Down
3 changes: 1 addition & 2 deletions Oci8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,9 @@ public function bindParam(
$maxLength = -1,
$options = [Oci8::LOB_SQL])
{
//Replace the first @oci8param to a pseudo named parameter
if (is_numeric($parameter))
{
$parameter = ':autoparam' . $parameter;
throw new Oci8Exception("bind numerical params has not been implemented");
}

if ($dataType == PDO::PARAM_LOB) {
Expand Down

0 comments on commit 58974ef

Please sign in to comment.