Can't put LIKE parameter in parameter dict?

Skip Montanaro <[email protected]> Thu, 10 Jun 2004 08:18:02 -0500
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
Can someone explain why these two seemingly identical queries return
different results?  Can't LIKE wildcards be given in parameter dictionaries?

    >>> c.execute('select distinct symbol, open_time, close_time,'
    ...           '                session_start, session_end, instrument'
    ...           '  from underlying_sessions'
    ...           '  where instrument = @i'
    ...           '    and symbol like "M%"',
    ...           {"@i": "E"})
    >>> len(c.fetchall())
    402
    >>> c.execute('select distinct symbol, open_time, close_time,'
    ...           '                session_start, session_end, instrument'
    ...           '  from underlying_sessions'
    ...           '  where instrument = @i'
    ...           '    and symbol like @s',
    ...           {"@i": "E",
    ...            "@s": "M%"})
    >>> len(c.fetchall())
    0

Thanks,

-- 
Skip Montanaro
Got gigs? http://www.musi-cal.com/submit.html
Got spam? http://www.spambayes.org/
[email protected]