Hi gwenn,
Maybe you are talking about something I don't understand, or I don't understand 
what you are
talking about...

I would like somebody tells if I'm wrong or right,
first in your email you have both :

> >>rc = sqlite3_prepare_v2(db, "SELECT * FROM test", -1, &stmt, NULL);
> >>...
> >>...
> >>rc = sqlite3_exec(db, "ALTER TABLE test ADD COLUMN data DEFAULT

I do not understand why you are doing that...

when you do :

>>cc = sqlite3_column_count(stmt);
in the documentation (https://www.sqlite.org/c3ref/column_count.html): 

  Return the number of columns in the result set returned by the prepared 
statement. This routine
  returns 0 if pStmt is an SQL statement that does not return data

so for me you have at least to do this :

  int i = sqlite3_step( stmt );

then calling `sqlite3_column_count()`

BUT you'll get something not null only if there is a result. Usually, what I'm 
doing when I call
`sqlite3_prepare()` is directly having a loop who inspects the statements :

  int i;

  while ( i!=SQLITE_DONE )
  {
    i = sqlite3_step( stmt );

    switch( i )
    {

      case SQLITE_DONE:
      {
       ...
      }
      case SQLITE_ROW:
      {
        // here I guess you have to call `qlite3_column_count()`
      }
      case SQLITE_SCHEMA:
      {
        // here I guess the database schema has changed
      }
      ...
   }


> SQLITE_SCHEMA is returned only on failure.
I don't think this make sense. SQLITE_SCHEMA can't be a "failure" if is 
actually telling you it
succeded to change the schema...

or, it's a possibility, there is something I don't understand.


I don't know if I deleted some mail about this discussion, but more code would 
maybe helps to found
the heck...

regards,
nicolas

Reply via email to