Quick mysql is a powerful module that makes the mysql system easier, simpler and faster
- Speed
- Unlimited connection without losing connection
- Easy to use
- High security
npm install qmy
yarn add qmy
(+)connect() will resolve the process by calling the then() function and it will give you a notification that the connection was successful if there is an error, it will reject the process and you can call the catch() function and it will give you the error
(-)Remove Reminders New Versions
Connection Config
host: "localhost",
port: 3306,
localAddress: undefined,
socketPath: undefined,
user: undefined,
password: undefined,
database: undefined,
connectTimeout: 10000,
insecureAuth: false,
supportBigNumbers: false,
bigNumberStrings: false,
dateStrings: false,
debug: undefined,
trace: true,
stringifyObjects: false,
timezone: "local",
flags: "",
queryFormat: undefined,
pool: undefined,
ssl: false,
localInfile: true,
multipleStatements: false,
typeCast: true,
maxPacketSize: 0,
charsetNumber: 33,
clientFlags: 455631,
protocol41: true,
Direct connection problem solving: Here
create connection
Start by creating a connection to the database. Use the username and password from your MySQL database or use uri
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
Method | Description | explain |
---|---|---|
connect | connect() will resolve the process by calling the then() function and it will give you a notification that the connection was successful if there is an error, it will reject the process and you can call the catch() function and it will give you the error | Go to example |
query | Use SQL statements to read from (or write to) a MySQL database. This is also called "to query" the database. The connection object created in the example above, has a method for querying the database | Go to example |
get | used to select data from a database | Go to example |
remove | used to delete existing records in a table | Go to example |
set | used to insert new records in a table | Go to example |
update | used to modify the existing records in a table | Go to example |
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
//do something
//...
})
.catch((error) => {
//do something
//...
console.log(error);
});
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
connection
.query("<SQL statements>")
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
})
.catch((error) => {
//do something
//...
console.log(error);
});
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
connection
.get("<table>", "<Where>:<PrimaryKey>")
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
})
.catch((error) => {
//do something
//...
console.log(error);
});
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
connection
.remove("<table>", "<Where>:<PrimaryKey>")
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
})
.catch((error) => {
//do something
//...
console.log(error);
});
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
connection
.set(
{
table: "users",
column: "id - name - color",
values: "2324249073 - arth - red",
},
{ sign: "-" }
)
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
})
.catch((error) => {
//do something
//...
console.log(error);
});
const qmy = require("qmy");
const connection = new qmy({
database: "<database>",
host: "<host>",
password: "<password>",
port: 3306,
user: "<user>",
});
connection
.connect()
.then(() => {
connection
.update({
table: "users",
column: "name",
PrimaryKey: "id:2324249073",//<Where>:<PrimaryKey>
value: "arth",
})
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
})
.catch((error) => {
//do something
//...
console.log(error);
});