Problem with bound parameters

Поиск
Список
Период
Сортировка
От charlie clark
Тема Problem with bound parameters
Дата
Msg-id opsql9yvntyt02yl@mail.isis.de
обсуждение исходный текст
Список pgsql-odbc
Dear all,

I've hit upon a problem using bound parameters with pgsql-ODBC and strings
containing newlines ("\n"). I'm using PostgreSQL 8.0 rc1 and pgsql-ODBC
8.0.01.01 with Python 2.3 and mxODBC 1.08. It looks like the parameter is
being incorrectly quoted by the pgODBC driver.

This is from the command line

problem = """The partition you have selected is resizable, the installer
has chosen a reasonable size for splitting the available space.

You may select your own size by dragging the splitter, or typing in a size
in Megabytes.

You may also choose to use the entire partition for ZETA."""
>>> c.execute("""SELECT content FROM localekit
                 INNER JOIN localekit_attributes AS attr ON
                 (attr.id = localekit.id_attribute)
                 WHERE
                 locale = 'enUS'
                 AND attribute = ?
                 AND application = ?""", (problem, 'Installer'))

Traceback (most recent call last):
   File "<pyshell#22>", line 1, in -toplevel-
     c.execute("""SELECT content FROM localekit
ProgrammingError: ('HY000', 7, 'ERROR:  type "lo" does not exist', 5898)
>>> c.execute("""SELECT content FROM localekit
                 INNER JOIN localekit_attributes AS attr ON
                 (attr.id = localekit.id_attribute)
                 WHERE
                 locale = 'enUS'
                 AND attribute = '%s'
                 AND application = '%s'""" %(problem, 'Installer'))

The first example raises the error for the incorrect type:
conn=36387816, query='select oid from pg_type where typname='lo''
     [ fetched 0 rows ]

Which means that the statement is being corrupted somehow.

In the second example the quoting is done directly in Python and no error
is raised.

Is it not advisable to use bound parameters with pgsql-ODBC?

Thanks for any help

Charlie

--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D-40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226

В списке pgsql-odbc по дате отправления:

Предыдущее
От: "Fernando González V."
Дата:
Сообщение: Help postgresql 8.0.3 and psqlodbc
Следующее
От: charlie clark
Дата:
Сообщение: PostgreSQL, ODBC and long strings