Like Tree4Likes
  • 4 Post By phantomotap

SQLITE3, GtkTreeView and C problem !

This is a discussion on SQLITE3, GtkTreeView and C problem ! within the C Programming forums, part of the General Programming Boards category; Hello friends, The below given code is not appending values to the treeview. Please help: Code: void populate_list() { GtkTreeIter ...

  1. #1
    Registered User Ravi Raj's Avatar
    Join Date
    May 2012
    Location
    INDIA
    Posts
    43

    SQLITE3, GtkTreeView and C problem !

    Hello friends,

    The below given code is not appending values to the treeview. Please help:

    Code:
    void
    populate_list()
    {
        GtkTreeIter iter;
        
        ledger_store = gtk_list_store_new (9, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
        
        exec_sql ("select * from ledgers", 10000);
        
        while (sqlite3_step (Database.result) == SQLITE_ROW)
        {
            gtk_list_store_append (ledger_store, &iter);
            gtk_list_store_set (ledger_store, &iter,
                COL_DEMANDNO, sqlite3_column_text (Database.result, 0),
                COL_CENSUSNO, sqlite3_column_text (Database.result, 1),
                COL_YEAR, sqlite3_column_text (Database.result, 2),
                COL_NAME, sqlite3_column_text (Database.result, 3),
                COL_CASTE, sqlite3_column_text (Database.result, 4),
                COL_ADDRESS, sqlite3_column_text (Database.result, 5),
                COL_MOBILENO, sqlite3_column_text (Database.result, 6),
                COL_STREET, sqlite3_column_text (Database.result, 7),
                -1);
        }
        sqlite3_finalize (Database.result);
    }
    One more thing how can I modify this code so that it can accept large amount of data like 30000+ entries.
    Last edited by Ravi Raj; 06-01-2012 at 03:54 PM.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,405
    One more thing how can I modify this code so that it can accept large amount of data like 30000+ entries.
    Don't.

    I can't help you with your problem. (*) I can tell you not to try that. There is no reason. The "SQLite" database engine is nicely fast. The "GTK" interface engine is very nice. If you try to buffer too much you can interfere with the expectations these tools make to get that performance. Load a measure of the tables a bit at a time while noting the position so that you may load a bit more when called upon.

    Soma

    (*)

    I can. I'm just not going to do that.

    You've posted a lot lately with similar problems related to this same code base. You are relying on this community too much.

    We aren't here to do your job for you. We are here to help you learn programming. Reading documentation and learning to apply the rules of the interface to your code so that you can solve a problem is part of programming.

    Stop relying on us to tell you how to do every step! Start simple! Read the documentation! Debug!

  3. #3
    Registered User Ravi Raj's Avatar
    Join Date
    May 2012
    Location
    INDIA
    Posts
    43
    Ok, I got some empty rows to be inserted with this code:
    Code:
    void populate_list()
    {
    GtkTreeIter iter;
    ledger_store = gtk_list_store_new (9, G_TYPE_STRING, G_TYPE_STRING,         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
    exec_sql ("select * from ledgers", 10000);
    while (sqlite3_step (Database.result) == SQLITE_ROW)
    {
    gtk_list_store_append (ledger_store, &iter);
    gtk_list_store_set (ledger_store, &iter,
    COL_DEMANDNO, sqlite3_column_text (Database.result, 0),
    COL_CENSUSNO, sqlite3_column_text (Database.result, 1),
    COL_YEAR, sqlite3_column_text (Database.result, 2),
    COL_NAME, sqlite3_column_text (Database.result, 3),
    COL_CASTE, sqlite3_column_text (Database.result, 4),
    COL_ADDRESS, sqlite3_column_text (Database.result, 5),
    COL_MOBILENO, sqlite3_column_text (Database.result, 6),
    COL_STREET, sqlite3_column_text (Database.result, 7),
    COL_WARDNO, sqlite3_column_text (Database.result, 8),
    -1);
    gtk_tree_view_set_model (ledger_view, GTK_TREE_MODEL (ledger_store));
    sqlite3_finalize (Database.result); }
    I still don't know where I am wrong...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ & Sqlite3
    By Sparrowhawk in forum Windows Programming
    Replies: 2
    Last Post: 03-11-2009, 02:33 PM
  2. strcmp problem, whats the problem, i cant figure it out!
    By AvaGodess in forum C Programming
    Replies: 14
    Last Post: 10-18-2008, 07:45 PM
  3. Replies: 4
    Last Post: 10-16-2008, 08:30 PM
  4. sturct/pointer problem, and fscanf problem
    By hiphop4reel in forum C Programming
    Replies: 6
    Last Post: 07-28-2008, 10:40 AM
  5. syntax linked list problem & struct problem
    By beely in forum C Programming
    Replies: 5
    Last Post: 11-11-2002, 09:14 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21