Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 2 > Newsgroup comp.lang.objective-c

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2010, 06:14 AM
Jim
Guest
 
Posts: n/a
Default File structure question

(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
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 12-15-2010, 11:17 AM
Mark Bestley
Guest
 
Posts: n/a
Default Re: File structure question

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
Reply With Quote
  #3 (permalink)  
Old 12-15-2010, 11:21 AM
Jim
Guest
 
Posts: n/a
Default Re: File structure question

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
Reply With Quote
  #4 (permalink)  
Old 12-15-2010, 11:27 AM
Pascal J. Bourguignon
Guest
 
Posts: n/a
Default Re: File structure question

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 {}.
Reply With Quote
  #5 (permalink)  
Old 12-15-2010, 12:49 PM
Jim
Guest
 
Posts: n/a
Default Re: File structure question

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
Reply With Quote
  #6 (permalink)  
Old 12-15-2010, 03:51 PM
Tom Harrington
Guest
 
Posts: n/a
Default Re: File structure question

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/
Reply With Quote
  #7 (permalink)  
Old 12-15-2010, 03:53 PM
Jim
Guest
 
Posts: n/a
Default Re: File structure question

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
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 06:19 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.