This section contains module classes API description.
Classes section
Description
Classes
MysqlConnection
MySQL connection class, base version
MysqlConnectionHighlevel
MySQL connection with only high-level methods
MysqlConnectionQueued
MySQL connection with queries queue
MysqlResult
MySQL results class
MysqlStatement
MySQL prepared statement class
MysqlConnection
Description
MySQL connection class, base version
Subclasses
Constructor
Instance methods
- affectedRowsSync
- autoCommitSync
- changeUserSync
- closeSync
- commitSync
- connect
- connectedSync
- connectSync
- debugSync
- dumpDebugInfoSync
- errnoSync
- errorSync
- escapeSync
- fieldCountSync
- getCharsetNameSync
- getCharsetSync
- getClientInfoSync
- getInfoStringSync
- getInfoSync
- getWarningsSync
- initStatementSync
- initSync
- lastInsertIdSync
- multiMoreResultsSync
- multiNextResultSync
- multiRealQuerySync
- pingSync
- query
- querySend
- realConnectSync
- realQuerySync
- rollbackSync
- selectDbSync
- setCharsetSync
- setOptionSync
- setSslSync
- sqlStateSync
- statSync
- storeResultSync
- threadIdSync
- threadSafeSync
- useResultSync
- warningCountSync
Instance properties
MysqlConnection.new
- new MysqlConnection()
Creates new MysqlConnection object
MysqlConnection#affectedRowsSync
- MysqlConnection#affectedRowsSync()
- Integer
Gets number of affected rows in previous operation
MysqlConnection#autoCommitSync
- MysqlConnection#autoCommitSync(mode)
- Boolean
- mode
- Boolean
Mode flag
Sets autocommit mode
MysqlConnection#changeUserSync
- MysqlConnection#changeUserSync(user[, password][, database])
- Boolean
- user
- String
Username
- password
- String
Password
- database
- String
Database to use
Changes the user and causes the database to become the default
MysqlConnection#closeSync
- MysqlConnection#closeSync()
Closes database connection
MysqlConnection#commitSync
- MysqlConnection#commitSync()
- Boolean
Commits the current transaction
MysqlConnection#connect
- MysqlConnection#connect([hostname][, user][, password][, database][, port][, socket], callback)
- hostname
- String
Hostname
- user
- String
Username
- password
- String
Password
- database
- String
Database to use
- port
- Integer
Connection port
- socket
- String
Connection socket
- callback
- Function
Callback function, gets (error)
Connects to the MySQL server
MysqlConnection#connectedSync
- MysqlConnection#connectedSync()
- Boolean
Returns current connected status
MysqlConnection#connectSync
- MysqlConnection#connectSync([hostname][, user][, password][, database][, port][, socket])
- Boolean
- hostname
- String
Hostname
- user
- String
Username
- password
- String
Password
- database
- String
Database to use
- port
- Integer
Connection port
- socket
- String
Connection socket
Connects to the MySQL server
MysqlConnection#debugSync
- MysqlConnection#debugSync(message)
- message
- String
Debug message
Performs debug logging
MysqlConnection#dumpDebugInfoSync
- MysqlConnection#dumpDebugInfoSync()
- Boolean
Dump debugging information into the log
MysqlConnection#errnoSync
- MysqlConnection#errnoSync()
- Integer
Returns the last error code
MysqlConnection#errorSync
- MysqlConnection#errorSync()
- String
Returns the last error message
MysqlConnection#escapeSync
- MysqlConnection#escapeSync(string)
- String
- string
- String
String to escape
Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
MysqlConnection#fieldCountSync
- MysqlConnection#fieldCountSync()
- Integer
Returns the number of columns for the most recent query
MysqlConnection#getCharsetNameSync
- MysqlConnection#getCharsetNameSync()
- String
Returns a character set name
MysqlConnection#getCharsetSync
- MysqlConnection#getCharsetSync()
- Object
Returns a character set object
MysqlConnection#getClientInfoSync
- MysqlConnection#getClientInfoSync()
- Object
Returns the MySQL client version and information
MysqlConnection#getInfoStringSync
- MysqlConnection#getInfoStringSync()
- String
Retrieves information about the most recently executed query
MysqlConnection#getInfoSync
- MysqlConnection#getInfoSync()
- Object
Returns the MySQL client, server, host and protocol version and information
MysqlConnection#getWarningsSync
- MysqlConnection#getWarningsSync()
- Array
Gets result of SHOW WARNINGS
MysqlConnection#initStatementSync
- MysqlConnection#initStatementSync()
- MysqlStatement
- Boolean
Initializes a statement and returns it
MysqlConnection#initSync
- MysqlConnection#initSync()
- Boolean
Initializes MysqlConnection
MysqlConnection#lastInsertIdSync
- MysqlConnection#lastInsertIdSync()
- Integer
Returns the auto generated id used in the last query
MysqlConnection#multiMoreResultsSync
- MysqlConnection#multiMoreResultsSync()
- Boolean
Checks if there are any more query results from a multi query
MysqlConnection#multiNextResultSync
- MysqlConnection#multiNextResultSync()
- Boolean
Prepare next result from multi query
MysqlConnection#multiRealQuerySync
- MysqlConnection#multiRealQuerySync(query)
- Boolean
- query
- String
Query
Performs a multi query on the database
MysqlConnection#pingSync
- MysqlConnection#pingSync()
- Boolean
Pings a server connection, or tries to reconnect if the connection has gone down
MysqlConnection#query
- MysqlConnection#query(query, callback)
- query
- String
Query
- callback
- Function
Callback function, gets (error, result)
Performs a query on the database. Uses mysql_real_query.
MysqlConnection#querySend
- MysqlConnection#querySend(query, callback)
- query
- String
Query
- callback
- Function
Callback function, gets (errro, result)
Performs a query on the database.
Uses mysql_send_query.
/
Handle
REQ_STR_ARG(0, query); OPTIONAL_FUN_ARG(1, callback);
MysqlConnection *conn = OBJUNWRAP
MYSQLCONN_MUSTBE_CONNECTED;
query_request *query_req = new query_request;
unsigned int query_len = static_cast
// Copy query from V8 var to buffer memcpy(query_req->query, *query, query_len); query_req->query[query_len] = '\0';
query_req->callback = Persistent
// Send query mysql_send_query(conn->_conn, query_req->query, query_len + 1);
// Init IO watcher NODE_ADDON_SHIM_START_IO_WATCH(query_req, EV_After_QuerySend, conn->_conn->net.fd, EV_READ)
return Undefined(); }
/** MysqlConnection#querySync(query) -> MysqlResult - query (String): Query
Performs a query on the database.
MysqlConnection#realConnectSync
- MysqlConnection#realConnectSync([hostname][, user][, password][, database][, port][, socket])
- Boolean
- hostname
- String
Hostname
- user
- String
Username
- password
- String
Password
- database
- String
Database to use
- port
- Integer
Connection port
- socket
- String
Connection socket
Open a new connection to the MySQL server
MysqlConnection#realQuerySync
- MysqlConnection#realQuerySync()
- Boolean
- query
- String
Query
Executes an SQL query
MysqlConnection#rollbackSync
- MysqlConnection#rollbackSync()
- Boolean
Rolls back current transaction
MysqlConnection#selectDbSync
- MysqlConnection#selectDbSync(database)
- Boolean
- database
- String
Database to use
Selects the default database for database queries
MysqlConnection#setCharsetSync
- MysqlConnection#setCharsetSync()
- Boolean
- charset
- String
Charset
Sets the default client character set
MysqlConnection#setOptionSync
- MysqlConnection#setOptionSync(key, value)
- Boolean
- key
- Integer
Option key
- value
- Integer
- String
Option value
Sets connection options
MysqlConnection#setSslSync
- MysqlConnection#setSslSync()
Sets SSL options Used for establishing secure connections
- key (String): Key file
- cert (String): Certificate file
- ca (String): Certificate authority file
- capath(String): CA certificates in PEM directory
- cipher (String): Allowable ciphers
MysqlConnection#sqlStateSync
- MysqlConnection#sqlStateSync()
- String
Returns the SQLSTATE error from previous MySQL operation
MysqlConnection#statSync
- MysqlConnection#statSync()
- String
Gets the current system status
MysqlConnection#storeResultSync
- MysqlConnection#storeResultSync()
Transfers a result set from the last query
MysqlConnection#threadIdSync
- MysqlConnection#threadIdSync()
- Integer
Returns the thread ID for the current connection
MysqlConnection#threadSafeSync
- MysqlConnection#threadSafeSync()
- Boolean
Returns whether thread safety is given or not
MysqlConnection#useResultSync
- MysqlConnection#useResultSync()
Initiates a result set retrieval for the last query
MysqlConnection#warningCountSync
- MysqlConnection#warningCountSync()
- Integer
Returns the number of warnings from the last query for the given link
MysqlConnection#connectErrno
- MysqlConnection#connectErrno
- Integer
Gets last connect error number
MysqlConnection#connectError
- MysqlConnection#connectError
- String
Gets last connect error string
MysqlConnectionHighlevel
Description
MySQL connection with only high-level methods
Superclass
Instance methods
MysqlConnectionHighlevel#query
- MysqlConnectionHighlevel#query(query[, callback])
Performs a query on the database
Uses mysql_real_query() or mysql_send_query() depends on this._queryType
MysqlConnectionHighlevel#setQueryTypeSync
- MysqlConnectionHighlevel#setQueryTypeSync(queryType)
Sets this._queryType
MysqlConnectionQueued
Description
MySQL connection with queries queue
Superclass
Subclasses
MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect(hostname[, user][, password][, database][, port][, socket][, callback])
Connects to the MySQL server
MysqlConnectionQueued#query
- MysqlConnectionQueued#query(query[, callback])
Performs a query on the database
Uses mysql_real_query()
MysqlConnectionQueued#querySend
- MysqlConnectionQueued#querySend(query[, callback])
Performs a query on the database
Uses mysql_send_query()
MysqlResult
Description
MySQL results class
Constructor
Instance methods
Instance properties
MysqlResult.new
- new MysqlResult()
Creates new MysqlResult object
MysqlResult#dataSeekSync
- MysqlResult#dataSeekSync(offset)
- offset
- Integer
The field offset
Adjusts the result pointer to an arbitrary row in the result
MysqlResult#fetchAll
- MysqlResult#fetchAll(callback)
- MysqlResult#fetchAll(options, callback)
- options
- Boolean
- Object
Fetch style options (optional)
- callback
- Function
Callback function, gets (error, rows)
Fetches all result rows as an array
MysqlResult#fetchAllSync
- MysqlResult#fetchAllSync([options])
- Array
- options
- Boolean
- Object
Fetch style options (optional)
Fetches all result rows as an array
MysqlResult#fetchArraySync
- MysqlResult#fetchArraySync()
- Array
Fetch a result row as an array
MysqlResult#fetchFieldDirectSync
- MysqlResult#fetchFieldDirectSync(fieldNum)
- Object
- fieldNum
- Integer
Field number (starts from 0)
Returns metadata of the arbitrary field in the result set
MysqlResult#fetchFieldsSync
- MysqlResult#fetchFieldsSync()
- Array
Returns an array of objects representing the fields in a result set
MysqlResult#fetchFieldSync
- MysqlResult#fetchFieldSync()
- Object
Returns metadata of the next field in the result set
MysqlResult#fetchLengthsSync
- MysqlResult#fetchLengthsSync()
- Array
Returns the lengths of the columns of the current row in the result set
MysqlResult#fetchObjectSync
- MysqlResult#fetchObjectSync()
- Object
Fetch a result row as an object
MysqlResult#fieldSeekSync
- MysqlResult#fieldSeekSync(fieldNumber)
- fieldNumber
- Integer
Field number (starts from 0)
Set result pointer to a specified field offset
MysqlResult#fieldTellSync
- MysqlResult#fieldTellSync()
- Integer
Returns the position of the field cursor
MysqlResult#freeSync
- MysqlResult#freeSync()
Frees the memory associated with a result
MysqlResult#numRowsSync
- MysqlResult#numRowsSync()
- Integer
Gets the number of rows in a result
MysqlResult#fieldCount
- MysqlResult#fieldCount
- Integer
- Undefined
Get the number of fields in a result
MysqlStatement
Description
MySQL prepared statement class
Constructor
Instance methods
Instance properties
MysqlStatement.new
- new MysqlStatement()
Creates new MySQL prepared statement object
MysqlStatement#affectedRowsSync
- MysqlStatement#affectedRowsSync()
- Integer
Returns the total number of rows changed, deleted, or inserted by the last executed statement
MysqlStatement#attrGetSync
- MysqlStatement#attrGetSync(attr)
- Boolean
- Integer
- attr
- Integer
Attribute id
Used to get the current value of a statement attribute
MysqlStatement#attrSetSync
- MysqlStatement#attrSetSync(attr, value)
- Boolean
- attr
- Integer
Attribute id
- value
- Boolean
- Integer
Attribute value
Set the value of statement attribute. Used to modify the behavior of a prepared statement
MysqlStatement#bindParamsSync
- MysqlStatement#bindParamsSync(params)
- Boolean
- params
- Array
Parameters values to bind
Binds variables to a prepared statement as parameters
MysqlStatement#closeSync
- MysqlStatement#closeSync()
- Boolean
Closes a prepared statement
MysqlStatement#dataSeekSync
- MysqlStatement#dataSeekSync(offset)
- offset
- Integer
Offset value
Seeks to an arbitrary row in statement result set
MysqlStatement#errnoSync
- MysqlStatement#errnoSync()
- Integer
Returns the error code for the most recent statement call
MysqlStatement#errorSync
- MysqlStatement#errorSync()
- String
Returns a string description for last statement error
MysqlStatement#executeSync
- MysqlStatement#executeSync()
- Boolean
Executes a prepared query
MysqlStatement#fetchAllSync
- MysqlStatement#fetchAllSync()
- Object
Returns row data from statement result
MysqlStatement#fieldCountSync
- MysqlStatement#fieldCountSync()
- Integer
Returns the number of field in the given statement
MysqlStatement#freeResultSync
- MysqlStatement#freeResultSync()
- Boolean
Frees stored result memory for the given statement handle
MysqlStatement#lastInsertIdSync
- MysqlStatement#lastInsertIdSync()
- Integer
Get the ID generated from the previous INSERT operation
MysqlStatement#numRowsSync
- MysqlStatement#numRowsSync()
- Integer
Return the number of rows in statements result set
MysqlStatement#prepareSync
- MysqlStatement#prepareSync(query)
- Boolean
- query
- String
Query for prepare
Prepare statement by given query
MysqlStatement#resetSync
- MysqlStatement#resetSync()
- Boolean
Resets a prepared statement
MysqlStatement#resultMetadataSync
- MysqlStatement#resultMetadataSync()
Returns result set metadata from a prepared statement
MysqlStatement#sendLongDataSync
- MysqlStatement#sendLongDataSync(parameterNumber, data)
- Boolean
- parameterNumber
- Integer
Parameter number, beginning with 0
- data
- String
Data
Send parameter data to the server in blocks (or "chunks")
MysqlStatement#sqlStateSync
- MysqlStatement#sqlStateSync()
- String
Returns SQLSTATE error from previous statement operation
MysqlStatement#storeResultSync
- MysqlStatement#storeResultSync()
- Boolean
Transfers a result set from a prepared statement
MysqlStatement#paramCount
- MysqlStatement#paramCount
- Integer
Returns the number of parameter for the given statement
Exports section
Description
This section contains module exports,
available when you call require('mysql-libmysqlclient')
.
Namespaces
MysqlLibmysqlclient
Asynchronous MySQL bindings for Node.js
MysqlLibmysqlclient
Description
Asynchronous MySQL bindings for Node.js
Namespaces
MysqlLibmysqlclient.bindings
mysql-libmysqlclient
module bindings
MysqlLibmysqlclient.bindings
Description
mysql-libmysqlclient
module bindings
MysqlLibmysqlclient.bindings.MysqlConnection
MysqlLibmysqlclient.bindings.MysqlResult
MysqlLibmysqlclient.bindings.MysqlStatement
MysqlLibmysqlclient.createConnection
- MysqlLibmysqlclient.createConnection(hostname[, user][, password][, database][, port][, socket][, callback])
Creates connection to database
Asynchronous version
MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel(hostname[, user][, password][, database][, port][, socket][, callback])
Creates high-level connection to database
Asynchronous version
MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync(hostname[, user][, password][, database][, port][, socket])
Creates high-level connection to database
Synchronous version
MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued(hostname[, user][, password][, database][, port][, socket][, callback])
Creates queued connection to database
Asynchronous version
MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync(hostname[, user][, password][, database][, port][, socket])
Creates queued connection to database
Synchronous version
MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync(hostname[, user][, password][, database][, port][, socket])
Creates connection to database
Synchronous version