A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

759 lines
23 KiB

12 years ago
  1. # node-mysql
  2. [![Build Status](https://secure.travis-ci.org/felixge/node-mysql.png)](http://travis-ci.org/felixge/node-mysql)
  3. ## Install
  4. ```bash
  5. npm install mysql@2.0.0-alpha5
  6. ```
  7. Despite the alpha tag, this is the recommended version for new applications.
  8. For information about the previous 0.9.x releases, visit the [v0.9 branch][].
  9. Sometimes I may also ask you to install the latest version from Github to check
  10. if a bugfix is working. In this case, please do:
  11. ```
  12. npm install git://github.com/felixge/node-mysql.git
  13. ```
  14. [v0.9 branch]: https://github.com/felixge/node-mysql/tree/v0.9
  15. ## Introduction
  16. This is a node.js driver for mysql. It is written in JavaScript, does not
  17. require compiling, and is 100% MIT licensed.
  18. Here is an example on how to use it:
  19. ```js
  20. var mysql = require('mysql');
  21. var connection = mysql.createConnection({
  22. host : 'localhost',
  23. user : 'me',
  24. password : 'secret',
  25. });
  26. connection.connect();
  27. connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
  28. if (err) throw err;
  29. console.log('The solution is: ', rows[0].solution);
  30. });
  31. connection.end();
  32. ```
  33. From this example, you can learn the following:
  34. * Every method you invoke on a connection is queued and executed in sequence.
  35. * Closing the connection is done using `end()` which makes sure all remaining
  36. queries are executed before sending a quit packet to the mysql server.
  37. ## Contributors
  38. Thanks goes to the people who have contributed code to this module, see the
  39. [GitHub Contributors page][].
  40. [GitHub Contributors page]: https://github.com/felixge/node-mysql/graphs/contributors
  41. Additionally I'd like to thank the following people:
  42. * [Andrey Hristov][] (Oracle) - for helping me with protocol questions.
  43. * [Ulf Wendel][] (Oracle) - for helping me with protocol questions.
  44. [Ulf Wendel]: http://blog.ulf-wendel.de/
  45. [Andrey Hristov]: http://andrey.hristov.com/
  46. ## Sponsors
  47. The following companies have supported this project financially, allowing me to
  48. spend more time on it (ordered by time of contribution):
  49. * [Transloadit](http://transloadit.com) (my startup, we do file uploading &
  50. video encoding as a service, check it out)
  51. * [Joyent](http://www.joyent.com/)
  52. * [pinkbike.com](http://pinkbike.com/)
  53. * [Holiday Extras](http://www.holidayextras.co.uk/) (they are [hiring](http://join.holidayextras.co.uk/vacancy/senior-web-technologist/))
  54. * [Newscope](http://newscope.com/) (they are [hiring](http://www.newscope.com/stellenangebote))
  55. If you are interested in sponsoring a day or more of my time, please
  56. [get in touch][].
  57. [get in touch]: http://felixge.de/consulting
  58. ## Community
  59. If you'd like to discuss this module, or ask questions about it, please use one
  60. of the following:
  61. * **Mailing list**: https://groups.google.com/forum/#!forum/node-mysql
  62. * **IRC Channel**: #node.js (on freenode.net, I pay attention to any message
  63. including the term `mysql`)
  64. ## Establishing connections
  65. The recommended way to establish a connection is this:
  66. ```js
  67. var mysql = require('mysql');
  68. var connection = mysql.createConnection({
  69. host : 'example.org',
  70. user : 'bob',
  71. password : 'secret',
  72. });
  73. connection.connect(function(err) {
  74. // connected! (unless `err` is set)
  75. });
  76. ```
  77. However, a connection can also be implicitly established by invoking a query:
  78. ```js
  79. var mysql = require('mysql');
  80. var connection = mysql.createConnection(...);
  81. connection.query('SELECT 1', function(err, rows) {
  82. // connected! (unless `err` is set)
  83. });
  84. ```
  85. Depending on how you like to handle your errors, either method may be
  86. appropriate. Any type of connection error (handshake or network) is considered
  87. a fatal error, see the [Error Handling](#error-handling) section for more
  88. information.
  89. ## Connection options
  90. When establishing a connection, you can set the following options:
  91. * `host`: The hostname of the database you are connecting to. (Default:
  92. `localhost`)
  93. * `port`: The port number to connect to. (Default: `3306`)
  94. * `socketPath`: The path to a unix domain socket to connect to. When used `host`
  95. and `port` are ignored.
  96. * `user`: The MySQL user to authenticate as.
  97. * `password`: The password of that MySQL user.
  98. * `database`: Name of the database to use for this connection (Optional).
  99. * `charset`: The charset for the connection. (Default: `'UTF8_GENERAL_CI'`)
  100. * `timezone`: The timezone used to store local dates. (Default: `'local'`)
  101. * `insecureAuth`: Allow connecting to MySQL instances that ask for the old
  102. (insecure) authentication method. (Default: `false`)
  103. * `typeCast`: Determines if column values should be converted to native
  104. JavaScript types. (Default: `true`)
  105. * `queryFormat`: A custom query format function. See [Custom format](#custom-format).
  106. * `debug`: Prints protocol details to stdout. (Default: `false`)
  107. * `multipleStatements`: Allow multiple mysql statements per query. Be careful
  108. with this, it exposes you to SQL injection attacks. (Default: `false)
  109. * `flags`: List of connection flags to use other than the default ones. It is
  110. also possible to blacklist default ones. For more information, check [Connection Flags](#connection-flags).
  111. In addition to passing these options as an object, you can also use a url
  112. string. For example:
  113. ```js
  114. var connection = mysql.createConnection('mysql://user:pass@host/db?debug=true&charset=BIG5_CHINESE_CI&timezone=-0700');
  115. ```
  116. Note: The query values are first attempted to be parsed as JSON, and if that
  117. fails assumed to be plaintext strings.
  118. ## Terminating connections
  119. There are two ways to end a connection. Terminating a connection gracefully is
  120. done by calling the `end()` method:
  121. ```js
  122. connection.end(function(err) {
  123. // The connection is terminated now
  124. });
  125. ```
  126. This will make sure all previously enqueued queries are still before sending a
  127. `COM_QUIT` packet to the MySQL server. If a fatal error occurs before the
  128. `COM_QUIT` packet can be sent, an `err` argument will be provided to the
  129. callback, but the connection will be terminated regardless of that.
  130. An alternative way to end the connection is to call the `destroy()` method.
  131. This will cause an immediate termination of the underlying socket.
  132. Additionally `destroy()` guarantees that no more events or callbacks will be
  133. triggered for the connection.
  134. ```js
  135. connection.destroy();
  136. ```
  137. Unlike `end()` the `destroy()` method does not take a callback argument.
  138. ## Switching users / altering connection state
  139. MySQL offers a changeUser command that allows you to alter the current user and
  140. other aspects of the connection without shutting down the underlying socket:
  141. ```js
  142. connection.changeUser({user : 'john'}, function(err) {
  143. if (err) throw err;
  144. });
  145. ```
  146. The available options for this feature are:
  147. * `user`: The name of the new user (defaults to the previous one).
  148. * `password`: The password of the new user (defaults to the previous one).
  149. * `charset`: The new charset (defaults to the previous one).
  150. * `database`: The new database (defaults to the previous one).
  151. A sometimes useful side effect of this functionality is that this function also
  152. resets any connection state (variables, transactions, etc.).
  153. Errors encountered during this operation are treated as fatal connection errors
  154. by this module.
  155. ## Server disconnects
  156. You may lose the connection to a MySQL server due to network problems, the
  157. server timing you out, or the server crashing. All of these events are
  158. considered fatal errors, and will have the `err.code =
  159. 'PROTOCOL_CONNECTION_LOST'`. See the [Error Handling](#error-handling) section
  160. for more information.
  161. The best way to handle such unexpected disconnects is shown below:
  162. ```js
  163. function handleDisconnect(connection) {
  164. connection.on('error', function(err) {
  165. if (!err.fatal) {
  166. return;
  167. }
  168. if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
  169. throw err;
  170. }
  171. console.log('Re-connecting lost connection: ' + err.stack);
  172. connection = mysql.createConnection(connection.config);
  173. handleDisconnect(connection);
  174. connection.connect();
  175. });
  176. }
  177. handleDisconnect(connection);
  178. ```
  179. As you can see in the example above, re-connecting a connection is done by
  180. establishing a new connection. Once terminated, an existing connection object
  181. cannot be re-connected by design.
  182. This logic will also be part of connection pool support once I add that to this
  183. library.
  184. ## Escaping query values
  185. In order to avoid SQL Injection attacks, you should always escape any user
  186. provided data before using it inside a SQL query. You can do so using the
  187. `connection.escape()` method:
  188. ```js
  189. var userId = 'some user provided value';
  190. var sql = 'SELECT * FROM users WHERE id = ' + connection.escape(userId);
  191. connection.query(sql, function(err, results) {
  192. // ...
  193. });
  194. ```
  195. Alternatively, you can use `?` characters as placeholders for values you would
  196. like to have escaped like this:
  197. ```js
  198. connection.query('SELECT * FROM users WHERE id = ?', [userId], function(err, results) {
  199. // ...
  200. });
  201. ```
  202. This looks similar to prepared statements in MySQL, however it really just uses
  203. the same `connection.escape()` method internally.
  204. Different value types are escaped differently, here is how:
  205. * Numbers are left untouched
  206. * Booleans are converted to `true` / `false` strings
  207. * Date objects are converted to `'YYYY-mm-dd HH:ii:ss'` strings
  208. * Buffers are converted to hex strings, e.g. `X'0fa5'`
  209. * Strings are safely escaped
  210. * Arrays are turned into list, e.g. `['a', 'b']` turns into `'a', 'b'`
  211. * Nested arrays are turned into grouped lists (for bulk inserts), e.g. `[['a',
  212. 'b'], ['c', 'd']]` turns into `('a', 'b'), ('c', 'd')`
  213. * Objects are turned into `key = 'val'` pairs. Nested objects are cast to
  214. strings.
  215. * `undefined` / `null` are converted to `NULL`
  216. * `NaN` / `Infinity` are left as-is. MySQL does not support these, and trying
  217. to insert them as values will trigger MySQL errors until they implement
  218. support.
  219. If you paid attention, you may have noticed that this escaping allows you
  220. to do neat things like this:
  221. ```js
  222. var post = {id: 1, title: 'Hello MySQL'};
  223. var query = connection.query('INSERT INTO posts SET ?', post, function(err, result) {
  224. // Neat!
  225. });
  226. console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL'
  227. ```
  228. If you feel the need to escape queries by yourself, you can also use the escaping
  229. function directly:
  230. ```js
  231. var query = "SELECT * FROM posts WHERE title=" + mysql.escape("Hello MySQL");
  232. console.log(query); // SELECT * FROM posts WHERE title='Hello MySQL'
  233. ```
  234. ## Escaping query identifiers
  235. If you can't trust an SQL identifier (database / table / column name) because it is
  236. provided by a user, you should escape it with `mysql.escapeId(identifier)` like this:
  237. ```js
  238. var sorter = 'date';
  239. var query = 'SELECT * FROM posts ORDER BY ' + mysql.escapeId(sorter);
  240. console.log(query); // SELECT * FROM posts ORDER BY `date`
  241. ```
  242. It also supports adding qualified identifiers. It will escape both parts.
  243. ```js
  244. var sorter = 'date';
  245. var query = 'SELECT * FROM posts ORDER BY ' + mysql.escapeId('posts.' + sorter);
  246. console.log(query); // SELECT * FROM posts ORDER BY `posts`.`date`
  247. ```
  248. When you pass an Object to `.escape()` or `.query()`, `.escapeId()` is used to avoid SQL
  249. injection in object keys.
  250. ### Custom format
  251. If you prefer to have another type of query escape format, there's a connection configuration option you can use to define a custom format function. You can access the connection object if you want to use the built-in `.escape()` or any other connection function.
  252. Here's an example of how to implement another format:
  253. ```js
  254. connection.config.queryFormat = function (query, values) {
  255. if (!values) return query;
  256. return query.replace(/\:(\w+)/g, function (txt, key) {
  257. if (values.hasOwnProperty(key)) {
  258. return this.escape(values[key]);
  259. }
  260. return txt;
  261. }.bind(this));
  262. };
  263. connection.query("UPDATE posts SET title = :title", { title: "Hello MySQL" });
  264. ```
  265. ## Getting the id of an inserted row
  266. If you are inserting a row into a table with an auto increment primary key, you
  267. can retrieve the insert id like this:
  268. ```js
  269. connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result) {
  270. if (err) throw err;
  271. console.log(result.insertId);
  272. });
  273. ```
  274. ## Executing queries in parallel
  275. The MySQL protocol is sequential, this means that you need multiple connections
  276. to execute queries in parallel. Future version of this module may ship with a
  277. connection pool implementation, but for now you have to figure out how to
  278. manage multiple connections yourself if you want to execute queries in
  279. parallel.
  280. One simple approach is to create one connection per incoming http request.
  281. ## Streaming query rows
  282. Sometimes you may want to select large quantities of rows and process each of
  283. them as they are received. This can be done like this:
  284. ```js
  285. var query = connection.query('SELECT * FROM posts');
  286. query
  287. .on('error', function(err) {
  288. // Handle error, an 'end' event will be emitted after this as well
  289. })
  290. .on('fields', function(fields) {
  291. // the field packets for the rows to follow
  292. })
  293. .on('result', function(row) {
  294. // Pausing the connnection is useful if your processing involves I/O
  295. connection.pause();
  296. processRow(row, function() {
  297. connection.resume();
  298. });
  299. })
  300. .on('end', function() {
  301. // all rows have been received
  302. });
  303. ```
  304. Please note a few things about the example above:
  305. * Usually you will want to receive a certain amount of rows before starting to
  306. throttle the connection using `pause()`. This number will depend on the
  307. amount and size of your rows.
  308. * `pause()` / `resume()` operate on the underlying socket and parser. You are
  309. guaranteed that no more `'result'` events will fire after calling `pause()`.
  310. * You MUST NOT provide a callback to the `query()` method when streaming rows.
  311. * The `'result'` event will fire for both rows as well as OK packets
  312. confirming the success of a INSERT/UPDATE query.
  313. Additionally you may be interested to know that it is currently not possible to
  314. stream individual row columns, they will always be buffered up entirely. If you
  315. have a good use case for streaming large fields to and from MySQL, I'd love to
  316. get your thoughts and contributions on this.
  317. ## Multiple statement queries
  318. Support for multiple statements is disabled for security reasons (it allows for
  319. SQL injection attacks if values are not properly escaped). To use this feature
  320. you have to enable it for your connection:
  321. ```js
  322. var connection = mysql.createConnection({multipleStatements: true});
  323. ```
  324. Once enabled, you can execute multiple statement queries like any other query:
  325. ```js
  326. connection.query('SELECT 1; SELECT 2', function(err, results) {
  327. if (err) throw err;
  328. // `results` is an array with one element for every statement in the query:
  329. console.log(results[0]); // [{1: 1}]
  330. console.log(results[1]); // [{2: 2}]
  331. });
  332. ```
  333. Additionally you can also stream the results of multiple statement queries:
  334. ```js
  335. var query = connection.query('SELECT 1; SELECT 2');
  336. query
  337. .on('fields', function(fields, index) {
  338. // the fields for the result rows that follow
  339. })
  340. .on('result', function(row, index) {
  341. // index refers to the statement this result belongs to (starts at 0)
  342. });
  343. ```
  344. If one of the statements in your query causes an error, the resulting Error
  345. object contains a `err.index` property which tells you which statement caused
  346. it. MySQL will also stop executing any remaining statements when an error
  347. occurs.
  348. Please note that the interface for streaming multiple statement queries is
  349. experimental and I am looking forward to feedback on it.
  350. ## Stored procedures
  351. You can call stored procedures from your queries as with any other mysql driver.
  352. If the stored procedure produces several result sets, they are exposed to you
  353. the same way as the results for multiple statement queries.
  354. ## Joins with overlapping column names
  355. When executing joins, you are likely to get result sets with overlapping column
  356. names.
  357. By default, node-mysql will overwrite colliding column names in the
  358. order the columns are received from MySQL, causing some of the received values
  359. to be unavailable.
  360. However, you can also specify that you want your columns to be nested below
  361. the table name like this:
  362. ```js
  363. var options = {sql: '...', nestTables: true};
  364. connection.query(options, function(err, results) {
  365. /* results will be an array like this now:
  366. [{
  367. table1: {
  368. fieldA: '...',
  369. fieldB: '...',
  370. },
  371. table2: {
  372. fieldA: '...',
  373. fieldB: '...',
  374. },
  375. }, ...]
  376. */
  377. });
  378. ```
  379. Or use a string separator to have your results merged.
  380. ```js
  381. var options = {sql: '...', nestTables: '_'};
  382. connection.query(options, function(err, results) {
  383. /* results will be an array like this now:
  384. [{
  385. table1_fieldA: '...',
  386. table1_fieldB: '...',
  387. table2_fieldA: '...',
  388. table2_fieldB: '...'
  389. }, ...]
  390. */
  391. });
  392. ```
  393. ## Error handling
  394. This module comes with a consistent approach to error handling that you should
  395. review carefully in order to write solid applications.
  396. All errors created by this module are instances of the JavaScript [Error][]
  397. object. Additionally they come with two properties:
  398. * `err.code`: Either a [MySQL server error][] (e.g.
  399. `'ER_ACCESS_DENIED_ERROR'`), a node.js error (e.g. `'ECONNREFUSED'`) or an
  400. internal error (e.g. `'PROTOCOL_CONNECTION_LOST'`).
  401. * `err.fatal`: Boolean, indicating if this error is terminal to the connection
  402. object.
  403. [Error]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error
  404. [MySQL server error]: http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
  405. Fatal errors are propagated to *all* pending callbacks. In the example below, a
  406. fatal error is triggered by trying to connect to an invalid port. Therefore the
  407. error object is propagated to both pending callbacks:
  408. ```js
  409. var connection = require('mysql').createConnection({
  410. port: 84943, // WRONG PORT
  411. });
  412. connection.connect(function(err) {
  413. console.log(err.code); // 'ECONNREFUSED'
  414. console.log(err.fatal); // true
  415. });
  416. connection.query('SELECT 1', function(err) {
  417. console.log(err.code); // 'ECONNREFUSED'
  418. console.log(err.fatal); // true
  419. });
  420. ```
  421. Normal errors however are only delegated to the callback they belong to. So in
  422. the example below, only the first callback receives an error, the second query
  423. works as expected:
  424. ```js
  425. connection.query('USE name_of_db_that_does_not_exist', function(err, rows) {
  426. console.log(err.code); // 'ER_BAD_DB_ERROR'
  427. });
  428. connection.query('SELECT 1', function(err, rows) {
  429. console.log(err); // null
  430. console.log(rows.length); // 1
  431. });
  432. ```
  433. Last but not least: If a fatal errors occurs and there are no pending
  434. callbacks, or a normal error occurs which has no callback belonging to it, the
  435. error is emitted as an `'error'` event on the connection object. This is
  436. demonstrated in the example below:
  437. ```js
  438. connection.on('error', function(err) {
  439. console.log(err.code); // 'ER_BAD_DB_ERROR'
  440. });
  441. connection.query('USE name_of_db_that_does_not_exist');
  442. ```
  443. Note: `'error'` are special in node. If they occur without an attached
  444. listener, a stack trace is printed and your process is killed.
  445. **tl;dr:** This module does not want you to deal with silent failures. You
  446. should always provide callbacks to your method calls. If you want to ignore
  447. this advice and suppress unhandled errors, you can do this:
  448. ```js
  449. // I am Chuck Norris:
  450. connection.on('error', function() {});
  451. ```
  452. ## Exception Safety
  453. This module is exception safe. That means you can continue to use it, even if
  454. one of your callback functions throws an error which you're catching using
  455. 'uncaughtException' or a domain.
  456. ## Type casting
  457. For your convenience, this driver will cast mysql types into native JavaScript
  458. types by default. The following mappings exist:
  459. ### Number
  460. * TINYINT
  461. * SMALLINT
  462. * INT
  463. * MEDIUMINT
  464. * YEAR
  465. * FLOAT
  466. * DOUBLE
  467. ### Date
  468. * TIMESTAMP
  469. * DATE
  470. * DATETIME
  471. ### Buffer
  472. * TINYBLOB
  473. * MEDIUMBLOB
  474. * LONGBLOB
  475. * BLOB
  476. * BINARY
  477. * VARBINARY
  478. * BIT (last byte will be filled with 0 bits as necessary)
  479. ### String
  480. * CHAR
  481. * VARCHAR
  482. * TINYTEXT
  483. * MEDIUMTEXT
  484. * LONGTEXT
  485. * TEXT
  486. * ENUM
  487. * SET
  488. * DECIMAL (may exceed float precision)
  489. * BIGINT (may exceed float precision)
  490. * TIME (could be mapped to Date, but what date would be set?)
  491. * GEOMETRY (never used those, get in touch if you do)
  492. It is not recommended (and may go away / change in the future) to disable type
  493. casting, but you can currently do so on either the connection:
  494. ```js
  495. var connection = require('mysql').createConnection({typeCast: false});
  496. ```
  497. Or on the query level:
  498. ```js
  499. var options = {sql: '...', typeCast: false};
  500. var query = connection.query(options, function(err, results) {
  501. }):
  502. ```
  503. You can also pass a function and handle type casting yourself. You're given some
  504. column information like database, table and name and also type and length. If you
  505. just want to apply a custom type casting to a specific type you can do it and then
  506. fallback to the default. Here's an example of converting `TINYINT(1)` to boolean:
  507. ```js
  508. connection.query({
  509. sql: '...',
  510. typeCast: function (field, next) {
  511. if (field.type == 'TINY' && field.length == 1) {
  512. return (field.string() == '1'); // 1 = true, 0 = false
  513. }
  514. return next();
  515. }
  516. })
  517. ```
  518. If you need a buffer there's also a `.buffer()` function and also a `.geometry()` one
  519. both used by the default type cast that you can use.
  520. ## Connection Flags
  521. If, for any reason, you would like to change the default connection flags, you
  522. can use the connection option `flags`. Pass a string with a comma separated list
  523. of items to add to the default flags. If you don't want a default flag to be used
  524. prepend the flag with a minus sign. To add a flag that is not in the default list, don't prepend it with a plus sign, just write the flag name (case insensitive).
  525. **Please note that some available flags that are not default are still not supported
  526. (e.g.: SSL, Compression). Use at your own risk.**
  527. ### Example
  528. The next example blacklists FOUND_ROWS flag from default connection flags.
  529. ```js
  530. var connection = mysql.createConnection("mysql://localhost/test?flags=-FOUND_ROWS")
  531. ```
  532. ### Default Flags
  533. - LONG_PASSWORD
  534. - FOUND_ROWS
  535. - LONG_FLAG
  536. - CONNECT_WITH_DB
  537. - ODBC
  538. - LOCAL_FILES
  539. - IGNORE_SPACE
  540. - PROTOCOL_41
  541. - IGNORE_SIGPIPE
  542. - TRANSACTIONS
  543. - RESERVED
  544. - SECURE_CONNECTION
  545. - MULTI_RESULTS
  546. - MULTI_STATEMENTS (used if `multipleStatements` option is activated)
  547. ### Other Available Flags
  548. - NO_SCHEMA
  549. - COMPRESS
  550. - INTERACTIVE
  551. - SSL
  552. - PS_MULTI_RESULTS
  553. - PLUGIN_AUTH
  554. - SSL_VERIFY_SERVER_CERT
  555. - REMEMBER_OPTIONS
  556. ## Debugging and reporting problems
  557. If you are running into problems, one thing that may help is enabling the
  558. `debug` mode for the connection:
  559. ```js
  560. var connection = mysql.createConnection({debug: true});
  561. ```
  562. This will print all incoming and outgoing packets on stdout.
  563. If that does not help, feel free to open a GitHub issue. A good GitHub issue
  564. will have:
  565. * The minimal amount of code required to reproduce the problem (if possible)
  566. * As much debugging output and information about your environment (mysql
  567. version, node version, os, etc.) as you can gather.
  568. ## Todo
  569. * Prepared statements
  570. * setTimeout() for Connection / Query
  571. * connection pooling
  572. * Support for encodings other than UTF-8 / ASCII
  573. * API support for transactions, similar to [php](http://www.php.net/manual/en/mysqli.quickstart.transactions.php)