@@ -111,6 +111,46 @@ The mysqli::real_escape_string requires a link. But, the link is one of many.
111111Last minute escaping once the command and connection were married from the pool.
112112Could potentially have one dedicated link for escaping.
113113
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+
114154## Credits
115155
116156Much appreciation to the hard work over at [ reactphp/react] ( https://github.com/reactphp/react ) .
0 commit comments