mysqlprocedures
v1.11.0
Published
Package for calling stored procedures dynamically for any mysql connection with error handling
Downloads
58
Readme
StoredProcedureCaller
A simple Node.js module for calling stored procedures using MySQL.
Installation
Install the package using npm:
npm install mysqlprocedures
#Usage
const StoredProcedureCaller = require('mysqlprocedures');
// Set up MySQL connection configuration
const dbConfig = {
host: 'your-host',
user: 'your-username',
password: 'your-password',
database: 'your-database',
};
// Create an instance of StoredProcedureCaller
const storedProcedureCaller = new StoredProcedureCaller(dbConfig);
// Define the stored procedure name and input parameters
const procedureName = 'your_stored_procedure';
const inputs = [param1, param2, param3]; // replace with your actual parameters
// Call the stored procedure
storedProcedureCaller.callStoredProcedure(procedureName, inputs, (error, results) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Results:', results);
}
// Close the MySQL connection
storedProcedureCaller.closeConnection();
});