phingofficial/phing — Issue #9: CreoleSQLExecTask fails with Oracle
Author: mrook
Created: 2012-01-04 14:30:22+00:00
State: open

I want to execute SQL code on a Oracle 10gR2 base but the Oracle driver throws an exception:
{{{
ORA-00911: invalid character
}}}

So I looked to the code and found that the trailing delimiter is not removed. Mysql doesn't care about it but Oracle does.
This is the patch I use to fix it:
{{{
Index: classes/phing/tasks/ext/CreoleSQLExecTask.php
===================================================================
--- classes/phing/tasks/ext/CreoleSQLExecTask.php	(revision 31)
+++ classes/phing/tasks/ext/CreoleSQLExecTask.php	(copie de travail)
@@ -390,7 +390,7 @@
|| $this->delimiterType == self::DELIM_ROW
&& $line == $this->delimiter) {
$this->log("SQL: " . $sql, PROJECT_MSG_VERBOSE);
- $this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter)), $out);
+ $this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter)) - 1, $out);
$sql = "";
}
}
}}}

I don't think many of you use this task but it would be cool to fix that for us in the next release.

Thanks