Re: [sqlite] C++ programming - inserting data in a table

2012-06-24 Thread Simon Slavin

On 25 Jun 2012, at 5:16am, Arbol One  wrote:

> Thanks for the prompt response.
> Here is the same problem when using INSERT.

Read Igor's post again.  The only SQL commands which produce output are SELECT 
and (sometimes) PRAGMA.  Commands which make changes to your database, like 
CREATE TABLE and INSERT simply produce an integer result code which indicate 
whether they executed without error (SQLITE_OK) or had a problem of some kind 
(any other value).

If you want to read values which is in your database you must use a SELECT 
statement.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] C++ programming - inserting data in a table

2012-06-24 Thread Igor Tandetnik
Arbol One  wrote:
> Thanks for the prompt response.
> Here is the same problem when using INSERT.

Which part of "INSERT ... statement [doesn't] produce a resultset; thus, 
sqlite3_column_* functions couldn't be used with [it]" do you have difficulty 
understanding?
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] C++ programming - inserting data in a table

2012-06-24 Thread Arbol One
Thanks for the prompt response.
Here is the same problem when using INSERT.
Setter() {
dbdata = "INSERT INTO friend VALUES('Caramba', '490 New Bridge', '49')";
rc = sqlite3_prepare_v2(
 db,
 dbdata.c_str() ,
 dbdata.length(),
 &stmt,
 NULL
 );
.
rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) {
..
}
/// the output here is 5, meaning SQLITE_NULL. The output should be 3 =
SQLITE3_TEXT
std::cout << sqlite3_column_type(stmt,0);
sqlite3_finalize(stmt);
}

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 12:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - creating a table

Arbol One  wrote:
>create_table = "CREATE TABLE friend (name TEXT, address TEXT, age
INT)";
> 
>std::cout << sqlite3_column_type(stmt,0) << std::endl;

sqlite_column_* functions are only meaningful for queries that produce a
resultset - namely, SELECT and certain PRAGMAs. None of the data definition
statements (of which CREATE TABLE is one), nor INSERT, UPDATE or DELETE
statements, produce a resultset; thus, sqlite3_column_* functions couldn't
be used with them.

What are you trying to achieve here? What's the supposed purpose of
sqlite3_column_type call?
-- 
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