#108 Columns with keyword names are problematic for some queries

Unstable_(example)
closed-rejected
None
5
2013-04-28
2012-11-20
No

Assume you create a SQLObject out of an existing table that happens to have a column named "group".
This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`.
NOT THOROUGHLY TESTED.

Discussion

<< < 1 2 (Page 2 of 2)
  • Oleg Broytman

    Oleg Broytman - 2012-11-23

    Using a complex set of shell wrapper over py.test. The central part is
    like the following:

    for test in "$@"; do
    py.test "$test" -D "$TESTDB_URI"
    done

    If you are interested in all details I can send you an archive of all
    shell scripts I use to maintain SQLObject. Give me your email; if you
    don't want to publish it -- send it to me by a private message.

    I'm going to try nose. The usage should be something like
    python -c "import nose; nose.run_exit()"

     
  • Oleg Broytman

    Oleg Broytman - 2012-12-08
    • status: open --> open-invalid
     
  • Oleg Broytman

    Oleg Broytman - 2012-12-08

    Alas, doesn't work too. SQLite:
    cur.execute('INSERT INTO test (test.name) VALUES (?)', ('text',))
    pysqlite2.dbapi2.OperationalError: near ".": syntax error

    PostgreSQL:
    cur.execute('INSERT INTO test VALUES (test.id, test.value)', (1, 'test'))
    psycopg2.ProgrammingError: invalid reference to FROM-clause entry for table "tes
    t"
    LINE 1: INSERT INTO test VALUES (test.id, test.value)
    ^
    HINT: There is an entry for table "test", but it cannot be referenced from this
    part of the query.

     
  • Oleg Broytman

    Oleg Broytman - 2013-04-28
    • status: open-invalid --> closed-rejected
    • Group: --> Unstable_(example)
     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks