Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE `myDB`.`lee_expout` (IN e int, IN g int)
- BEGIN
- select lm.groupname, lee.location, starttime, dark,
- inadist,smldist,lardist,emptydur,inadur,smldur,lardur,emptyct,entct,inact,smlct,larct
- from lee join leegroup_map lm using (location)
- where exp_id= e and std_interval!=0 and groupset_id= g
- order by starttime,groupname,location;
- END
- library(DBI)
- library(RMySQL)
- db <- dbConnect(MySQL(), user="user", password="pswd",
- dbname="myDB", host="the.host.com")
- #args to pass to the procedure
- exp_id<-16
- group_id<-2
- #the procedure call
- p <- paste('CALL lee_expout(', exp_id, ',', group_id,')', sep= ' ')
- #the bare query
- q <- paste('select lm.groupname, lee.location, starttime, dark,
- inadist,smldist,lardist,emptydur,inadur,smldur,lardur,emptyct,entct,inact,smlct,larct
- from lee join leegroup_map lm using (location)
- where exp_id=',
- exp_id,
- ' and std_interval!=0 and groupset_id=',
- group_id,
- 'order by starttime,groupname,location', sep=' ')
- rs_p <- dbSendQuery(db, statement=p) #run procedure and fail
- p_data<-fetch(rs_p,n=30)
- rs_q <- dbSendQuery(db, statement=q) #or comment out p, run query and succeed
- q_data<-fetch(rs_q,n=30)
- p <- paste('CALL lee_expout(', exp_id, ',', group_id,')', sep= ' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement