Hi,
I use RMySQL to connect to MySQL server where I have a couple of stored
procedures.
I know that the function for the stored procedures "is not yet
implemented", but I was trying to
get around the problem connecting like that:
drv <- dbDriver("MySQL")
con <- dbConnect(drv,user=MyUser, password=MyPasswd, dbname=MyDBName,
host=MyHost, client.flag="196608" )
where 196608 is a combination of CLIENT_MULTI_RESULTS and
CLIENT_MULTI_STATEMENTS as mentioned in the
mysql_real_connect() documentation. Without these flags stored
procedures calls do not run at all.
I also do fetching the results in a loop - as suggested in the doc, so:
doStoredProcedureFetch <- function( connection, sql ) {
res <- dbSendQuery( connection, sql )
data <- fetch( res, n=-1 )
repeat {
fetch( res, n=-1 )
if( dbHasCompleted( res ) ) break ;
}
data
}
However, sometimes I get the error message:
"RS-DBI driver: (could not run statement: Lost connection to MySQL
server during query)"
and the connection has been lost indeed. Sometimes it does not happen
and I may run yet
another query. Looks that happens with specific queries only - plain
SELECTs run ok, some CALLs for procedure, too.
Some don't.
I'm seriously confused :|
Could you give ant hints why it happens, how to fix it and what is the
problem with stored procedures?
Cheers,
Michal
--------------------------------------------------------
This email is confidential and intended solely for the use o...{{dropped}}