Hi everyone !
I have an application working correctly with version 1.87.3 of web2py
and SQL Server 2000. The database has a collation
Modern_Spanish_CI_AS.
My problems start when upgrade to version 1.93.2. In my code have
originally:
db = SQLDB('mssql2://User:Password@MyServer/MyDataBase', pool_size=10,
db_code="LATIN-1")
from gluon.tools import *
auth = Auth(globals(), db)
auth.define_tables(migrate = False)
db.define_table('Tareas'
, SQLField('Descripcion', 'string', length=200, required=True)
, migrate = False
)
The Auth tables was created with this setup. String values are
nvarchar datatype in table.
Whe I try to login obtain this error:
Traceback (most recent call last):
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\restricted.py", line 188, in restricted
exec ccode in environment
File "C:/Documents and Settings/hansen/Escritorio/Web2Py/web2py
fuentes 1-93-2/applications/sgs/controllers/default.py", line 55, in
<module>
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\globals.py", line 95, in <lambda>
self._caller = lambda f: f()
File "C:/Documents and Settings/hansen/Escritorio/Web2Py/web2py
fuentes 1-93-2/applications/sgs/controllers/default.py", line 34, in
user
return dict(form=auth())
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\tools.py", line 1032, in __call__
return self.login()
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\tools.py", line 1447, in login
user = self.db(table_user[username] ==
form.vars[username]).select().first()
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 4737, in select
return self.db._adapter.select(self.query,fields,attributes)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1025, in select
rows = response(sql)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1015, in response
self.execute(sql)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1931, in execute
return self.log_execute(a,'utf8')
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1094, in log_execute
return self.cursor.execute(*a,**b)
ProgrammingError: ('The SQL contains 0 parameter markers, but 1
parameters were supplied', 'HY000')
I try changing the connection string to "mssql"
db = DAL('mssql://User:Password@MyServer/MyDataBase', pool_size=10,
db_code="LATIN-1")
and everything go fine until I discover errors updating nvarchar
fields. If read a record with the string "Cañería" and update with the
same, the result was something like "cañeria".
Put a print and the result was
UPDATE Tareas SET Descripcion='Instalar impresora ca+¦eria' WHERE
(Tareas.id = 1);
of course, no unicode modificator "N".
Ok, I know "mssql2" is needed with unicode strings, but if I use an
error appears, the same when all this thing start...
Traceback (most recent call last):
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\restricted.py", line 188, in restricted
exec ccode in environment
File "C:/Documents and Settings/hansen/Escritorio/Web2Py/web2py
fuentes 1-93-2/applications/sgs/controllers/tareas.py", line 408, in
<module>
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\globals.py", line 95, in <lambda>
self._caller = lambda f: f()
File "C:/Documents and Settings/hansen/Escritorio/Web2Py/web2py
fuentes 1-93-2/applications/sgs/controllers/tareas.py", line 292, in
Consulta
return GenerarFormularioBusqueda("C")
File "C:/Documents and Settings/hansen/Escritorio/Web2Py/web2py
fuentes 1-93-2/applications/sgs/controllers/tareas.py", line 84, in
GenerarFormularioBusqueda
Registros = db().select(db.TareasTipo.id,
db.TareasTipo.Descripcion, orderby=db.TareasTipo.Descripcion)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 4737, in select
return self.db._adapter.select(self.query,fields,attributes)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1025, in select
rows = response(sql)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1015, in response
self.execute(sql)
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1931, in execute
return self.log_execute(a,'utf8')
File "C:\Documents and Settings\hansen\Escritorio\Web2Py\web2py
fuentes 1-93-2\gluon\dal.py", line 1094, in log_execute
return self.cursor.execute(*a,**b)
ProgrammingError: ('The SQL contains 0 parameter markers, but 1
parameters were supplied', 'HY000')
Try changing db_code property without any results.
Some ideas ?