> Le 9 janv. 2018 à 21:47, Richard Hipp <d...@sqlite.org> a écrit :
> 
> On 1/9/18, Gwendal Roué <gwendal.r...@gmail.com> wrote:
>> 1. For statements made of parameters, such as `SELECT ?, ?` or `SELECT :a,
>> :b`, the sqlite3_column_name used to return the parameter name ("?" or ":a"
>> etc.) for all parameters, the last one included. The latest version returns
>> an empty string for the last parameter.
> 
> I have not been able to reproduce this problem using the command-line
> shell.  I tried the following script:
> 
>  .header on
>  SELECT ?, ?;
>  SELECT :a, :b;
> 
> It shows me the correct column names for all columns.  Do you have a
> reproducible test case that I can work from?

I have Swift code which reliably reproduces the bug :

    var conn: OpaquePointer? = nil
    sqlite3_open_v2("", &conn, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, nil)
    var stmt: OpaquePointer? = nil
    sqlite3_prepare_v3(conn, "SELECT :a, :b", -1, 0, &stmt, nil)
    sqlite3_column_name(stmt, 0) // ":a"
    sqlite3_column_name(stmt, 1) // ""

A manual translation into C gives:

        void *conn, *stmt;
    sqlite3_open_v2("", &conn, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, 
NULL);
    sqlite3_prepare_v3(conn, "SELECT :a, :b", -1, 0, &stmt, NULL);
    sqlite3_column_name(stmt, 0); // ":a"
    sqlite3_column_name(stmt, 1); // ""

If this is a side effect of the Swift C, we have found another interesting bug, 
but not in SQLite :-)

Gwendal

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to