|
|||
|
(First off let me apologise for the somewhat rambling nature of this
post) I currently do a lot of work in THEOS MultiUser BASIC. That has one type of file that I find incredibly useful - ISAM files. The format for one is: Key:value1,value2,value3,...value n You create one thusly: CREATE JIM.DATA (INDEXED KEYLEN 10 RECLEN 200 which would create an ISAM file called 'JIM.DATA' with a key length of 50 chars and a record length of 200 chars. Writing to one is simply a case of opening it and writing like this: WRITE #1,"KEY":"VALUE1","VALUE2","VALUE3" and reading from it would be a case of: READ #1,"KEY":VAR1$,VAR2$,VAR3$ (doesn't have to be strings) you can also do things like: READNEXT #1,KEY$:VAR1$,VAR2$,VAR3$ which would read the next key in the file (based on current position) I'd like to move a lot of this stuff over to an Objective-C environment (probably on a Mac, so with the Cocoa libraries) but my question is simply: is there an easy-ish way to duplicate the ISAM file behaviour using Obj-C and the Cocoa libraries? Many thanks. Jim -- "Sir Alan [...] made his fortune in the early Eighties selling computers to parents who didn't love their children enough to get them a C64." - The Daily Mash Facetime ID:jim@magrathea.plus.com |
|
|
||||
|
||||
|
|
|
|||
|
Jim <jim@magrathea.plus.com> wrote:
> (First off let me apologise for the somewhat rambling nature of this > post) > > I currently do a lot of work in THEOS MultiUser BASIC. That has one type > of file that I find incredibly useful - ISAM files. The format for one > is: > > > I'd like to move a lot of this stuff over to an Objective-C environment > (probably on a Mac, so with the Cocoa libraries) but my question is > simply: is there an easy-ish way to duplicate the ISAM file behaviour > using Obj-C and the Cocoa libraries? > There are several ISAM dbs in C. The main open source one is Berkeley DB (bsddb) <http://freshmeat.net/projects/berkeleydb/>. Googling gives an obj-C interface <http://fortytwo.sourceforge.net/> You could also use an SQL db e.g. sqllite or Core Data if you want to fully mgrate to Cocoa -- Mark |
|
|||
|
On 2010-12-15, Mark Bestley <news{@bestley.co.uk> wrote:
>> >> I'd like to move a lot of this stuff over to an Objective-C environment >> (probably on a Mac, so with the Cocoa libraries) but my question is >> simply: is there an easy-ish way to duplicate the ISAM file behaviour >> using Obj-C and the Cocoa libraries? >> > There are several ISAM dbs in C. The main open source one is Berkeley > DB (bsddb) <http://freshmeat.net/projects/berkeleydb/>. > > Googling gives an obj-C interface <http://fortytwo.sourceforge.net/> > > You could also use an SQL db e.g. sqllite or Core Data if you want to > fully mgrate to Cocoa I'll take a look at those, thanks. Jim -- Twitter:@GreyAreaUK Facetime ID:jim@magrathea.plus.com "If you have enough book space, I don't want to talk to you." Terry Pratchett |
|
|||
|
jim@magrathea.plus.com (Jim) writes:
> I'd like to move a lot of this stuff over to an Objective-C environment > (probably on a Mac, so with the Cocoa libraries) but my question is > simply: is there an easy-ish way to duplicate the ISAM file behaviour > using Obj-C and the Cocoa libraries? There are a lot of indexed, file-based database libraries out there. If you only have small databases (eg. preference files, things like that), then you just use NSDictionary and write them in whole as property files, or even as XML. If you have bigger database which would be inconvenient to load in whole, then you could use dbm which is included in darwin, or sqlite which is often used by Cocoa and iOS applications. sqlite is a database system that presents a SQL API, but without a database server: each application accesses directly the database file. Otherwise, you can just use any database library you want, such as gdbm, myisam, etc. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. |
|
|||
|
On 2010-12-15, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
> jim@magrathea.plus.com (Jim) writes: > >> I'd like to move a lot of this stuff over to an Objective-C environment >> (probably on a Mac, so with the Cocoa libraries) but my question is >> simply: is there an easy-ish way to duplicate the ISAM file behaviour >> using Obj-C and the Cocoa libraries? > > There are a lot of indexed, file-based database libraries out there. > > If you only have small databases (eg. preference files, things like > that), then you just use NSDictionary and write them in whole as > property files, or even as XML. > > If you have bigger database which would be inconvenient to load in > whole, then you could use dbm which is included in darwin, or sqlite > which is often used by Cocoa and iOS applications. sqlite is a > database system that presents a SQL API, but without a database server: > each application accesses directly the database file. That sounds ideal. Typically I'm having to process millions of records at a time. Many thanks. Jim -- Twitter:@GreyAreaUK Facetime ID:jim@magrathea.plus.com "If you have enough book space, I don't want to talk to you." Terry Pratchett |
|
|||
|
In article <slrnighhrp.2e0e.jim@wotan.magrathea.local>,
Jim <jim@magrathea.plus.com> wrote: > On 2010-12-15, Pascal J. Bourguignon <pjb@informatimago.com> wrote: > > jim@magrathea.plus.com (Jim) writes: > > > >> I'd like to move a lot of this stuff over to an Objective-C environment > >> (probably on a Mac, so with the Cocoa libraries) but my question is > >> simply: is there an easy-ish way to duplicate the ISAM file behaviour > >> using Obj-C and the Cocoa libraries? > > > > There are a lot of indexed, file-based database libraries out there. > > > > If you only have small databases (eg. preference files, things like > > that), then you just use NSDictionary and write them in whole as > > property files, or even as XML. > > > > If you have bigger database which would be inconvenient to load in > > whole, then you could use dbm which is included in darwin, or sqlite > > which is often used by Cocoa and iOS applications. sqlite is a > > database system that presents a SQL API, but without a database server: > > each application accesses directly the database file. > > That sounds ideal. Typically I'm having to process millions of records > at a time. If you're looking at SQLite, be sure to check out Core Data. It abstracts SQLite into a system that lets you read and write Objective-C objects. For most uses I find it a lot more useable than direct SQLite access. -- Tom "Tom" Harrington Independent Mac OS X developer since 2002 http://www.atomicbird.com/ |
|
|||
|
On 2010-12-15, Tom Harrington <tph@pcisys.no.spam.dammit.net> wrote:
>> > >> > If you have bigger database which would be inconvenient to load in >> > whole, then you could use dbm which is included in darwin, or sqlite >> > which is often used by Cocoa and iOS applications. sqlite is a >> > database system that presents a SQL API, but without a database server: >> > each application accesses directly the database file. >> >> That sounds ideal. Typically I'm having to process millions of records >> at a time. > > If you're looking at SQLite, be sure to check out Core Data. It > abstracts SQLite into a system that lets you read and write Objective-C > objects. For most uses I find it a lot more useable than direct SQLite > access. Will do - thanks. Jim -- Twitter:@GreyAreaUK Facetime ID:jim@magrathea.plus.com "If you have enough book space, I don't want to talk to you." Terry Pratchett |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|