Skip to content

Commit e83dbac

Browse files
committed
small update
1 parent 24e728f commit e83dbac

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SQL builder.
3737
- all elements from an array (of any type - associative or not) which is used as placeholder parameter will be processed as specified in the placeholder and added to the query separated by comma: `select('?@', array('field1', 'field2'))` = ``` SELECT `field1`, `field2` ```
3838

3939
- associative arrays are processed by keys:
40-
- if key does not contain placeholders then it will generate `(<key> = '<escaped value>)'` (`=` will not be added if key contains `=`, `>` or `<`)
40+
- if key does not contain placeholders then it will generate `(<key> = '<escaped value>)'` (`=` will not be added if key ends with `=`, `>` or `<`)
4141
- if value is an array then `IN` will be used instead of `=`, all elements will be escaped and added to the query separated by comma and in brackets
4242
- if key contains placeholders ("?" symbol, except "??") then values (they should be in array, non-array value will be used as array with one element) will be used as parameters for placeholders:
4343
- one array can have different types of keys

test.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@
8686

8787
echo '==========', "\n";
8888

89-
var_dump(strval( $d->where('x LIKE ?_ OR y = ?* OR ?_', '%1/2\3\'?_??%', 'NO\'W()', array('z' => '9', 'zz' => 0)) ));
89+
var_dump(strval( $d->where(array(
90+
'x' => 1,
91+
'y >' => 2,
92+
'z' => array(1, 2, 3),
93+
'x IN (?_) OR y IN (?_)' => array(array(1,2,3), array(4,5,6)),
94+
)) ));
9095

9196
echo '==========', "\n";
9297

93-
var_dump(strval( $d->where(array('x IN (?_) OR y IN (?_)' => array(array(1,2,3), array(4,5,6)))) ));
98+
var_dump(strval( $d->where('x LIKE ?_ OR y = ?* OR ?_', '%1/2\3\'?_??%', 'NO\'W()', array('z' => '9', 'zz' => 0)) ));
9499

95100
echo '==========', "\n";

0 commit comments

Comments
 (0)