Re: [gnome-db] Gda Introspection.
- From: Daniel Espinosa <esodan gmail com>
- To: Carlos Savoretti <csavoretti gmail com>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] Gda Introspection.
- Date: Tue, 24 Jan 2012 18:03:10 -0600
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'd
like to make you some question.
In the latest version of Gda I've found a problem w introspection
binding Python
Here it is test.py
--------------------------------------------------------------------------
from gi.repository import Gda
connection = Gda.Connection().open_from_dsn("test", None, 0)
print connection.get_cnc_string()
parser = Gda.SqlParser ()
print parser
statement = parser.parse_string("SELECT * FROM customers")
print statement
if statement.check_structure():
print "yes"
else:
print "no"
print statement
data_model = connection.statement_execute_select(statement, set1)
print data_model
connection.close()
--------------------------------------------------------------------------
python ./test.py
DB_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 NOT
return 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, or
what ? It is in order to correct the bug (if any)
Many thanks for your help ...
Regards
Carlos 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]