Using SQLite version 3.7.8 amalgamation, under Win7 with MinGW, I compile
the bellow program, but for some strange reason I am getting a runtime error
when creating the table. I hope that one of you would be able to tell me
what I am doing wrong.

 

TIA

===

class mySQLite3Class {

private:

    //SQLite3

    sqlite3* db; //SQLite3

    Glib::ustring dbName; // Database name

    Glib::ustring apstr; // All Purpose String

 

    Glib::ustring sql_param_tblName; // Databese table Name parameters

    Glib::ustring stmtName;          // SQL statement name

public:

    void createDB();

    void create_tblName();

    mySQLite3Class(const Glib::ustring& s){ createDatabase(s);}

};

void mySQLite3Class::createDatabase(const Glib::ustring& s) {

    rc = sqlite3_open_v2(s.c_str(),

                         &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,

                         NULL);

    if(rc != SQLITE_OK) {

        std::cout << rc << std::endl;

    }

}

void mySQLite3Class::createTable(const Glib::ustring& s){

     rc = sqlite3_prepare_v2(db, s.c_str(), s.length(), &stmt, NULL );

    if(rc != SQLITE_OK) {

       std::cout << rc << std::endl;// error = 1

       std::cout << sqlite3_errmsg(db) 

                       << std::endl; // er-msg = library routine called out
of sequence

    }

    rc = sqlite3_step(stmt);

    if(rc != SQLITE_DONE) {

        std::cout << rc << stdl;

    }

    sqlite3_finalize(stmt);

}

myClass{

private:

mySQLite3Class* myDB;

Glib::ustring sql_param_tblName;

Glib::ustring dbName;

public:

myClass();

}

myClass::myClass(){

    dbName = "001Database.sql";

    sql_param_tblName = "CREATE TABLE name(n_id INTEGER PRIMARY KEY, title
TEXT, fname TEXT, mname TEXT, lname TEXT)";

    myDB = new mySQLite3Class(dbName);

    myDB->createTable(sql_param_tblName); ==> // problem

}

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

Reply via email to