Re: [R] RMySQL and Stored procedures

2009-11-03 Thread Dieter Menne



Orvalho Augusto wrote:
 
 Can someone provide me a good way to circumvent the lack of calling
 Stored Procedures from RMySQL?
 
 I can not rewrite those stored procedures on R because there a lot
 more folks here that only understands SQL.
 
 The stored procedure returns a resultset.
 

Use RODBC instead.

Assuming two stored procedures : 

CREATE PROCEDURE getusers (in userid INT)
BEGIN
  SELECT name from jos_users where id  userid;
END;

CREATE PROCEDURE getusers0() 
BEGIN
  SELECT name from jos_users;
END;

The following works
#
library(RODBC)
con = odbcConnect(mysql,uid=xxx,pwd=yyy)
users0 = sqlQuery(con,CALL getusers0)
users0
users = sqlQuery(con,CALL getusers(20))
users
close(con)
#
Dieter
-- 
View this message in context: 
http://old.nabble.com/RMySQL-and-Stored-procedures-tp26159085p26160033.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RMySQL and Stored procedures

2009-11-01 Thread Orvalho Augusto
Can someone provide me a good way to circumvent the lack of calling
Stored Procedures from RMySQL?

I can not rewrite those stored procedures on R because there a lot
more folks here that only understands SQL.

The stored procedure returns a resultset.

Thanks
Caveman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.