Hi

How do I catch a error raised by a trigger from a programming language
like  C++ or freepascal?

Do we have a call back to do the same?

regards

Nataraj




On Thu, Oct 29, 2009 at 8:36 PM, TTTTT <erlichk...@gmail.com> wrote:
>
> hello everyone !
>
> I`m trying to use sqlite database with c++, but something isnt working
> right...
>
> The problem I`m dealing here is that i cant insert other datas into the
> table i`ve created except NULL, because i get following error message:
>
> Error in select statement : INSERT INTO a (a,b,c,d) VALUES (NULL, NULL,
> something_else, NULL) [no such column: something_else].
>
>
> when i write :
>
> insert(4, aa, "NULL", "NULL", "NULL");
>
> then NULL "values" are inserted
>
> I guess i`ve made some mistake with using pointers, but i dont see it.. I`m
> not very experienced programmer..
>
> here is the main function:
>
>
>
> int main ()
> {
>
> char data_base_name [20];
> char *db_name;
> db_name = data_base_name;
>
> char tab_name [20];
> table_name=tab_name;
>
> open_db ("db_name");
>
> cout<<"Insert table name:"<<endl;
> cin>>tab_name;
>
> char a[10]="a";
> char aa[100]="NULL";
>
> select_stmt ("DROP TABLE a");
>
> create_table (4, a, "b", "c", "d");
>
> insert(4, aa, "NULL", "something_else", "NULL");
>
> sqlite3_close(db);
>
> getchar ();
>
> return 0;
> }
>
>
>
>
>
>
> function create_table is working ok, if i`m not wrong..
> here it is:
>
>
>
>
> int create_table (int no_col, char *fmt, ...)
>
> {
> int i;
> char f[500] = "CREATE TABLE ";
>
> va_list ptr;
> va_start (ptr, fmt);
>        for (i=0; i<(no_col-1); i++)
>        {
>        strcat (fmt, ",");            // fmt = a ,b ,c ,d
>        strcat(fmt, (va_arg (ptr, char*)));
>        }
> va_end (ptr);
>
> fmt1 = fmt;   //fmt1- global pointer
>
> strcat (f, table_name);   // "CREATE TABLE x
> strcat (f, " (");         // "CREATE TABLE x "(
> strcat (f, fmt);          // "CREATE TABLE x ( a,b,c,d
> strcat (f,")");           // "CREATE TABLE x (a,b,c,d)"
>
> char * stmt = f  ;
> printf ("\nstmt = %s\n", stmt);
> select_stmt (stmt);
>
> return 0;
> }
>
>
>
>
>
>
> insert function:
>
>
>
>
> int insert (int no_col, char *fmt2, ... )
> {
> int i;
> va_list ap;
> va_start (ap, fmt2);
>
> for (i=0; i<(no_col-1); i++)
> {
>        strcat (fmt2, ",");
>        strcat (fmt2, (va_arg(ap, char*)));
> }
> va_end (ap);
>
> char k[500]= "INSERT INTO ";
> strcat (k, table_name );
> strcat (k, " ( ");
> strcat (k,  fmt1);
> strcat (k, ") ");
> strcat (k, "VALUES (");
> strcat (k, fmt2);
> strcat (k, ")");
> printf ("\nk = %s\n\n", k);
>
> char * stmt = k;
> select_stmt (stmt);
>
> return 0;
> }
>
>
>
>
>
>
>
> any help and auggestions very appreciated..
>
> T
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/problem-with-inserting-non-NULL-values-into-sqlite-table-tp26114852p26114852.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to