Fork me on GitHub

Sections

  • classes

    This section contains module classes API description.

  • exports

    This section contains module exports, available when you call require('mysql-libmysqlclient').

section

Classes section

Description

This section contains module classes API description.

Classes

class

MysqlConnection

Description

MySQL connection class, base version

Instance properties

constructor

MysqlConnection.new

    • new MysqlConnection()

Creates new MysqlConnection object

instance method

MysqlConnection#affectedRowsSync

    • MysqlConnection#affectedRowsSync()
      • Integer

Gets number of affected rows in previous operation

instance method

MysqlConnection#autoCommitSync

    • MysqlConnection#autoCommitSync(mode)
      • Boolean
    • mode
      • Boolean
    • Mode flag

Sets autocommit mode

instance method

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

instance method

MysqlConnection#closeSync

    • MysqlConnection#closeSync()

Closes database connection

instance method

MysqlConnection#commitSync

    • MysqlConnection#commitSync()
      • Boolean

Commits the current transaction

instance method

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

instance method

MysqlConnection#connectedSync

    • MysqlConnection#connectedSync()
      • Boolean

Returns current connected status

instance method

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

instance method

MysqlConnection#debugSync

    • MysqlConnection#debugSync(message)
    • message
      • String
    • Debug message

Performs debug logging

instance method

MysqlConnection#dumpDebugInfoSync

    • MysqlConnection#dumpDebugInfoSync()
      • Boolean

Dump debugging information into the log

instance method

MysqlConnection#errnoSync

    • MysqlConnection#errnoSync()
      • Integer

Returns the last error code

instance method

MysqlConnection#errorSync

    • MysqlConnection#errorSync()
      • String

Returns the last error message

instance method

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

instance method

MysqlConnection#fieldCountSync

    • MysqlConnection#fieldCountSync()
      • Integer

Returns the number of columns for the most recent query

instance method

MysqlConnection#getCharsetNameSync

    • MysqlConnection#getCharsetNameSync()
      • String

Returns a character set name

instance method

MysqlConnection#getCharsetSync

    • MysqlConnection#getCharsetSync()
      • Object

Returns a character set object

instance method

MysqlConnection#getClientInfoSync

    • MysqlConnection#getClientInfoSync()
      • Object

Returns the MySQL client version and information

instance method

MysqlConnection#getInfoStringSync

    • MysqlConnection#getInfoStringSync()
      • String

Retrieves information about the most recently executed query

instance method

MysqlConnection#getInfoSync

    • MysqlConnection#getInfoSync()
      • Object

Returns the MySQL client, server, host and protocol version and information

instance method

MysqlConnection#getWarningsSync

    • MysqlConnection#getWarningsSync()
      • Array

Gets result of SHOW WARNINGS

instance method

MysqlConnection#initStatementSync

Initializes a statement and returns it

instance method

MysqlConnection#initSync

    • MysqlConnection#initSync()
      • Boolean

Initializes MysqlConnection

instance method

MysqlConnection#lastInsertIdSync

    • MysqlConnection#lastInsertIdSync()
      • Integer

Returns the auto generated id used in the last query

instance method

MysqlConnection#multiMoreResultsSync

    • MysqlConnection#multiMoreResultsSync()
      • Boolean

Checks if there are any more query results from a multi query

instance method

MysqlConnection#multiNextResultSync

    • MysqlConnection#multiNextResultSync()
      • Boolean

Prepare next result from multi query

instance method

MysqlConnection#multiRealQuerySync

    • MysqlConnection#multiRealQuerySync(query)
      • Boolean
    • query
      • String
    • Query

Performs a multi query on the database

instance method

MysqlConnection#pingSync

    • MysqlConnection#pingSync()
      • Boolean

Pings a server connection, or tries to reconnect if the connection has gone down

instance method

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.

instance method

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.

instance method

MysqlConnection#querySync

    • query
      • String
    • Query

Performs a query on the database.

instance method

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

instance method

MysqlConnection#realQuerySync

    • MysqlConnection#realQuerySync()
      • Boolean
    • query
      • String
    • Query

Executes an SQL query

instance method

MysqlConnection#rollbackSync

    • MysqlConnection#rollbackSync()
      • Boolean

Rolls back current transaction

instance method

MysqlConnection#selectDbSync

    • MysqlConnection#selectDbSync(database)
      • Boolean
    • database
      • String
    • Database to use

Selects the default database for database queries

instance method

MysqlConnection#setCharsetSync

    • MysqlConnection#setCharsetSync()
      • Boolean
    • charset
      • String
    • Charset

Sets the default client character set

instance method

MysqlConnection#setOptionSync

    • MysqlConnection#setOptionSync(key, value)
      • Boolean
    • key
      • Integer
    • Option key

    • value
      • Integer
      • String
    • Option value

Sets connection options

instance method

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
instance method

MysqlConnection#sqlStateSync

    • MysqlConnection#sqlStateSync()
      • String

Returns the SQLSTATE error from previous MySQL operation

instance method

MysqlConnection#statSync

    • MysqlConnection#statSync()
      • String

Gets the current system status

instance method

MysqlConnection#storeResultSync

Transfers a result set from the last query

instance method

MysqlConnection#threadIdSync

    • MysqlConnection#threadIdSync()
      • Integer

Returns the thread ID for the current connection

instance method

MysqlConnection#threadSafeSync

    • MysqlConnection#threadSafeSync()
      • Boolean

Returns whether thread safety is given or not

