Hi Igor,
You are absolutely right that its type is NULL and min(id) returns 0 as I use sqlite_column_int64 to retrieve data. However, isn't it confusing that the "sqlite3_step" returns SQLITE_ROW which usually means some dataset is returned? I mean, if it returns one NULL row, why doesn't sqlite simply return "SQLITE_DONE" or something instead of "SQLITE_ROW"? You see, as user I have to double-check its return type even after I get "SQLITE_ROW". In this sense, I think it is a bug. thank you, > To: sqlite-users@sqlite.org > From: itandet...@mvps.org > Date: Wed, 16 Dec 2009 21:00:43 -0500 > Subject: Re: [sqlite] a possible bug of select min(id) from... > > nick huang <nickhuan...@hotmail.com> wrote: > > Say a table named "url" is created with "id" as primary key. Then a > > query like this "select min(id) from url". > > > > Quite unexpectedly, the result of query returns "SQLITE_ROW" and the > > min(id) is 0. However, my table is still empty which confuses me for > > a while. > > This statement should in fact return one row, with the value of NULL. How do > you retrieve the value? If you use sqlite3_column_int, it'll convert NULL to > 0 for you. Check with sqlite3_column_type. > > Igor Tandetnik > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _________________________________________________________________ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://go.microsoft.com/?linkid=9691816 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users