2009/12/17 mdipierro <[email protected]>:
> In the web based shall can you try:
>
> print db
> print db.instansie
> print db.instansie.naam
>
> what do you get? which os? web2py version? binary or source?
Last question first:
This is on a Debian 64-bit system on which I unpacked web2py_src.zip.
web2py Shell Version 1.74.3 (2009-12-16 15:11:54)
In[0]:
print db
Out[0]:
<SQLDB {'auth_event': <Table {'origin': <gluon.sql.Field object at
0x9834050>, 'client_ip': <gluon.sql.Field object at 0x98344d0>,
'user_id': <gluon.sql.Field object at 0x9834750>, 'description':
<gluon.sql.Field object at 0x9834310>, '_referenced_by': [], 'fields':
['id', 'time_stamp', 'client_ip', 'user_id', 'origin', 'description'],
'_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_auth_event.table',
'ALL': <gluon.sql.SQLALL object at 0x9834110>, '_tablename':
'auth_event', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'time_stamp': <gluon.sql.Field
object at 0x9834510>, 'virtualfields': [], 'id': <gluon.sql.Field
object at 0x9834350>}>, 'auth_permission': <Table {'ALL':
<gluon.sql.SQLALL object at 0x9834690>, 'virtualfields': [], 'name':
<gluon.sql.Field object at 0x98348d0>, '_referenced_by': [], 'fields':
['id', 'group_id', 'name', 'table_name', 'record_id'], '_db': <SQLDB
{...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_auth_permission.table',
'_logfilename': 'applications/kbase/databases/sql.log', 'table_name':
<gluon.sql.Field object at 0x9834890>, '_tablename':
'auth_permission', '_format': None, 'record_id': <gluon.sql.Field
object at 0x9834610>, 'group_id': <gluon.sql.Field object at
0x98347d0>, 'id': <gluon.sql.Field object at 0x9834650>}>,
'auth_group': <Table {'ALL': <gluon.sql.SQLALL object at 0x9834e90>,
'description': <gluon.sql.Field object at 0x9834ad0>,
'_referenced_by': [('auth_membership', 'group_id'),
('auth_permission', 'group_id')], 'fields': ['id', 'role',
'description'], '_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_auth_group.table',
'role': <gluon.sql.Field object at 0x9834bd0>, '_tablename':
'auth_group', '_format': '%(role)s (%(id)s)', '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9834e50>}>, 'veld': <Table {'ALL':
<gluon.sql.SQLALL object at 0x9c16090>, '_referenced_by':
[('skrywer_artikel', 'veld_id')], 'fields': ['id', 'navorsingsveld'],
'_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_veld.table',
'_tablename': 'veld', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'navorsingsveld':
<gluon.sql.Field object at 0x9c16590>, 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9c16bd0>}>, '_folder':
'applications/kbase/databases', 'artikel': <Table {'ALL':
<gluon.sql.SQLALL object at 0x9830790>, 'publikasie_id':
<gluon.sql.Field object at 0x9830750>, '_tablename': 'artikel',
'_referenced_by': [('skrywer_artikel', 'artikel_id'),
('sleutelwoorde', 'artikel_id')], 'fields': ['id', 'instansie_id',
'publikasie_tipe_id', 'publikasie_id', 'datum', 'issn', 'id_nr'],
'_db': <SQLDB {...}>, 'issn': <gluon.sql.Field object at 0x98307d0>,
'datum': <gluon.sql.Field object at 0x9830890>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_artikel.table',
'id_nr': <gluon.sql.Field object at 0x9830650>, 'instansie_id':
<gluon.sql.Field object at 0x98308d0>, '_format': None,
'_logfilename': 'applications/kbase/databases/sql.log',
'publikasie_tipe_id': <gluon.sql.Field object at 0x9830590>,
'virtualfields': [], 'id': <gluon.sql.Field object at 0x9830850>}>,
'_cursor': <sqlite3.Cursor object at 0x9831768>, '_pool_size': 0,
'_connection': <sqlite3.Connection object at 0x964fb28>, '_lastsql':
'', '_dbname': 'sqlite', '_execute': <function <lambda> at 0x982fcf8>,
'publikasie': <Table {'uitgewer': <gluon.sql.Field object at
0x9830b10>, 'ALL': <gluon.sql.SQLALL object at 0x9830a50>, 'adres':
<gluon.sql.Field object at 0x98309d0>, 'publikasie': <gluon.sql.Field
object at 0x9830b90>, '_referenced_by': [('artikel',
'publikasie_id')], 'fields': ['id', 'publikasie', 'uitgewer',
'adres'], '_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_publikasie.table',
'_tablename': 'publikasie', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9830a10>}>, 'skrywer_artikel': <Table
{'ALL': <gluon.sql.SQLALL object at 0x995ec50>, 'skrywer_id':
<gluon.sql.Field object at 0x995e3d0>, '_referenced_by': [], 'fields':
['id', 'artikel_id', 'skrywer_id', 'instansie_id', 'veld_id'], '_db':
<SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_skrywer_artikel.table',
'instansie_id': <gluon.sql.Field object at 0x995eb50>, 'veld_id':
<gluon.sql.Field object at 0x995ebd0>, '_tablename':
'skrywer_artikel', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x995ec10>, 'artikel_id': <gluon.sql.Field
object at 0x9c16f10>}>, 'publikasie_tipe': <Table {'ALL':
<gluon.sql.SQLALL object at 0x9830d90>, '_referenced_by': [('artikel',
'publikasie_tipe_id')], 'fields': ['id', 'tipe'], '_db': <SQLDB
{...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_publikasie_tipe.table',
'tipe': <gluon.sql.Field object at 0x9830c50>, '_tablename':
'publikasie_tipe', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9830c10>}>, 'skrywer': <Table {'ALL':
<gluon.sql.SQLALL object at 0x9830dd0>, 'e_pos': <gluon.sql.Field
object at 0x9830e10>, 'van': <gluon.sql.Field object at 0x9830e50>,
'instansie_id': <gluon.sql.Field object at 0x9830fd0>,
'_referenced_by': [('skrywer_artikel', 'skrywer_id')], 'fields':
['id', 'naam', 'van', 'instansie_id', 'e_pos'], '_db': <SQLDB {...}>,
'_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_skrywer.table',
'_format': None, '_tablename': 'skrywer', 'naam': <gluon.sql.Field
object at 0x9830b50>, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9830f90>}>, '_db_codec': 'UTF-8',
'_translator': {'upper': 'UPPER(%(field)s)', 'reference': 'REFERENCES
%(foreign_key)s ON DELETE %(on_delete_action)s', 'text': 'TEXT',
'random': 'Random()', 'datetime': 'TIMESTAMP', 'substring':
'SUBSTR(%(field)s,%(pos)s,%(length)s)', 'boolean': 'CHAR(1)',
'extract': "web2py_extract('%(name)s',%(field)s)", 'id': 'INTEGER
PRIMARY KEY AUTOINCREMENT', 'is null': 'IS NULL', 'primarykey':
'PRIMARY KEY (%s)', 'is not null': 'IS NOT NULL', 'blob': 'BLOB',
'notnull': 'NOT NULL DEFAULT %(default)s', 'string':
'CHAR(%(length)s)', 'date': 'DATE', 'integer': 'INTEGER', 'password':
'CHAR(%(length)s)', 'lower': 'LOWER(%(field)s)', 'left join': 'LEFT
JOIN', 'double': 'DOUBLE', 'decimal': 'DOUBLE', 'upload':
'CHAR(%(length)s)', 'time': 'TIME'}, 'tables': ['auth_user',
'auth_group', 'auth_membership', 'auth_permission', 'auth_event',
'instansie', 'skrywer', 'publikasie_tipe', 'publikasie', 'artikel',
'veld', 'skrywer_artikel', 'sleutelwoorde'], 'instansie': <Table
{'ALL': <gluon.sql.SQLALL object at 0x9830490>, 'land':
<gluon.sql.Field object at 0x9830710>, '_referenced_by': [('skrywer',
'instansie_id'), ('artikel', 'instansie_id'), ('skrywer_artikel',
'instansie_id')], 'fields': ['id', 'naam', 'stad', 'land'], '_db':
<SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_instansie.table',
'stad': <gluon.sql.Field object at 0x9834d50>, '_format': None,
'_tablename': 'instansie', 'naam': <gluon.sql.Field object at
0x9834d90>, '_logfilename': 'applications/kbase/databases/sql.log',
'virtualfields': [], 'id': <gluon.sql.Field object at 0x9830550>}>,
'_uri': 'sqlite://storage.sqlite', 'auth_membership': <Table {'ALL':
<gluon.sql.SQLALL object at 0x98346d0>, 'group_id': <gluon.sql.Field
object at 0x9834c50>, 'user_id': <gluon.sql.Field object at
0x9834ed0>, '_referenced_by': [], 'fields': ['id', 'user_id',
'group_id'], '_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_auth_membership.table',
'_tablename': 'auth_membership', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x9834550>}>, 'auth_user': <Table
{'first_name': <gluon.sql.Field object at 0x983d490>, 'last_name':
<gluon.sql.Field object at 0x983bf10>, '_referenced_by':
[('auth_membership', 'user_id'), ('auth_event', 'user_id')], 'fields':
['id', 'first_name', 'last_name', 'email', 'password',
'registration_key'], '_db': <SQLDB {...}>, '_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_auth_user.table',
'ALL': <gluon.sql.SQLALL object at 0x983b9d0>, 'email':
<gluon.sql.Field object at 0x983bf50>, 'password': <gluon.sql.Field
object at 0x983ba10>, '_tablename': 'auth_user', '_format':
'%(first_name)s %(last_name)s (%(id)s)', '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [],
'registration_key': <gluon.sql.Field object at 0x983bb50>, 'id':
<gluon.sql.Field object at 0x983b610>}>, 'sleutelwoorde': <Table
{'ALL': <gluon.sql.SQLALL object at 0x995ed90>, '_referenced_by': [],
'fields': ['id', 'sleutelwoord', 'artikel_id'], '_db': <SQLDB {...}>,
'_dbt':
'applications/kbase/databases/c8b669d15150d7109e5f7ab36744a5b7_sleutelwoorde.table',
'sleutelwoord': <gluon.sql.Field object at 0x995ec90>, '_tablename':
'sleutelwoorde', '_format': None, '_logfilename':
'applications/kbase/databases/sql.log', 'virtualfields': [], 'id':
<gluon.sql.Field object at 0x995ed50>, 'artikel_id': <gluon.sql.Field
object at 0x995ecd0>}>}>
In[1]:
print db.instansie
Out[1]:
instansie
In[2]:
print db.instansie.naam
Out[2]:
instansie.naam
In[3]:
for it in db().select(db.instansie.naam):
print it
Out[3]:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/home/js/web2py/gluon/sql.py", line 2975, in select
rows = response(query)
File "/home/js/web2py/gluon/sql.py", line 2970, in response
db._execute(query)
File "/home/js/web2py/gluon/sql.py", line 889, in <lambda>
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: Cannot operate on a closed database.
Regards
Johann
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.