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
- querySync
- 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.
MysqlConnection#querySync
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
- MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect
- MysqlConnectionQueued#connect(hostname, user, password, database, port, socket, flags[, 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
- 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
- Object
Fetch style options (optional)
Fetches all result rows 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#fetchRowSync
- MysqlResult#fetchRowSync([options])
- Array
- Object
- options
- Object
Fetch style options (optional)
Fetch one row from result
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 properties
MysqlStatement.new
- new MysqlStatement()
Creates new MysqlStatement object
MysqlStatement#affectedRowsSync
- MysqlStatement#affectedRowsSync()
- Integer
Gets number of affected rows in previous operation
MysqlStatement#attrGetSync
- MysqlStatement#attrGetSync(attr)
- Integer
- Boolean
Used to get the current value of a statement attribute
MysqlStatement#attrSetSync
- MysqlStatement#attrSetSync(attr, value)
- Boolean
- attr
- Integer
- value
- Integer
- Boolean
Used to modify the behavior of a prepared statement
MysqlStatement#bindParamsSync
- MysqlStatement#bindParamsSync(params)
- Boolean
- params
- Array
Binds variables to a prepared statement as parameters
MysqlStatement#bindResultSync
- MysqlStatement#bindResultSync()
- Boolean
Bind result set buffers
MysqlStatement#paramCount
- MysqlStatement#paramCount
- Integer
Gets 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.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel
- MysqlLibmysqlclient.createConnectionHighlevel(hostname, user, password, database, port, socket, flags[, callback])
Creates high-level connection to database
Asynchronous version
MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync
- MysqlLibmysqlclient.createConnectionHighlevelSync(hostname, user, password, database, port, socket, flags)
Creates high-level connection to database
Synchronous version
MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued
- MysqlLibmysqlclient.createConnectionQueued(hostname, user, password, database, port, socket, flags[, callback])
Creates queued connection to database
Asynchronous version
MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync
- MysqlLibmysqlclient.createConnectionQueuedSync(hostname, user, password, database, port, socket, flags)
Creates queued connection to database
Synchronous version
MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync
- MysqlLibmysqlclient.createConnectionSync(hostname, user, password, database, port, socket, flags, callback)
Creates connection to database
Asynchronous version