• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Need help with SQLite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with SQLite


  • Subject: Re: Need help with SQLite
  • From: Reimar Metzen <email@hidden>
  • Date: Mon, 26 Jan 2004 23:57:37 +0100

hmm, try

NSMutableArray *array = [[NSMutableArray alloc] init];

rowIterator = [result rowEnumerator];
while( row = [rowIterator nextObject]) {
[array addObject: row];
}

know you can get every colum of a row with [row stringForColumAtIndex:
i]

i dont know if this is what you want (i dont know how to create a 2d
array with, perhaps this way?!?

NSMutableArray *array = [[NSMutableArray alloc] init];

rowIterator = [result rowEnumerator];
while( row = [rowIterator nextObject]) {
NSMutableArray *arrayTwo = [[NSMutableArray alloc] init];

[arrayTwo addObject: [row stringForColumnAtIndex: 0]];
[arrayTwo addObject: [row stringForColumnAtIndex: 1]];
[arrayTwo addObject: [row stringForColumnAtIndex: 2]];
[arrayTwo addObject: [row stringForColumnAtIndex: 3]];

[array addObject: arrayTwo];
[arrayTwo release];
}

quick and dirty


Reimar

Am 26.01.2004 um 22:57 schrieb Sascha Kuehn:

> but i don't want a string, i need a 2d array.
> thanks any way.
>
> sascha
>
> On 26. Jan 2004, at 22:53 Uhr, Reimar Metzen wrote:
>
>> Hi,
>>
>> i think you have to use performQuery: query - performQueryWithFormat
>> is only if you want to replace a formatstring in the string query
>> with some values, like
>>
>> [bla performQueryWithFormat: @"time: %@", time]
>>
>> Reimar
>>
>> Am 26.01.2004 um 22:21 schrieb Sascha Kuehn:
>>
>>> hi,
>>>
>>> i have a problem sqlite.
>>>
>>> here is a code snippet:
>>>
>>>
>>> ---------------------------------------------------------------------
>>> ---
>>> ------
>>> +(NSArray*)SQLquery:(NSString*)query
>>> {
>>> SQLDatabase* database;
>>> SQLResult* result;
>>> SQLRow* row;
>>> NSEnumerator* rowIterator;
>>>
>>> database = [SQLDatabase databaseWithFile:@"test.db"];
>>> [database open];
>>> result = [database performQueryWithFormat:query];
>>> ---------------------------------------------------------------------
>>> ---
>>> ------
>>>
>>>
>>> i need the 'result' as an 2D array. but i down know how to.
>>> i hope you can help me out.
>>>
>>> sascha
>>> _______________________________________________
>>> cocoa-dev mailing list | email@hidden
>>> Help/Unsubscribe/Archives:
>>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>>> Do not post admin requests to the list. They will be ignored.
>>>
>>>
>>
>> <upload_73374.jpg>
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.

[demime 0.98b removed an attachment of type image/jpeg which had a name of upload_63601.jpg]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Need help with SQLite (From: Sascha Kuehn <email@hidden>)
 >Re: Need help with SQLite (From: Reimar Metzen <email@hidden>)
 >Re: Need help with SQLite (From: Sascha Kuehn <email@hidden>)

  • Prev by Date: Re: LDAP using cocoa
  • Next by Date: OT: Accents etc on Coco dev
  • Previous by thread: Re: Need help with SQLite
  • Next by thread: Re: setting menuitem state...
  • Index(es):
    • Date
    • Thread