This commit is contained in:
Lemuel Marquez
2021-05-19 01:58:53 -05:00
parent 35d055bd3f
commit a3374f23c3
+3 -21
View File
@@ -6,7 +6,6 @@ const pool = mariadb.createPool({
user: process.env.ESCOLARES_USER,
password: process.env.ESCOLARES_PASSWORD,
database: process.env.ESCOLARES_DB,
connectionLimit: 5,
});
const obtenerAlumno = async (numeroCuenta) => {
@@ -18,32 +17,15 @@ const obtenerAlumno = async (numeroCuenta) => {
.query(`CALL busca_alumno_pcpuma('${numeroCuenta}')`)
.then((rows) => {
conn.end();
console.log(rows.length);
console.log(rows[0].length);
console.log(rows);
return rows[0][0];
})
.catch((err) => {
conn.end();
throw new Error('Hubo un problema con el querry.' + err);
});
// return pool
// .getConnection()
// .then((conn) => {
// return conn
// .query(`CALL busca_alumno_pcpuma('${numeroCuenta}')`)
// .then((rows) => {
// conn.end();
// return rows[0][0];
// })
// .catch((err) => {
// console.log(err);
// conn.end();
// throw new Error('Hubo un problema con el querry.');
// });
// })
// .catch((err) => {
// console.log(err);
// throw new Error('No se pudo conectar con la db.' + err);
// });
};
module.exports = obtenerAlumno;