instance method

MysqlConnection#useResultSync

Initiates a result set retrieval for the last query

instance method

MysqlConnection#warningCountSync

    • MysqlConnection#warningCountSync()
      • Integer

Returns the number of warnings from the last query for the given link

instance property

MysqlConnection#connectErrno

read-only
    • MysqlConnection#connectErrno
      • Integer

Gets last connect error number

instance property

MysqlConnection#connectError

read-only
    • MysqlConnection#connectError
      • String

Gets last connect error string

class

MysqlConnectionHighlevel

Description

MySQL connection with only high-level methods

Instance methods

instance method

MysqlConnectionHighlevel#query

    • MysqlConnectionHighlevel#query(query[, callback])

Performs a query on the database

Uses mysql_real_query() or mysql_send_query() depends on this._queryType

instance method

MysqlConnectionHighlevel#setQueryTypeSync

    • MysqlConnectionHighlevel#setQueryTypeSync(queryType)

Sets this._queryType

class

MysqlConnectionQueued

Description

MySQL connection with queries queue

Superclass

Instance methods

instance method

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

instance method

MysqlConnectionQueued#query

    • MysqlConnectionQueued#query(query[, callback])

Performs a query on the database

Uses mysql_real_query()

instance method

MysqlConnectionQueued#querySend

    • MysqlConnectionQueued#querySend(query[, callback])

Performs a query on the database

Uses mysql_send_query()

class

MysqlResult

Description

MySQL results class

Constructor

Instance properties

constructor

MysqlResult.new

internal
    • new MysqlResult()

Creates new MysqlResult object

instance method

MysqlResult#dataSeekSync

    • MysqlResult#dataSeekSync(offset)
    • offset
      • Integer
    • The field offset

Adjusts the result pointer to an arbitrary row in the result

instance method

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

instance method

MysqlResult#fetchAllSync

    • MysqlResult#fetchAllSync([options])
      • Array
    • options
      • Object
    • Fetch style options (optional)

Fetches all result rows as an array

instance method

MysqlResult#fetchFieldDirectSync

    • MysqlResult#fetchFieldDirectSync(fieldNum)
      • Object
    • fieldNum
      • Integer
    • Field number (starts from 0)

Returns metadata of the arbitrary field in the result set

instance method

MysqlResult#fetchFieldsSync

    • MysqlResult#fetchFieldsSync()
      • Array

Returns an array of objects representing the fields in a result set

instance method

MysqlResult#fetchFieldSync

    • MysqlResult#fetchFieldSync()
      • Object

Returns metadata of the next field in the result set

instance method

MysqlResult#fetchLengthsSync

    • MysqlResult#fetchLengthsSync()
      • Array

Returns the lengths of the columns of the current row in the result set

instance method

MysqlResult#fetchRowSync

    • MysqlResult#fetchRowSync([options])
      • Array
      • Object
    • options
      • Object
    • Fetch style options (optional)

Fetch one row from result

instance method

MysqlResult#fieldSeekSync

    • MysqlResult#fieldSeekSync(fieldNumber)
    • fieldNumber
      • Integer
    • Field number (starts from 0)

Set result pointer to a specified field offset

instance method

MysqlResult#fieldTellSync

    • MysqlResult#fieldTellSync()
      • Integer

Returns the position of the field cursor

instance method

MysqlResult#freeSync

    • MysqlResult#freeSync()

Frees the memory associated with a result

instance method

MysqlResult#numRowsSync

    • MysqlResult#numRowsSync()
      • Integer

Gets the number of rows in a result

instance property

MysqlResult#fieldCount

read-only
    • MysqlResult#fieldCount
      • Integer
      • Undefined

Get the number of fields in a result

class

MysqlStatement

Description

MySQL prepared statement class

Instance properties

constructor

MysqlStatement.new

    • new MysqlStatement()

Creates new MysqlStatement object

instance method

MysqlStatement#affectedRowsSync

    • MysqlStatement#affectedRowsSync()
      • Integer

Gets number of affected rows in previous operation

instance method

MysqlStatement#attrGetSync

    • MysqlStatement#attrGetSync(attr)
      • Integer
      • Boolean

Used to get the current value of a statement attribute

instance method

MysqlStatement#attrSetSync

    • MysqlStatement#attrSetSync(attr, value)
      • Boolean
    • attr
      • Integer
    • value
      • Integer
      • Boolean

Used to modify the behavior of a prepared statement

instance method

MysqlStatement#bindParamsSync

    • MysqlStatement#bindParamsSync(params)
      • Boolean
    • params
      • Array

Binds variables to a prepared statement as parameters

instance method

MysqlStatement#bindResultSync

    • MysqlStatement#bindResultSync()
      • Boolean

Bind result set buffers

instance property

MysqlStatement#paramCount

read-only
    • MysqlStatement#paramCount
      • Integer

Gets the number of parameter for the given statement

section

Exports section

Description

This section contains module exports, available when you call require('mysql-libmysqlclient').

Namespaces

namespace

MysqlLibmysqlclient

Description

Asynchronous MySQL bindings for Node.js

Namespaces

namespace

MysqlLibmysqlclient.bindings

Description

mysql-libmysqlclient module bindings

class

MysqlLibmysqlclient.bindings.MysqlConnection

class

MysqlLibmysqlclient.bindings.MysqlResult

Alias of:
class

MysqlLibmysqlclient.bindings.MysqlStatement

class method

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

class method

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

class method

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

class method

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

class method

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