Oh, well.
May be that's an Oracle bug then. I use my custom 'console.py' script here,
but output should be clear enough:

BTW - time_start column was created by web2py with this line:
    Field('time_start','datetime'),

sn...@nezhdanov:~/VTC/pinger/elixir$ ./console.py
select time_start from pinger_results where id=1;
[('TIME_START', <type 'cx_Oracle.DATETIME'>, 23, 7, 0, 0, 1)]
select time_start from pinger_results where time_start='2010-04-20
15:16:17';
ORA-01861: литерал не соответствует формату строки
ALTER SESSION set NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
ok
select time_start from pinger_results where time_start='2010-04-20
15:16:17';
[('TIME_START', <type 'cx_Oracle.DATETIME'>, 23, 7, 0, 0, 1)]
==========
no comments

Alexey

On Mon, Apr 19, 2010 at 8:27 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:

> taking a second look at the source code
>
>            self._execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-
> MM-DD';")
>            self._execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
> 'YYYY-MM-DD HH24:MI:SS';")
>
> Now you propose adding:
>
>            self._execute("ALTER SESSION set NLS_DATE_FORMAT = 'YYYY-
> MM-DD HH24:MI:SS';")
>
> But date does not have HH224, MI, SS, only timestamp does.
>
> On Apr 19, 11:19 am, Alexey Nezhdanov <snak...@gmail.com> wrote:
> > No, I'm all for it. Actually it sounds more like bugfix since atm web2py
> > can't make datetime queries on Oracle.
> >
> > On Mon, Apr 19, 2010 at 6:16 PM, mdipierro <mdipie...@cs.depaul.edu>
> wrote:
> > > There is no hook for this, but should this not be always the default?
> > > If so I am happy to add it to trunk. Any counterindication?
> >
> > > On Apr 19, 12:32 am, Alexey Nezhdanov <snak...@gmail.com> wrote:
> > > > Hi.
> > > > Sometimes I have to execute this line prior to making a query:
> > > >     oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT = 'YYYY-MM-DD
> > > > HH24:MI:SS';")
> >
> > > > That is because Oracle by default uses different date format that
> causes
> > > my
> > > > queries to fail.
> > > > The problem is that doing that in model is incorrect - this should be
> > > > executed just once for each db connection.
> > > > Doing that just prior to query is inconvenient and still incorrect -
> I am
> > > > probably reusing same connection.
> > > > Can I somehow tell web2py to execute this sql right after calling
> > > connect()?
> >
> > > > Regards
> > > > Alexey
> >
> > > > --
> > > > Subscription settings:
> > >http://groups.google.com/group/web2py/subscribe?hl=en
>

Reply via email to