-
Notifications
You must be signed in to change notification settings - Fork 40
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
Call of stored procedures gives Commands out of sync
error
#276
Comments
Thanks. Can you please post a reproducible example here? |
@krlmlr
pool <- pool::dbPool(
user = Sys.getenv("DB_USER"),
password = Sys.getenv("DB_PASS"),
host = Sys.getenv("DB_HOST"),
dbname = "your_schema_here",
drv = RMariaDB::MariaDB()
)
# gives right data frame
dbGetQuery(pool, "CALL GetUser('user1')")
# the I call this and error occurs
dbGetQuery(pool, "CALL GetUser('user1')")
#Error: Commands out of sync; you can't run this command now [2014] Here is the solution for RMySQL link |
@krlmlr is my example above suitable for you as a reproducible example of my issue? |
Thanks, I can't run the
Could you please share the setup code either as a self-contained |
Sorry about this. It should work DELIMITER //
CREATE PROCEDURE `GetUser` (in in_username VARCHAR(36))
BEGIN
SELECT * FROM users_all WHERE username = in_username;
END |
@krlmlr is my example above proper for you? |
Really good description of the underlying problem here: https://stackoverflow.com/questions/614671/commands-out-of-sync-you-cant-run-this-command-now So the immediate problem is that the RMySQL solution uses functions that aren't available in RMariaDB? while(dbMoreResults(db) == TRUE) {
dbNextResult(db)
} |
Yes, that's a problem. |
I get this error when I call a simple stored procedure from my shiny app more than once -- but only on shinyapps.io, not when running on my local machine. The stored procedure definition: And my shiny code:
|
Thanks, sorry this fell off the radar. I need to take a closer look. Multiple result sets aren't really defined in the DBI specs at this time (which is I think the scope of We could default to returning the first result set, which might solve the issue at hand. Not sure what other problems arise in other contexts. |
This may not be helpful, but I found that the same error occurs on shinyapps.io whether I use the RMySQL driver or RMariaDB. If I run the code locally, RMySQL reports the error, but RMariaDB does not. |
Reprex: con <- RMariaDB::mariadbDefault()
DBI::dbWriteTable(con, "users_all", data.frame(username = c("user1", "user2", "user3"), age = c(21, 25, 31)), overwrite = TRUE)
DBI::dbExecute(con, "DROP PROCEDURE IF EXISTS GetUser")
#> [1] 0
DBI::dbExecute(con, "
CREATE PROCEDURE `GetUser` (in in_username VARCHAR(36))
BEGIN
SELECT * FROM users_all WHERE username = in_username;
END"
)
#> [1] 0
# gives right data frame
DBI::dbGetQuery(con, "CALL GetUser('user1')")
#> username age
#> 1 user1 21
# the I call this and error occurs
DBI::dbGetQuery(con, "CALL GetUser('user1')")
#> Error: Commands out of sync; you can't run this command now [2014] Created on 2024-04-01 with reprex v2.1.0 |
Hello everyone!
I get error
Commands out of sync; you can't run this command now [2014]
after first call of Stored Procedure.You can find example of my code here
Actually, my problem is duplication of this issue, but there is no solution for it yet,
There is solution only for RMySQL (which deprecated and I don't want to use it) here
The text was updated successfully, but these errors were encountered: