Hi Simon,

On 3.4.2 built from amalgamation on XP using Visual Studio I can
follow your scenario without problems. I used command line shell and
tcl shell.

More detail will help (version etc).
Ok...let's try the next level of detail:
- We are using sqlite 3.4.0 on linux (Redhat Enterprise 3, Update 4)

Please find below a summary of actions we do on C++ and TCL side:
C++
****
- Open data base : sqlite3_open("TableName", &m_sqlite);
- Issue begin-transaction:
  std::string begin_transaction_query("BEGIN TRANSACTION;");
sqlite3_prepare(m_sqlite, begin_transaction_query.c_str(), begin_transaction_query.size(), &m_begin_transaction_stmt, NULL);
  sqlite3_step(m_begin_transaction_stmt);
  sqlite3_reset(m_begin_transaction_stmt);
- Create table:
  std::string commit_query("COMMIT;");
sqlite3_prepare(m_sqlite, commit_query.c_str(), commit_query.size(), &m_commit_stmt, NULL);
  if (have_pending_data) {
     check_step(sqlite3_step(m_commit_stmt),m_sqlite);
     check_result(sqlite3_reset(m_commit_stmt),m_sqlite);
  }

  std::string drop_table_query("DROP TABLE IF EXISTS '" + name + "';");
  sqlite3_stmt* drop_table_stmt;
sqlite3_prepare(m_sqlite, drop_table_query.c_str(), drop_table_query.size(), &drop_table_stmt, NULL);
  assert(sqlite3_step(drop_table_stmt) == SQLITE_DONE);
  sqlite3_finalize(drop_table_stmt);

  // Drop index
std::string drop_index_query("DROP INDEX IF EXISTS '" + name + "_index';");
  sqlite3_stmt* drop_index_stmt;
sqlite3_prepare(m_sqlite, drop_index_query.c_str(), drop_index_query.size(), &drop_index_stmt, NULL);
  assert(sqlite3_step(drop_index_stmt) == SQLITE_DONE);
  sqlite3_finalize(drop_index_stmt);

  // Create table
std::string create_table_query("CREATE TABLE '" + name + "' (" + schema + ")");
  sqlite3_stmt* create_table_stmt;
sqlite3_prepare(m_sqlite, create_table_query.c_str(), create_table_query.size(), &create_table_stmt, NULL);
  assert(sqlite3_step(create_table_stmt) == SQLITE_DONE);
  sqlite3_finalize(create_table_stmt);

- Insert data:
  while (fill_with_data) {
     sqlite3_stmt* stmt = getInsertQuery(2);
     sqlite3_bind_int64(stmt, 1, a);
     sqlite3_bind_text(stmt, 2, b.c_str(), b.size(), SQLITE_TRANSIENT);
     assert(sqlite3_step(stmt) == SQLITE_DONE);
     sqlite3_reset(stmt);
     if (should_synchronize) {
        assert(sqlite3_step(m_commit_stmt) == SQLITE_DONE);
        sqlite3_reset(m_commit_stmt);
        assert(sqlite3_step(m_begin_transaction_stmt) == SQLITE_DONE);
        sqlite3_reset(m_begin_transaction_stmt);
  }

- Flush data to file:
  // for flushing the data to a file we do a commit
  std::string commit_query("COMMIT;");
sqlite3_prepare(m_sqlite, commit_query.c_str(), commit_query.size(), &m_commit_stmt, NULL);
  check_step(sqlite3_step(m_commit_stmt),m_sqlite);
  sqlite3_reset(m_commit_stmt);


TCL
****
- Create index from within TCL
  # now we create an index from within a tcl script
  # Open data base from within tcl
  sqlite3 my_db "my_data_base.db"
  # Make index
my_db eval { CREATE INDEX IF NOT EXISTS memory_access_pc ON 'memory access monitor'(pc) }
  # We never explicitely close this db from within tcl

When now inserting data from within the C++ world, it exits with the SQLITE_ERROR as mentioned earlier.

I hope this level of detailed was not too fine grain.
Thanks for your help in advance,
Frank.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to