[python-sybase] Limitation in parameter key length?

Skip Montanaro skip at pobox.com
Mon, 7 Jun 2004 08:57:02 -0500


Can someone explain why two select statements should yield different
results?

    >>> c.execute('select instrument,point_value,currency,tick_size,min_price_change'
    ...                   '  from history..underlying_contract_data_fp'
    ...                   '  where symbol = @symbol' 
    ...                   '    and instrument = @instrument',
    ...            {"@symbol": "MSFT", "@instrument": "E"})
    >>> c.fetchall()
    []
    >>> c.execute('select instrument,point_value,currency,tick_size,min_price_change'
    ...                   '  from history..underlying_contract_data_fp'
    ...                   '  where symbol = @sym'
    ...                   '    and instrument = @inst',
    ...            {"@sym": "MSFT", "@inst": "E"})
    >>> c.fetchall()
    [('E', 1.0, 'US    ', 0.01, 0.01)]

It seems to be a bug in the Sybase module's parameter expansion.  Is there
some limitation on the length of a parameter key?  This certainly suggests
there is:

    >>> c.execute('select instrument,point_value,currency,tick_size,min_price_change'
    ...                   '  from history..underlying_contract_data_fp'
    ...                   '  where symbol = @sym'
    ...                   '    and instrument = @instrume',
    ...            {"@sym": "MSFT", "@instrume": "E"})
    >>> c.fetchall()
    []
    >>> c.execute('select instrument,point_value,currency,tick_size,min_price_change'
    ...                   '  from history..underlying_contract_data_fp'
    ...                   '  where symbol = @sym'
    ...                   '    and instrument = @instrum',
    ...            {"@sym": "MSFT", "@instrum": "E"})
    >>> c.fetchall()
    [('E', 1.0, 'US    ', 0.01, 0.01)]

If there is, it should probably be documented.

-- 
Skip Montanaro
Got gigs? http://www.musi-cal.com/submit.html
Got spam? http://www.spambayes.org/
skip@pobox.com