This object allows you to establish a connection to a SQL database like MySQL, PostgreSQL, SQLite and others.
Constructor function.
var myObject = new Sql(driver);
Create a Sql object operating on a MySQL database.
var myObject = new Sql(Sql.MySQL);
On Windows only the MySQL, PostgreSQL, SQLite 3, Firebird and ODBC drivers are installed by default. To see all available drivers call the drivers function.
Returns a list of available Drivers.
Sql.drivers();
Opens a connection with a database.
myObject.connect(parameters);
Prepare a request on the current database.
myObject.prepare(queryString, parameters);
myObject.prepare("INSERT INTO myTable (id, data) VALUES(:id, :data)", { id: 1, data: "My data" });
Execute a prepared request or executes a request on the current database.
myObject.execute(queryString);
myObject.execute();
Retrieves the result of an executed request.
myObject.fetchResult(indexStyle);
myObject.fetchResult();
Disconnects the current database connection.
myObject.disconnect();
SQL drivers. On Windows only the MySQL, PostgreSQL, SQLite 3, Firebird and ODBC drivers are installed by default.
The fetch index style.