  | |  | mysql & stored procedures | mysql & stored procedures 2005-02-04 - By hmetu@(protected)
Back Hi!
DBMS - MySql5.0.1-alpha: Driver - myodbc 3.51:
I created a table in my database over command line. mysql> create table customers(firstname,familyname,address,telno,accountno,firm)
Filled it with records and tested it - it worked. Then I created a stored procedure: delimiter $ mysql> create procedure spFirm(IN company char(15), IN year INT) BEGIN IF year = 2005 then select * from customers where firm = company; else select * from customers; end if; END$ It was okay and I tested it as follows
mysql> call spFirm('firmname',2005)$ It delivered the right results.
Now I wanted to test and process the results over MyODBC. The connections were ok. //... stmt = "call spFirm('Seqis',2005)$"; ret = SQLExecDirect(hstmt, stmt.c_str(), stmt.Length()); while ((ret = SQLFetch(hstmt)) != SQL_NO_DATA){ SQLRowCount(hstmt, &nRows); SQLNumResultCols(hstmt, &nCols); //... } Both SQLRowCount (with nRows) and SQLNumResultCols (with nCols) do deliver 0. But when I use normal "select * from customers" - I do get the right results.
What is the best way to go about stored procedures here? I know (as newbie) that I'm missing something, but I cannot figure it out. Who can give me some tipps on how to go about it? Examples are also very much welcomed. Thanks in anticipation, Harp
-- DSL Komplett von GMX +++ Superg??nstig und stressfrei einsteigen! AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
-- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/win32?unsub=mysql@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |