Issue #301 Fix MySQL quote issue for table options #302

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

rncain commented Feb 25, 2012

Fixed quoting MySQL vendor params on tables which caused syntax error problems

Issue #301

@willdurand willdurand commented on the diff Feb 28, 2012

generator/lib/platform/MysqlPlatform.php
@@ -235,17 +235,26 @@ protected function getTableOptions(Table $table)
'Union' => 'UNION',
);
foreach ($supportedOptions as $name => $sqlName) {
+
+ $parameterValue = NULL;
@willdurand

willdurand Feb 28, 2012

Owner

it seems the indentation is wrong

@willdurand willdurand commented on the diff Feb 28, 2012

generator/lib/platform/MysqlPlatform.php
}
+
+ //if we have a param value, then parse it out
@willdurand

willdurand Feb 28, 2012

Owner

useless comment sir

@willdurand willdurand commented on the diff Feb 28, 2012

generator/lib/platform/MysqlPlatform.php
}
+
+ //if we have a param value, then parse it out
+ if( !is_null( $parameterValue ) ){
@willdurand

willdurand Feb 28, 2012

Owner

bad CS, should be:

if (!is_null($parameterValue)) {

@willdurand willdurand commented on the diff Feb 28, 2012

generator/lib/platform/MysqlPlatform.php
}
+
+ //if we have a param value, then parse it out
+ if( !is_null( $parameterValue ) ){
+
+ //if the value is numeric, then there is no need for quotes
+ $parameterValue = is_numeric( $parameterValue ) ? $parameterValue : $this->quote( $parameterValue );
@willdurand

willdurand Feb 28, 2012

Owner

Gosh.. avoid spaces after parenthesis.

is_numeric($parameterValue) ? $parameterValue : $this->quote($parameterValue);
@rncain

rncain Feb 28, 2012

Contributor

Do you have a coding standards doc for your project?

@willdurand willdurand commented on the diff Feb 28, 2012

generator/lib/platform/MysqlPlatform.php
}
+
+ //if we have a param value, then parse it out
+ if( !is_null( $parameterValue ) ){
+
+ //if the value is numeric, then there is no need for quotes
+ $parameterValue = is_numeric( $parameterValue ) ? $parameterValue : $this->quote( $parameterValue );
+
+ $tableOptions []= sprintf( '%s=%s', $sqlName, $parameterValue );
@willdurand

willdurand Feb 28, 2012

Owner

same here

and:

$tableOptions[] =
Owner

willdurand commented Feb 28, 2012

Nice fix, please fix your code, and I'll be glad to merge your PR :)

Owner

willdurand commented Mar 5, 2012

Ping @rncain

Owner

willdurand commented Mar 5, 2012

Merged, thanks. Can you port this patch on Propel2?

willdurand closed this Mar 5, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment