-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error executing delete sql when no rows are deleted #389
Comments
After more testing, I found out the update and execute behaves the same way. If I run an update that results in 0 rows being updated, it throws an error the same way as described above. |
Hi @snotmare , I am trying to recreate but not having any luck. I created a table with 2 columns, added an entry, then double delete it with: let result = await connection.query('DELETE FROM MIRISH.ODBCISSUE389 WHERE ID = 1');
console.log(result);
result = await connection.query('DELETE FROM MIRISH.ODBCISSUE389 WHERE ID = 1');
console.log(result); When I run it, I get the following: [
statement: 'DELETE FROM MIRISH.ODBCISSUE389 WHERE ID = 1',
parameters: [],
return: undefined,
count: 1,
columns: []
]
[
statement: 'DELETE FROM MIRISH.ODBCISSUE389 WHERE ID = 1',
parameters: [],
return: undefined,
count: 0,
columns: []
] Is there something different you are doing that I could try? |
try {
}); Error executing the SQL query: [Error: [odbc] Error executing the sql statement] { odbcErrors: [] } @snotmare I am also getting same error with insert, update and select queries. Could you please help me to fix this issue? |
@markdirish thanks for the response! It looks like you're using the query() method to execute your SQL, I didn't realize you could do that. When I try your way, I get the same results (it works). Here is the code I'm running to produce the error...
With an update...
I would prefer to use a prepared statement over the query method because we use parameter binding. |
@harsh-savvient When I'm using a pool, I will use the .aquire() and .release() methods to get a connection and execute on that connection rather than the pool itself. Maybe that will help you?
|
TypeError: pool.acquire is not a function Please check the following updated code.
I am still getting the same error. Could you please help me with this? @snotmare
|
@harsh-savvient Ah, I'm sorry, we're actually using a different pool library rather than the built-in one for odbc. We're using generic-pool. Either way, try your code with a connection object instead of a pool object and see if that makes a difference. |
Please check the following code block:
Error |
Hello @markdirish ! Just checking in... was my last response to you helpful in recreating the issue? Is there more information that I can provide to help? Perhaps the issue is a difference between using the .query() method and a prepared statement. |
Hello!
I have odbc 2.4.8 installed and have noticed an error when deleting data. I believe I should NOT be receiving this error.
The error occurs when executing a delete statement and no rows are actually deleted. For example...
I think odbc should NOT throw an error, but instead simply return a count of 0 since no rows were deleted. Here is a screen shot of the error I received. Notice that the odbcErrors array is empty.
Thanks all!
The text was updated successfully, but these errors were encountered: