-
Cool. Nice first step. There are a few things missing though :) First, the methods for syntax that is also supported by other DBMS (we check sqlite normally) should be added to the DMLQueryBuilderInterface. Second, some of those new methods may need new escaping methods, or work slightly differently. I'm thinking of REGEX here for example. WHERE IN may need brackets around the "right" part.
-
src/Lunr/DataAccess/MySQLDMLQueryBuilder.php (Diff revision 1) I prefer the ternary operator for this. Same for the others.
-
Change Summary:
Fixes the comments from Felipe and Heinz. Adds ON IN, ON BETWEEN, ON REGEXP, HAVING IN, HAVING BETWEEN, HAVING REGEXP Adds also 2 escaping methods for the .. IN
Diff: |
Revision 2 (+730 -1) |
---|
-
Still no entries in the DMLQueryBuilderInterface
-
src/Lunr/DataAccess/MySQLDMLQueryBuilder.php (Diff revisions 1 - 2) query_value is a more logical function name, IMHO
-
src/Lunr/DataAccess/MySQLDMLQueryBuilder.php (Diff revisions 1 - 2) you need to be careful with the escaping. Like this you would create: WHERE a IN ('SELECT foo FROM bar') but that would check for all rows where the value of a is actually 'SELECT foo FROM bar' rather than all possible values of the column foo in bar.
-
-
src/Lunr/DataAccess/MySQLDMLQueryBuilder.php (Diff revisions 1 - 2) Similar to before, you need to be careful with the escaping. You can't assume all input you get is a string. So beyond creating a list you can't do any special escaping because you know nothing about the values.
Change Summary:
Changed the name of the methods. The implementation of the methods changed as well. The methods now simply add the parentheses around the value and as a result the tests changed.
-
-
src/Lunr/DataAccess/DMLQueryBuilderInterface.php (Diff revision 3) probably an oversight that started with me in having_like. s/WHERE/HAVING/ :)
-
-
-
src/Lunr/DataAccess/DatabaseDMLQueryBuilder.php (Diff revision 3) This should be a String. Also make sure that there is only one space between type and value, and value and description
-
-
src/Lunr/DataAccess/Tests/DatabaseDMLQueryBuilderEscapeValuesTest.php (Diff revision 3) You might want additional checks here for the one element and multidimensional cases.
Change Summary:
Added a multidimensional check of a depth=1, for the list_value function.
Diff: |
Revision 4 (+795 -4)
|
---|
Change Summary:
Improved version of list_value()
Diff: |
Revision 5 (+785 -4)
|
---|
-
-
src/Lunr/DataAccess/DatabaseDMLQueryBuilder.php (Diff revisions 3 - 5) another case where I think the ternary op is enough :) return empty($value) ? '' : '(' . $value . ')';
-
src/Lunr/DataAccess/DatabaseDMLQueryBuilder.php (Diff revisions 3 - 5) I don't think this is the best way we can go. IMHO it's very confusing. I'd consider a multi-dim array invalid input. SO it really depends on how we want to handle it. If we want to do our own logging => foreach, else a simple implode is enough.
Change Summary:
code adjustments according to comments
Diff: |
Revision 6 (+979 -287)
|
---|