MySQL procedure return empty DataRow

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

v.lukyanovich
Posts: 1
Joined: 18 May 2012, 15:38

MySQL procedure return empty DataRow

Postby v.lukyanovich » 18 May 2012, 15:57

I'm using SFS pro 1.6.6 and MySQL 5.1

I'm having troubles with call stored procedure form jython extension
If I run procedure in mysql console then i see result tables

Code: Select all

mysql> CALL SP_USER_SET(1, 12345, '1_12345', '5ff1b38be59f3d9b6692fda50f2e4c98', 1337354769, '127.0.0.1');
+---------+
| id      |
+---------+
| 9383328 |
+---------+
1 row in set (0.00 sec)

+----------------------------+------------------------------+------------------+----------------+
| (@time:= unix_timestamp()) | ( @time_begin:= date_begin ) | ( @coll:= coll ) | (@logID := id) |
+----------------------------+------------------------------+------------------+----------------+
|                 1337355991 |                   1335816001 |                1 |        5781542 |
+----------------------------+------------------------------+------------------+----------------+
1 row in set (0.01 sec)

Query OK, 1 row affected (0.03 sec)


but when i run my code on Python:

Code: Select all

queryRes = db.executeQuery("CALL SP_USER_SET(1, 12345, '1_12345', '5ff1b38be59f3d9b6692fda50f2e4c98', 1337354769, '127.0.0.1');")
log("size: %d" % queryRes.size())
if (queryRes != None) and (queryRes.size() > 0):
        for row in queryRes:
            reply = row.getItem("id")
            log("sqlQuery1 reply: %s" % str(reply))


the result is an one object DataRow which does not contain the id field

Code: Select all

size: 1
sqlQuery1 reply: None


What this problem can be?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MySQL procedure return empty DataRow

Postby Lapo » 28 May 2012, 11:10

I think you would be better off by taking the direct reference to the connection object and user JDBC directly.
I am not familiar with procedure calls in MySQL but they might not work with the higher-level API we have build on top of JDBC.
You can call getConnection(), invoke the procedure directly and when you are done call connection.close() to release the connection back in the pool
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 33 guests