1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Function 'sqlite3_column_text(sqlite3_stmt*, int iCol)' confusingly treats indexes of...

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 3, 2024 às 11:13.

  1. Stack

    Stack Membro Participativo

    const char *column_buf ="SELECT * FROM pragma_table_info(?);";

    int rc;

    rc = sqlite3_prepare_v2(db, column_buf, -1, &stmt, NULL);
    if(rc == SQLITE_OK) {
    sqlite3_bind_text(stmt, 1, table, -1, SQLITE_TRANSIENT);

    while(sqlite3_step(stmt) == SQLITE_ROW) {
    const unsigned char *fCol = sqlite3_column_text(stmt, 0);
    const unsigned char *lCol = sqlite3_column_text(stmt, 1);
    }
    }


    Here, I am trying to pass a string from sqlite3_column_text to a variable inside of while loop block but index 0 does return int indexes of columns for example first_column is 0 and int 0 is being returned by sqlite3_column_text(stmt, 0) meanwhile sqlite3_column_text(stmt, 1) returns column names but it combines all results in one index. How does this function really work?

    Continue reading...

Compartilhe esta Página