[sqlite] Why "TRUNCATE TABLE" can't empty a table?

2012-08-14 Thread daedae11
Following is my program:
rc = sqlite3_exec(db, "TRUNCATE TABLE students;", NULL, NULL, &errMsg);

but this sentence can success and return 1.
Help~
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to recognize a sqlite database file?

2012-08-13 Thread daedae11
Thank you. And I found these functions:

const char *sqlite3_column_database_name(sqlite3_stmt*,int);
const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
const char *sqlite3_column_table_name(sqlite3_stmt*,int);
const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);

maybe it's more convenient.





At 2012-08-14 11:44:14,"Igor Tandetnik"  wrote:
>daedae11  wrote:
>> If I use the group of:
>> sqlite3_prepare16_v2()
>> sqlite3_step()
>> andsqlite3_finalize()
>> 
>> how can I get the names of a table's columns from a SELECT sql sentence?
>
>sqlite3_column_name[16]
>
>-- 
>Igor Tandetnik
>
>___
>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


Re: [sqlite] How to recognize a sqlite database file?

2012-08-13 Thread daedae11
If I use the group of:
sqlite3_prepare16_v2()
sqlite3_step()
andsqlite3_finalize()

how can I get the names of a table's columns from a SELECT sql sentence?




At 2012-08-14 10:11:31,"Simon Slavin"  wrote:
>
>On 14 Aug 2012, at 3:05am, daedae11  wrote:
>
>> Thank you. I got it. And I have another question. Does function sqlite3_exec 
>> support UTF-16?
>
>No.  sqlite3_exec() is a wrapper around sqlite3_prepare_v2(), and 
>sqlite3_prepare_v2() expects UTF-8.  For UTF-16 you should be using 
>sqlite3_prepare16_v2() .  But for some reason there's no sqlite3_exec16() .
>
>However, _exec is relatively simple to write.  You can see what it does here:
>
><http://sqlite.org/c3ref/exec.html>
>
>So all you should need to do is
>
>sqlite3_prepare16_v2()
>sqlite3_step()
>andsqlite3_finalize()
>
>Good luck with it.
>
>Simon.
>___
>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


Re: [sqlite] How to recognize a sqlite database file?

2012-08-13 Thread daedae11
Thank you. I got it. And I have another question. Does function sqlite3_exec 
support UTF-16?





At 2012-08-14 10:01:13,"Simon Slavin"  wrote:
>
>On 14 Aug 2012, at 2:57am, daedae11  wrote:
>
>> How can I judge whether a file is a database file? Is there a function that 
>> I can use for this purpose?
>
>You can use the SQLite library call to open it and see whether you get an 
>error back.  But it might be better to open the file as binary/text and read 
>the beginning of it.  All SQLite files begin with
>
>SQLite format 3
>
>and then a 0x00 character.  Of course, there's nothing to stop someone writing 
>such a file themself but it would have to be a joke.  See
>
><http://www.sqlite.org/fileformat.html>
>
>Simon.
>___
>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


[sqlite] How to recognize a sqlite database file?

2012-08-13 Thread daedae11
How can I judge whether a file is a database file? Is there a function that I 
can use for this purpose?
Help! 
Hope for you  reply.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users