Re: [sqlite] Selecting NULL

2012-07-11 Thread Igor Tandetnik

On 7/11/2012 2:00 PM, deltagam...@gmx.net wrote:

If mydetails contains a value, and I delete this value with "SQLite
Database Browser"
it seems not to be a "real NULL", has someone an explanation for this
behaviour ?


The tool probably sets the field to an empty string, which is not the 
same as null.

--
Igor Tandetnik

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


Re: [sqlite] Selecting NULL

2012-07-11 Thread Pavel Ivanov
On Wed, Jul 11, 2012 at 2:00 PM, deltagam...@gmx.net
 wrote:
> If mydetails contains a value, and I delete this value with "SQLite Database
> Browser"
> it seems not to be a "real NULL", has someone an explanation for this
> behaviour ?

It depends on your meaning of word "delete". But maybe when you clear
the value in SQLite Database Browser it writes empty string?

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


Re: [sqlite] Selecting NULL

2012-07-11 Thread deltagam...@gmx.net

Am 11.07.2012 19:45, schrieb Pavel Ivanov:

 // here maybe NULL is returned ?
 mydetails = (char*)sqlite3_column_text(stmt, 0 );

Check sqlite3_column_type() before calling sqlite3_column_text(). If
it returns SQLITE_NULL then you have NULL.

Pavel


On Wed, Jul 11, 2012 at 1:40 PM, deltagam...@gmx.net
 wrote:

Hello,

how to process if the select-statement selects a column with NULL  ?


==
char *mydetails;
char *sql;
sqlite3_stmt *stmt;
sqlite3 *db;
const char dbname[] = "mysqlite.db";


sql = "Select mydetails from mytable";

rc = sqlite3_prepare(db, sql, strlen(sql), , NULL);

rc = sqlite3_step(stmt);


while(rc == SQLITE_ROW) {

 // here maybe NULL is returned ?
 mydetails = (char*)sqlite3_column_text(stmt, 0 );
 rc = sqlite3_step(stmt);
}
===
___
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


Pavel, thanks a lot.


If mydetails contains a value, and I delete this value with "SQLite 
Database Browser"
it seems not to be a "real NULL", has someone an explanation for this 
behaviour ?



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


Re: [sqlite] Selecting NULL

2012-07-11 Thread Pavel Ivanov
> // here maybe NULL is returned ?
> mydetails = (char*)sqlite3_column_text(stmt, 0 );

Check sqlite3_column_type() before calling sqlite3_column_text(). If
it returns SQLITE_NULL then you have NULL.

Pavel


On Wed, Jul 11, 2012 at 1:40 PM, deltagam...@gmx.net
 wrote:
> Hello,
>
> how to process if the select-statement selects a column with NULL  ?
>
>
> ==
> char *mydetails;
> char *sql;
> sqlite3_stmt *stmt;
> sqlite3 *db;
> const char dbname[] = "mysqlite.db";
>
>
> sql = "Select mydetails from mytable";
>
> rc = sqlite3_prepare(db, sql, strlen(sql), , NULL);
>
> rc = sqlite3_step(stmt);
>
>
> while(rc == SQLITE_ROW) {
>
> // here maybe NULL is returned ?
> mydetails = (char*)sqlite3_column_text(stmt, 0 );
> rc = sqlite3_step(stmt);
> }
> ===
> ___
> 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