Re: [sqlite] two tables question
On 4/9/2012 9:12 PM, YAN HONG YE wrote: update dzhhq set dzhhq.mlevel= update dzhhq set mlevel=... case dzhhq.stkname=myref.stkname when 1 then 88 else 0 end; What's myref? Which row of which table is myref.stkname supposed to come from? You might be looking for something like this: update dzhhq set mlevel = case when stkname in (select stkname from myref) then 88 else 0 end; -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] two tables question
update dzhhq set dzhhq.mlevel= case dzhhq.stkname=myref.stkname when 1 then 88 else 0 end; show error: Query Error: near ".": syntax error Unable to execute statement ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] case where sqlite3_prepare_v2 returns OK and sets stmt to NULL
You want your assert to be this: assert(stmt != NULL); Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Rafael Ávila de Espíndola [respind...@mozilla.com] Sent: Monday, April 09, 2012 9:06 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] case where sqlite3_prepare_v2 returns OK and sets stmt to NULL Is it expected that the following program should run without asserting? --- #include #include #include int main() { sqlite3 *db = NULL; int rc; rc = sqlite3_open("test.db", ); assert(rc == SQLITE_OK); assert(db); sqlite3_stmt *stmt = NULL; rc = sqlite3_prepare_v2(db, "/* foobar", -1, , NULL); assert(rc == SQLITE_OK); assert(stmt == NULL); return 0; } --- I was expecting sqlite3_prepare_v2 to return an error code since the comment is not terminated. Even if it was, the documentation is only clear that a string with no SQL produces a NULL stmt, not what the return code is in that situation. Cheers, Rafael ___ 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] case where sqlite3_prepare_v2 returns OK and sets stmt to NULL
Is it expected that the following program should run without asserting? --- #include #include #include int main() { sqlite3 *db = NULL; int rc; rc = sqlite3_open("test.db", ); assert(rc == SQLITE_OK); assert(db); sqlite3_stmt *stmt = NULL; rc = sqlite3_prepare_v2(db, "/* foobar", -1, , NULL); assert(rc == SQLITE_OK); assert(stmt == NULL); return 0; } --- I was expecting sqlite3_prepare_v2 to return an error code since the comment is not terminated. Even if it was, the documentation is only clear that a string with no SQL produces a NULL stmt, not what the return code is in that situation. Cheers, Rafael ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] undefined symbol: sqlite3_stricmp
As I find is missed sqlite3_stricmp reference in file loadext.c -- Best regards, Alexey Pechnikov. http://pechnikov.tel/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] how to update value of string
On Apr 9, 2012, at 10:49 AM, Petite Abeille wrote: > > On Apr 9, 2012, at 10:43 AM, YAN HONG YE wrote: > >> my sqlite database "db" have a column remarks text default "2012", I want to >> add string "high" to the string of remark as "2012high" when the score >80 >> >> and add string "middle" to the string of remark as "2012middle" when the >> score>60 and score <80 >> >> update the db.remarks value strcat(remark,"high") where db.score>80 > > update foo > set remark = >case > when score > 80 then remark || 'high' > when score between 60 and 80 then remark || 'middle' > else remark >end Optionally, add 'where score >= 60' to limit the scope of the update ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] how to update value of string
On Apr 9, 2012, at 10:43 AM, YAN HONG YE wrote: > my sqlite database "db" have a column remarks text default "2012", I want to > add string "high" to the string of remark as "2012high" when the score >80 > > and add string "middle" to the string of remark as "2012middle" when the > score>60 and score <80 > > update the db.remarks value strcat(remark,"high") where db.score>80 update foo set remark = case when score > 80 then remark || 'high' when score between 60 and 80 then remark || 'middle' else remark end ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] how to update value of string
my sqlite database "db" have a column remarks text default "2012", I want to add string "high" to the string of remark as "2012high" when the score >80 and add string "middle" to the string of remark as "2012middle" when the score>60 and score <80 update the db.remarks value strcat(remark,"high") where db.score>80 how to do this? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users