@@ -111,6 +111,46 @@ The mysqli::real_escape_string requires a link. But, the link is one of many.
111
111
Last minute escaping once the command and connection were married from the pool.
112
112
Could potentially have one dedicated link for escaping.
113
113
114
+ ### Query Building Support
115
+
116
+ Many MySQL wrapper packages have been analyzed, but none are completely independent of
117
+ a connection object that could be found.
118
+
119
+ For now, we will escape parameters, but require the user to provide a sql query that quotes the parameters.
120
+
121
+ This is obviously sub-optimal since a variable like $created_at could be NOW() or '2016-01-01' or NULL.
122
+
123
+ The litmus test I have been using is the following query:
124
+
125
+ INSERT INTO `simple_table` (`id`, `name`, `value`, `created_at`)
126
+ VALUES (NULL, 'John\'s Name', 7, NOW());
127
+
128
+ The key points here are:
129
+
130
+ - Support for putting the parameter in quotes! This is the first step. The rest is intelligently knowing when not to quote.
131
+ - Support for a null value converted to NULL.
132
+ - Support for escaping the parameter using either \\\' or '' is fine.
133
+ - Support for not escaping functions such as NOW()
134
+ - Support for recognizing integer values. Optional, since '7' will work fine.
135
+
136
+ ### Wrapper Options Reviewed
137
+
138
+ 1 . [ nilportugues/php-sql-query-builder] ( https://github.com/nilportugues/php-sql-query-builder ) - No connection required! But, odd syntax.
139
+ 1 . [ usmanhalalit/pixie] ( https://github.com/usmanhalalit/pixie ) - Requires connection. Pretty close to needs.
140
+ 1 . [ joshcam/PHP-MySQLi-Database-Class] ( https://github.com/joshcam/PHP-MySQLi-Database-Class ) - Requires connection.
141
+ 1 . [ aviat4ion/Query] ( https://git.timshomepage.net/aviat4ion/Query ) - Requires connection.
142
+ 1 . [ rkrx/php-mysql-query-builder] ( https://github.com/rkrx/php-mysql-query-builder ) - Requires connection.
143
+ 1 . [ stefangabos/Zebra_Database] ( https://github.com/stefangabos/Zebra_Database ) - Requires connection, does more than needed.
144
+ 1 . [ indeyets/MySQL-Query-Builder] ( https://github.com/indeyets/MySQL-Query-Builder ) - Not maintained. Odd syntax.
145
+
146
+ The nilportugues/php-sql-query-builder package is very close, but it does not quote the parameters.
147
+
148
+ ## Install
149
+
150
+ The recommended way to install this library is through Composer.
151
+
152
+ $ composer require dustingraham/react-mysql
153
+
114
154
## Credits
115
155
116
156
Much appreciation to the hard work over at [ reactphp/react] ( https://github.com/reactphp/react ) .
0 commit comments