33 $configuration = array(
34 'handlerCfg' => array(
43 'tx_templavoila_tmplobj' => array(
44 'mapFieldNames' => array(
45 'datastructure' =>
'ds',
49 'mapFieldNames' => array(
57 $this->subject = $this->prepareSubject(
'mssql', $configuration);
64 $this->assertTrue($this->subject->runningADOdbDriver(
'mssql'));
72 $expected =
'SELECT * FROM "fe_users" WHERE \',\'+"usergroup"+\',\' LIKE \'%,10,%\'';
73 $result = $this->subject->SELECTquery(
'*',
'fe_users',
'FIND_IN_SET(10, usergroup)');
82 $parseString =
'SELECT * FROM pages WHERE title=\'1\'\'\' AND deleted=0';
83 $components = $this->subject->SQLparser->_callRef(
'parseSELECT', $parseString);
85 $this->assertTrue(is_array($components), $components);
86 $this->assertEmpty($components[
'parseString']);
98 $selectFields =
'uid, FirstName, LastName';
99 $fromTables =
'Members';
100 $whereClause =
'pid=0 AND cruser_id=1';
104 $remappedParameters = $this->subject->_call(
'map_remapSELECTQueryParts', $selectFields, $fromTables, $whereClause, $groupBy, $orderBy);
105 $result = $this->subject->_call(
'SELECTqueryFromArray', $remappedParameters);
106 $expected =
'SELECT "MemberID", "FirstName", "LastName" FROM "Members" WHERE 0 = 0 AND 1 = 1';
118 $result = $this->subject->SELECTquery(
'*, CASE WHEN' .
' LOCATE(' . $this->subject->fullQuoteStr(
'(fce)',
'tx_templavoila_tmplobj') .
', datastructure)>0 THEN 2' .
' ELSE 1' .
' END AS scope',
'tx_templavoila_tmplobj',
'1=1');
119 $expected =
'SELECT *, CASE WHEN CHARINDEX(\'(fce)\', "datastructure") > 0 THEN 2 ELSE 1 END AS "scope" FROM "tx_templavoila_tmplobj" WHERE 1 = 1';
128 $result = $this->subject->SELECTquery(
'*, CASE WHEN' .
' LOCATE(' . $this->subject->fullQuoteStr(
'(fce)',
'tx_templavoila_tmplobj') .
', datastructure, 4)>0 THEN 2' .
' ELSE 1' .
' END AS scope',
'tx_templavoila_tmplobj',
'1=1');
129 $expected =
'SELECT *, CASE WHEN CHARINDEX(\'(fce)\', "datastructure", 4) > 0 THEN 2 ELSE 1 END AS "scope" FROM "tx_templavoila_tmplobj" WHERE 1 = 1';
138 $selectFields =
'*, CASE WHEN' .
' LOCATE(' . $this->subject->fullQuoteStr(
'(fce)',
'tx_templavoila_tmplobj') .
', datastructure, 4)>0 THEN 2' .
' ELSE 1' .
' END AS scope';
139 $fromTables =
'tx_templavoila_tmplobj';
140 $whereClause =
'1=1';
143 $remappedParameters = $this->subject->_call(
'map_remapSELECTQueryParts', $selectFields, $fromTables, $whereClause, $groupBy, $orderBy);
145 $result = $this->subject->_call(
'SELECTqueryFromArray', $remappedParameters);
146 $expected =
'SELECT *, CASE WHEN CHARINDEX(\'(fce)\', "ds", 4) > 0 THEN 2 ELSE 1 END AS "scope" FROM "tx_templavoila_tmplobj" WHERE 1 = 1';
155 $selectFields =
'*, CASE WHEN' .
' LOCATE(' . $this->subject->fullQuoteStr(
'(fce)',
'tx_templavoila_tmplobj') .
', tx_templavoila_tmplobj.datastructure, 4)>0 THEN 2' .
' ELSE 1' .
' END AS scope';
156 $fromTables =
'tx_templavoila_tmplobj';
157 $whereClause =
'1=1';
160 $remappedParameters = $this->subject->_call(
'map_remapSELECTQueryParts', $selectFields, $fromTables, $whereClause, $groupBy, $orderBy);
162 $result = $this->subject->_call(
'SELECTqueryFromArray', $remappedParameters);
163 $expected =
'SELECT *, CASE WHEN CHARINDEX(\'(fce)\', "tx_templavoila_tmplobj"."ds", 4) > 0 THEN 2 ELSE 1 END AS "scope" FROM "tx_templavoila_tmplobj" WHERE 1 = 1';
172 $result = $this->subject->SELECTquery(
'*',
'tt_news_cat_mm',
'IFNULL(tt_news_cat_mm.uid_foreign,0) IN (21,22)');
173 $expected =
'SELECT * FROM "tt_news_cat_mm" WHERE ISNULL("tt_news_cat_mm"."uid_foreign", 0) IN (21,22)';
182 $result = $this->subject->SELECTquery(
184 'index_section ISEC, index_fulltext IFT',
185 'IFT.fulltextdata LIKE \'%' . $this->subject->quoteStr(
"Don't worry",
'index_fulltext')
186 .
'%\' AND ISEC.phash = IFT.phash',
189 $expected =
'SELECT "ISEC"."phash" FROM "index_section" "ISEC", "index_fulltext" "IFT" WHERE "IFT"."fulltextdata" LIKE \'%Don\'\'t worry%\' AND "ISEC"."phash" = "IFT"."phash" GROUP BY "ISEC"."phash"';
locateStatementIsProperlyRemapped()
locateStatementWithPositionIsProperlyQuoted()
IfNullIsProperlyRemapped()
singleQuotesAreProperlyEscaped()
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
locateStatementIsProperlyQuoted()
runningADOdbDriverReturnsTrueWithMssqlForMssqlDefaultDriverConfiguration()
findInSetIsProperlyRemapped()
locateStatementWithExternalTableIsProperlyRemapped()