I found the glue!!!
In PyGObject when a function have out parameters, like Gda.SqlParser.parse_string and Gda.Connection.parse_sql_string, it returns a tuple with the first element as the function's return value and then, in the same order of the parameters, the out ones.
Then to use the above functions you need:
(statement, str) = parser.parse_string ("SELECT * FROM customers; SELECT * FROM parts_table")
Then statement is set to a Gda.Statement object and str to "SELECT * FROM parts_table"
Or simple access the return values from the tuple by using its index like ret_tuple[index], as recomended in the last mail.
For future problems you can take a look at:
http://live.gnome.org/PyGObject/IntrospectionPorting#Output_arguments
I can confirm your problem and its present even if you use Gda.Connection.parse_sql_string, the return value is a tuple with the object you need inside it. I'm using Gda from master with python 2.7.2 and with python 3.2.2 with python-gobject 3.0.0.
I've used that functions in Vala and its not present.
I've review GIR file and it's correct.
I think this is a python-gobject problem.
In the middle you can use:
stm = parser.parse_string ("YOUR SQL")
statement = stm[0]
This is because the first element in the list is a Gda.Statement, witch you can use.
Or use Gda.Connection functions to execute directly string commands like: execute_non_select, execute_select, they return Gda.DataModel objects (I tested them and works in python)
2012/1/23 Carlos Savoretti <csavoretti gmail com>Hi !!!Being you're working (a lot and well) with libgda introspection, I'dlike to make you some question.In the latest version of Gda I've found a problem w introspectionbinding PythonHere it is test.py--------------------------------------------------------------------------from gi.repository import Gdaconnection = Gda.Connection().open_from_dsn("test", None, 0)print connection.get_cnc_string()parser = Gda.SqlParser ()print parserstatement = parser.parse_string("SELECT * FROM customers")print statementif statement.check_structure():print "yes"else:print "no"print statementdata_model = connection.statement_execute_select(statement, set1)print data_modelconnection.close()--------------------------------------------------------------------------python ./test.pyDB_NAME=sales_test.db;DB_DIR=%2fusr%2flocal%2fetc%2flibgda-5.0%2f;EXTRA_FUNCTIONS=TRUE;REGEXP=TRUE;EXTRA_COLLATIONS=TRUE<SqlParser object at 0xb73f616c (GdaSqlParser at 0x856f2a0)>(<Statement object at 0xb73f634c (GdaStatement at 0x8568210)>, None)Traceback (most recent call last):File "./test.py", line 9, in <module>if statement.check_structure():AttributeError: 'tuple' object has no attribute 'check_structure'Conclussion: It seems (after some debugging) that the parsed statement DOES NOTreturn a GdaStatement Object, but rather a 'tuple' Python object...Of course connection.statement_execute_select() claims for the same issue...the object statement is not an 'GdaStatment'...Could you give some clue about the problem is Python, the introspecton libs, orwhat ? It is in order to correct the bug (if any)Many thanks for your help ...RegardsCarlos Savoretti------------------
--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE)