David Hautbois <[EMAIL PROTECTED]> wrote:
   while(sqlite3_step(stmt) == SQLITE_ROW) {
       printf ("gpstracer-cfg.c - get_config_value : Getting column
content\n");
       configvalue = (char *) sqlite3_column_text(stmt, 0);
       printf ("gpstracer-cfg.c - get_config_value : content=%s\n",
configvalue);              > note this line
   }
   printf ("gpstracer-cfg.c - get_config_value : %s=%s\n",
config_name, configvalue);  >and this one
   sqlite3_finalize(stmt);

   return configvalue;
}
***************************************************************

When I call this function : get_config_value (db, "version")

I get :
SELECT config_value FROM config WHERE config_name='version'
gpstracer-cfg.c - get_config_value : Getting column content
gpstracer-cfg.c - get_config_value :
content=1                                   > ok
gpstracer-cfg.c - get_config_value : version=ftp_password
> Why the variable content changes ??

It's the exact same issue you had with sqlite3_exec. The pointer returned by sqlite3_column_text is valid only until the next call to sqlite3_step, sqlite3_reset or sqlite3_finalize on this statement handle. If you want to preserve the data beyond that, you need to allocate your own memory and copy the data over.

Igor Tandetnik

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

Reply via email to