dear friends,
I need to execute mysql stored procedure with input parameter and need
to
get some values to ROR calling application.
if some one have idea please let me know.
thanks
sam
dear friends,
I need to execute mysql stored procedure with input parameter and need
to
get some values to ROR calling application.
if some one have idea please let me know.
thanks
sam
Hey Sam,
You can use *execute *function of Activerecord and call the store
procedure.
active_record_object = YourActiveRecord.new
stmt =
active_record_object.connection.execute(sql_call_to_stored_procedure)
# object of array to store the result
records = []
while row = MySQL::fetch_array(stmt)
records << row
end
Hope this may help .
Regards,
Naren
On Mon, Jun 21, 2010 at 2:36 PM, Sampath M.
[email protected]wrote:
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
~N a r e n
i think i used same way. but it was not success. please check.
============== proc. ======================
DELIMITER $$
CREATE DEFINER=root
@localhost
PROCEDURE proc_validate_login
(IN
param_uname varchar(50),IN param_pwd varchar(50),OUT test varchar(50))
BEGIN
DECLARE res int;
Select username into test from tbl_users where
‘userName’ = param_uname and ‘PWD’ = param_PWD;
#insert into tbl_users(userName,pwd) values(test,‘sampath2’);
END
============================================
i’m trying to call proc using this command
ActiveRecord::Base.connection.execute(“call
proc_validate_login(‘sam’,‘sam’,@test)”)
for insertion this is working. but i need to execute select statement
and
getting some values from proc.
do u have idea?
On Mon, Jun 21, 2010 at 9:18 PM, Narendra sisodiya
<[email protected]
I need to get status of insertions and need to create new userID inside
the
stored proc. thats why I need to use this.
On Tue, Jun 22, 2010 at 12:59 PM, Narendra sisodiya <
On 22 June 2010 07:57, Sampath M. [email protected]
wrote:
I need to get status of insertions and need to create new userID inside the
stored proc. thats why I need to use this.
s/need/want/
Nothing there you can’t do without resorting to SPs.
Michael P. wrote:
On 22 June 2010 07:57, Sampath M. [email protected]
wrote:I need to get status of insertions and need to create new userID inside the
stored proc. thats why I need to use this.s/need/want/
Nothing there you can’t do without resorting to SPs.
Correct. But if a SP really is the best solution in this case (there
are a few such situations!), perhaps you can use find_by_sql or
something to retrieve records.
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
this time i’m doing little bit large project. main concerns are
security
and performance. thats why im looking for the stored procs. I really
really
need this.
On Tue, Jun 22, 2010 at 9:01 PM, Marnen Laibow-Koser
why don’t you use select query or ActiveRecord.find for fetching a
record
from table? I guess its better way.
Regards,
Narendra
On Mon, Jun 21, 2010 at 8:47 PM, Sampath M.
[email protected]wrote:
‘userName’ = param_uname and ‘PWD’ = param_PWD;
On Mon, Jun 21, 2010 at 9:18 PM, Narendra sisodiya <
active_record_object.connection.execute(sql_call_to_stored_procedure)
[email protected][email protected]
–
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
~N a r e n
what do u mean ?
On Wed, Jun 23, 2010 at 12:35 AM, Marnen Laibow-Koser
Sampath M. wrote:
what do u mean ?
By what? Since you failed to quote the text you were replying to, I
have no idea what you’re referring to.
On Wed, Jun 23, 2010 at 12:35 AM, Marnen Laibow-Koser
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Sampath M. wrote:
this time i’m doing little bit large project. main concerns are
security
Which stored procedures will not help with.
and performance.
Which stored procedures may or may not help with.
thats why im looking for the stored procs. I really
really
need this.
No, you probably don’t.
On Tue, Jun 22, 2010 at 9:01 PM, Marnen Laibow-Koser
Sampath,
Five minutes of googling turned up a ton of references. Check out the
following:
There were many more. Type in
using stored procedures in Ruby on Rails and you will get a lot of
references.
Bharat
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs