Yaron Koren has uploaded a new change for review. https://gerrit.wikimedia.org/r/254924
Change subject: Added quotes around fields names in some SQL calls ...................................................................... Added quotes around fields names in some SQL calls Really just a cosmetic change, given the restrictions on field names. Change-Id: I466207cea756abf7dbd18fdfbfe05df205131288 --- M CargoUtils.php M parserfunctions/CargoStore.php 2 files changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo refs/changes/24/254924/1 diff --git a/CargoUtils.php b/CargoUtils.php index 1c7e9b7..047f210 100644 --- a/CargoUtils.php +++ b/CargoUtils.php @@ -382,7 +382,7 @@ // just be text $createSQL .= $stringTypeString; } else { - $createSQL .= ", $fieldName "; + $createSQL .= ", " . $cdb->addIdentifierQuotes( $fieldName ); $createSQL .= self::fieldTypeToSQLType( $fieldType, $dbType, $size ); } diff --git a/parserfunctions/CargoStore.php b/parserfunctions/CargoStore.php index 2dfb53d..1276617 100644 --- a/parserfunctions/CargoStore.php +++ b/parserfunctions/CargoStore.php @@ -303,8 +303,18 @@ } } + // Put quotes around everything - this doesn't help with + // anything, but it might in the future, if Cargo becomes + // more permissive about field naming. + $quotedFieldValues = array(); + foreach( $tableFieldValues as $fieldName => $fieldValue ) { + $quotedFieldName = $cdb->addIdentifierQuotes( $fieldName ); + $quotedFieldValues[$quotedFieldName] = $fieldValue; + } + // Insert the current data into the main table. - $cdb->insert( $tableName, $tableFieldValues ); + $cdb->insert( $tableName, $quotedFieldValues ); + // This close() call, for some reason, is necessary for the // subsequent SQL to be called correctly, when jobs are run // in the standard way. -- To view, visit https://gerrit.wikimedia.org/r/254924 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I466207cea756abf7dbd18fdfbfe05df205131288 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cargo Gerrit-Branch: master Gerrit-Owner: Yaron Koren <yaro...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits