I just checked the docs for the older version (4.1) SQL Modes. There
is no mention of the NO_BACKSLASH_ESCAPES mode.

http://dev.mysql.com/doc/refman/4.1/en/server-sql-mode.html

We have some unintended consequences. I'm surprised it doesn't
complain about this.

On Jun 14, 5:06 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> This line:
>
>             self._execute("SET sql_mode='NO_BACKSLASH_ESCAPES';")
>
> is important for security issues. SQL injections may be possible if
> you comment it. I do not know why it does not work on your system. It
> should
>
> http://mysql.linux.cz/doc/refman/5.5/en/server-sql-mode.html#sqlmode_...
>
> On Jun 13, 5:11 pm, The Czar <paulczar...@gmail.com> wrote:
>
> > For some reason, attempted connection to a mysql v4.1.25 db on FreeBSD
> > fails. The web2py is the latest version - but it happened on earlier
> > versions also. The error & db.py for the application failing looks
> > like this:
>
> > Error traceback
>
> > Traceback (most recent call last):
> >   File "/m/content/www/data/web2py-1-79-2/gluon/restricted.py", line
> > 178, in restricted
> >     exec ccode in environment
> >   File "/m/content/www/data/web2py-1-79-2/applications/myapp/models/
> > db.py", line 15, in <module>
> >     db = DAL('mysql://login:pas...@192.168.1.2/myapp') # use mySQL
> >   File "/m/content/www/data/web2py-1-79-2/gluon/sql.py", line 3855, in
> > DAL
> >     raise RuntimeError, "Failure to connect to DB. Tried 5 times"
> > RuntimeError: Failure to connect to DB. Tried 5 times
>
> > In file: /m/content/www/data/web2py-1-79-2/applications/myapp/models/
> > db.py
>
> > # -*- coding: utf-8 -*-
>
> > #########################################################################
> > ## This scaffolding model makes your app work on Google App Engine too
> > #########################################################################
>
> > if request.env.web2py_runtime_gae:            # if running on Google
> > App Engine
> >     db = DAL('gae')                           # connect to Google
> > BigTable
> >     session.connect(request, response, db=db) # and store sessions and
> > tickets there
> > else:                                         # else use a normal
> > relational database
> >     db = DAL('mysql://login:pas...@192.168.1.2/myapp') # use mySQL
>
> > =====
> > Now if I comment out line 934 in gluon/sql.py, it connects without
> > error! The line looks like this:
> >  self._execute("SET sql_mode='NO_BACKSLASH_ESCAPES';")
>
> > This has been the case from rel. 1.76 to current 1.79.2.  Any ideas
> > about this error & work around. I don't always remember to make the
> > change for new releases and that causes unnecessary delay .
>
> > Thanks.

Reply via email to