Hi Igor,
Previous email you mentioned :
>  SQLite won't read the file for you, you will have to do it yourself (and
>  probably strip all dot commands from it before passign the contents to
>  sqlite3_exec).

>  Alternatively, just shell out to sqlite3 utility with an appropriate
>  command line.
>

What do you meant by "probably strip all dot commands from it before passign 
the contents to
>  sqlite3_exec)."
Thanks,
JP




----- Original Message ----
From: Joanne Pham <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]; General Discussion of SQLite Database 
<sqlite-users@sqlite.org>
Sent: Wednesday, April 23, 2008 5:02:17 PM
Subject: Re: [sqlite] sqlite3_exec return an error message

Thanks to both of you!
Sorry I am new baby to sqlite3.
Now I got it.
So I should use the shell script to execute these commands.

Thanks,
Joanne



----- Original Message ----
From: P Kishor <[EMAIL PROTECTED]>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Wednesday, April 23, 2008 4:55:30 PM
Subject: Re: [sqlite] sqlite3_exec return an error message

On 4/23/08, Joanne Pham <[EMAIL PROTECTED]> wrote:
> Thanks a lot Igor!
>  But the codes below didn't work too:
>  char stmt[STMT_LEN];
>  char *sqlStmt = &stmt[0];
>  strcpy(&stmt[0],"output compressTable; mode csv;  select * from 
> compressTable;  ");
>
>  sqlSt= sqlite3_exec(pDb,sqlStmt , NULL, 0, &errMsg);
>  if (sqlSt != SQLITE_OK ) {
>            WXLOGE(LOG_SYSLOG_ON, WX_MODULE_ID_MGMT, 
> WX_SUBMOD_ID_MGMT_MONREPORT,
>            "%s: - Error = %s - ",__FUNCTION__, errMsg);
>            sqlite3_free(errMsg);
>            bRet= false;
>  }
>
>  So how to set the output and mode before executing the select statement.
>  Thanks a ton,

Think of what you are doing, and read what Igor is trying to tell you.
You are mixing two technologies... but are limited by their individual
limitations -- the SQLite shell that implements the dot commands and
the SQL C API that works with the sqlite library.

Try to do all your output compress csv dance in C, or use a more
flexible development environment (Perl, Python, Tcl, whatever) to
accomplish the entire task.


>
> JP
>
>
>
>  ----- Original Message ----
>  From: Igor Tandetnik <[EMAIL PROTECTED]>
>  To: sqlite-users@sqlite.org
>  Sent: Wednesday, April 23, 2008 4:03:20 PM
>  Subject: Re: [sqlite] sqlite3_exec return an error message
>
>  Joanne Pham <[EMAIL PROTECTED]> wrote:
>  > I have the following codes to execute the sql file but the error
>  > message return back that dot(.).
>  > It seems like sqlite3_exec didn't like ".output wanPerfTableTest".
>  > So how go to get arround with this command ".output wanPerfTableTest"
>  >
>  > strcpy(&stmt[0],".read /tmp/dump_WAN.sql");
>  > if (bIsConnected) {
>  >  sqlSt= sqlite3_exec(pDb,stmt , NULL, 0, &errMsg);
>  >      if (sqlSt != SQLITE_OK ) {
>  >          ...................
>  >      }
>  > }
>
>  Dot commands (.output and, for that matter, .read) are interpreted by
>  sqlite3 command line utility - not by SQLite engine. They are not valid
>  SQL statements. sqlite3_exec complains about .read already, it never
>  actually reads the file (so the presence of .output in the file is
>  irrelevant).
>
>  SQLite won't read the file for you, you will have to do it yourself (and
>  probably strip all dot commands from it before passign the contents to
>  sqlite3_exec).
>
>  Alternatively, just shell out to sqlite3 utility with an appropriate
>  command line.
>
>  Igor Tandetnik
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to