On Tue, Apr 5, 2016 at 8:00 PM, Igor Korot <ikorot01 at gmail.com> wrote:
> On Tue, Apr 5, 2016 at 1:57 PM, L?szl? B?sz?rm?nyi (GCS) <gcs at debian.org> 
> wrote:
>> It seems sqlite3_column_decltype() is changed in 3.12.0 without
>> mentioning it in the changelog. A test case is attached.
> There is no attachment here.
> Can you just post the script byou use inline?
 Checked my sent mail, the attachment is there. Does the list software
delete those? Anyway, here it's inline.
-- cut --
#include <sqlite3.h>
#include <stdio.h>
#include <string.h>

int main(void) {
    sqlite3 *db;
    char *err_msg = 0;
    sqlite3_stmt *res;

    int rc = sqlite3_open("ttt", &db);

    if (rc != SQLITE_OK) {

        fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);

        return 1;
    }

    char sql[1024];


    strcpy(sql, "DROP TABLE IF EXISTS foo; CREATE TABLE foo ('value'
'json text'); INSERT INTO foo ('value') VALUES ('bar')");
   rc = sqlite3_exec(db, sql, NULL, 0, &err_msg);
   if( rc != SQLITE_OK ){
      fprintf(stderr, "Can't select: %s\n", err_msg);
      return 1;
    }


    strcpy(sql, "SELECT * FROM foo");
    rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
    if (rc != SQLITE_OK) {
        fprintf(stderr, "Failed to execute statement: %s\n",
sqlite3_errmsg(db));
        return 1;
    }

    int step = sqlite3_step(res);

    if (step == SQLITE_ROW) {
        printf("type:%s value:%s\n",
            sqlite3_column_decltype(res, 0),
            sqlite3_column_text(res, 0));
    }

    sqlite3_finalize(res);
    sqlite3_close(db);

    return 0;
}
-- cut --

Regards,
Laszlo/GCS

Reply via email to