Works.. Im really sorry for my stupid question, thanks for support and
your time, i think that i need an holyday.. Marco

Il giorno domenica 17 luglio 2011, Black, Michael (IS)
<michael.bla...@ngc.com> ha scritto:
> Column numbers are zero-based, not one-based.
>
> From http://www.sqlite.org/c3ref/column_blob.html
>
> "The leftmost column of the result set has the index 0. "
>
>
>
> That's at least part of your problem.
>
>
>
> So should be:
>
>             k.AAArticoli=sqlite3_column_int(statmentS, 0);
>             k.MMArticoli=sqlite3_column_int(statmentS, 1);
>             k.GGArticoli=sqlite3_column_int(statmentS, 2);
>
> And can't you run the command-line sqlite3 to see what's in your table?
>
>
>
>
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> NG Information Systems
>
> Advanced Analytics Directorate
>
>
>
> ________________________________
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
> behalf of marco bianchini [informa...@gmail.com]
> Sent: Sunday, July 17, 2011 7:05 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] year, month & day problem
>
> if can help, thats real code :
>
> -- to read
>
> -(void) readUpdateStatus{
>     const char *sql="select
> AAArticoli,MMArticoli,GGArticoli,AAFoto,MMFoto,GGFoto,AAClienti,MMClienti,GGClienti,AAOrdini,MMOrdini,GGOrdini,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.AAArticoli=sqlite3_column_int(statmentS, 1);
>             k.MMArticoli=sqlite3_column_int(statmentS, 2);
>             k.GGArticoli=sqlite3_column_int(statmentS, 3);
>
>             k.AAFoto=sqlite3_column_int(statmentS, 4);
>             k.MMFoto=sqlite3_column_int(statmentS, 5);
>             k.GGFoto=sqlite3_column_int(statmentS, 6);
>
>             k.AAClienti=sqlite3_column_int(statmentS, 7);
>             k.MMClienti=sqlite3_column_int(statmentS, 8);
>             k.GGClienti=sqlite3_column_int(statmentS, 9);
>
>             k.AAOrdini=sqlite3_column_int(statmentS, 10);
>             k.MMOrdini=sqlite3_column_int(statmentS, 11);
>             k.GGOrdini=sqlite3_column_int(statmentS, 12);
>
>             k.AA=sqlite3_column_int(statmentS, 13);
>             k.MM=sqlite3_column_int(statmentS, 14);
>             k.GG=sqlite3_column_int(statmentS, 15);
>
>         }
>         sqlite3_finalize(statmentS);
>     }
>     return;
> }
>
>
> -- to write
>
> -(int) ioSQL:(NSString*)sql{
>     sqlite3_stmt *statment;
>     if (sqlite3_prepare_v2(database,[sql UTF8String],-1,&statment,
> NULL)==SQLITE_OK) {
>         if (sqlite3_step(statment)==SQLITE_DONE) {
>             sqlite3_finalize(statment);
>             return 1;
>         }
>     }
>     return 0;
> }
>
> -(int) setUpdated{
>     return [self ioSQL:@"update settings set AA=strftime('%Y', 'now'),
> MM=strftime('%m', 'now'), GG=strftime('%d', 'now')"];
> }
>
> -(int) setArticoliUpdated{
>     return [self ioSQL:@"update settings set AAArticoli=strftime(\"%Y\",
> \"now\"), MMArticoli=strftime(\"%m\", \"now\"), GGArticoli=strftime(\"%d\",
> \"now\")"];
> }
> -(int) setFotoUpdated{
>     return [self ioSQL:@"update settings set AAFoto=strftime(\"%Y\",
> \"now\"), MMFoto=strftime(\"%m\", \"now\"), GGFoto=strftime(\"%d\",
> \"now\")"];
> }
> -(int) setClientiUpdated{
>     return [self ioSQL:@"update settings set AAClienti=strftime(\"%Y\",
> \"now\"), MMClienti=strftime(\"%m\", \"now\"), GGClienti=strftime(\"%d\",
> \"now\")"];
> }
> -(int) setOrdiniUpdated{
>     return [self ioSQL:@"update settings set AAOrdini=strftime(\"%Y\",
> \"now\"), MMOrdini=strftime(\"%m\", \"now\"), GGOrdini=strftime(\"%d\",
> \"now\")"];
> }
>
>
>
>
>
>
>
> 2011/7/17 marco bianchini <informa...@gmail.com>
>
>> 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
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to