Ok, more tests.
If I change sql.py around line 790
# self._execute = lambda *a, **b: self._cursor.execute(*a,
**b)
self._execute = lambda *a: self._cursor.execute(a[:-1])
I get
Traceback (most recent call last):
File "C:\web2py\trunk\gluon\restricted.py", line 98, in restricted
exec ccode in environment
File "C:/web2py/trunk/applications/test/models/db.py", line 7, in
<module>
SQLField('name','string') )
File "C:\web2py\trunk\gluon\sql.py", line 860, in define_table
raise e
TypeError: The first argument to execute must be a string or unicode
query.
sql.log
timestamp: 2009-02-27T10:43:25.656000
CREATE TABLE person(
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL,
name VARCHAR(32)
);
Note the ending ';'
Now I revert the change in sql.py around line 790
self._execute = lambda *a, **b: self._cursor.execute(*a,
**b)
# self._execute = lambda *a: self._cursor.execute(a[:-1])
and I add
if self._db._dbname == 'db2': other=''
after
other = ';'
around line 1115
then the creation runs fine as per the sql.log
timestamp: 2009-02-27T11:01:12.875000
CREATE TABLE person(
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL,
name VARCHAR(32)
)
success!
timestamp: 2009-02-27T11:01:15.984000
CREATE TABLE dog(
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL,
name VARCHAR(32),
owner INT, FOREIGN KEY (owner) REFERENCES person(id) ON DELETE
CASCADE
)
success!
but inserting a new person fails:
Traceback (most recent call last):
File "C:\web2py\trunk\gluon\restricted.py", line 98, in restricted
exec ccode in environment
File "C:/web2py/trunk/applications/test/controllers/appadmin.py",
line 271, in <module>
File "C:\web2py\trunk\gluon\globals.py", line 75, in <lambda>
self._caller = lambda f: f()
File "C:/web2py/trunk/applications/test/controllers/appadmin.py",
line 103, in insert
if form.accepts(request.vars, session):
File "C:\web2py\trunk\gluon\sqlhtml.py", line 561, in accepts
self.vars.id = self.table.insert(**fields)
File "C:\web2py\trunk\gluon\sql.py", line 1304, in insert
self._db._execute(query)
File "C:\web2py\trunk\gluon\sql.py", line 789, in <lambda>
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: ('42000', '[42000] [IBM][iSeries Access ODBC Driver]
[DB2 UDB]SQL0104 - Token ; was not valid. Valid tokens: <END-OF-
STATEMENT>. (-104) (SQLExecDirectW)')
the offending ';' again...
Denes.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---