you'r right, i made a mistake doing copy and paste writing original mail, the real select query contains more fields and i can ensure that 1 based indexes are correct and respected into the real code, real update query is hardcoded, no params (0 based): 2 days checking, im sure..
at least, do u know a way to load the copied writable database running into the XCode simulator, so i can understand if my problem is writing or retriving data (in this way 50% my troubles are solved)? Using Mac and windows against the same database to simulate the same query everithing works perfectly.. im really getting crazy. i know i can close my eyes and invert that commands, but i care my software and i really like to know what im doing wrong.. thx for reply, marco 2011/7/17 John Deal <bassd...@yahoo.com> > Hello, > > I am new and have received much information from this list so I hope I am > not wasting bandwidth. I don't know if it is my misunderstanding or typos > but should your sqlite3_column_int() use indexes 0,1 and 2 instead of 1, 12 > and 13? If this is the case, according to the docs on sqlite3_column_int() > "...if the column index is out of range, the result is undefined." > > I hope I did not misunderstand the issue. > > --- On Sun, 7/17/11, marco bianchini <informa...@gmail.com> wrote: > > > From: marco bianchini <informa...@gmail.com> > > Subject: [sqlite] year, month & day problem > > To: sqlite-users@sqlite.org > > Date: Sunday, July 17, 2011, 6:05 AM > > Hi all, > > call me stupid but after some days of try and a lot of > > Googleing, im still > > wondering how to solve my problem: > > i need to execute a query that updates 3 integer fields > > (AA, MM, GG) of a > > table, containing respectively today year, today month and > > today day: > > > > update settings set AA=strftime('%Y', 'now'), > > MM=strftime('%m', 'now'), > > GG=strftime('%d', 'now') > > > > looks working well, but later, when i read that values: > > <xcode> > > const char *sql="select AA,MM,GG from > > settings"; > > sqlite3_stmt *statmentS; > > if (sqlite3_prepare_v2(database, sql > > ,-1,&statmentS, NULL)==SQLITE_OK) > > { > > if > > (sqlite3_step(statmentS)==SQLITE_ROW) { > > UserSettings *k = > > [UserSettings sharedUserSettings]; > > > > k.AA=sqlite3_column_int(statmentS, 1); > > > > k.MM=sqlite3_column_int(statmentS, 12); > > > > k.GG=sqlite3_column_int(statmentS, 13); > > ... > > </xcode> > > > > i obtain correct values, but in inverse order: > > > > AA (year) contains the day number > > MM (month) is correct > > GG (day) contains the year > > > > using SQLIte Manager addons for Firefox, this query: > > select strftime('%Y', 'now'), strftime("%m", "now"), > > strftime("%d", "now") > > from settings > > returns correct values, running or loading value into XCode > > simulator looks > > not working and i dont know why. :'( > > > > > > does anyone can suggest me what to fix or check? > > thx in advance, marco > > _______________________________________________ > > 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-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users