I just upgraded to Prisma 3.2.1. Seems that it bro...
# orm-help
e
I just upgraded to Prisma 3.2.1. Seems that it broke some of my code I where I was calling a Stored Procedure using the $executeRaw call. Does anyone know how to call a StoredProcedure and get a result back now ? This is what I was doing:
const getSequenceBlock = async (sequenceName, addCount = 1) => {
 
let data = false;
 
try {
st [callGetSequenceBlock, getStartEnd] = await prisma.$transaction([
      `prisma.$executeRaw(
CALL GetSequenceBlock('${sequenceName}', ${addCount}, @start, @end);
),`       `prisma.$queryRaw(
SELECT @newSeqStart, @newSeqEnd FROM DUAL;
),
Copy code
]);`    
// Successful result comes back as [ { '@newSeqStart': 146, '@newSeqEnd': 151 } ]
   
if (Array.isArray(getStartEnd)) {
     
const row = getStartEnd[0];
     
if (typeof row === 'object') {
       
data = {
         
start: row['@newSeqStart'],
         
end: row['@newSeqEnd'],
       
};
     
}
   
}
 
} catch (error) {
   
throw error;
 
}
 
return data;
};
r
@Edward Baer 👋 Have a look at this change. You can only use template strings if using
executeRaw
.
e
Will a $queryRaw allow me to call a Stored Procedure, and get the result back ?
r
Yes
But you need to use the tagged template literal (using back ticks) and not the function.
e
So, I just tried this, but I am still getting an error: const getStartEnd = await prisma.$queryRaw`CALL GetSequenceBlock('${sequenceName}', ${addCount}, @start, @end)`;
r
What’s the error?
e
Invalid
prisma.queryRaw()
invocation:
Raw query failed. Code:
N/A
. Message:
N/A
Any ideas ? I was now able to just do this: const getStartEnd = await prisma.$queryRaw`SELECT now() FROM DUAL`; But I am getting no where on the CALL Stored Procedure...
r
Could you create an issue here with the Stored Procedure as we would like to investigate the issue.
e