Forums BaseTen

Other versions of PostgreSQL

Subscribe to Other versions of PostgreSQL 2 post(s), 2 voice(s)

 
Avatar mich 1 post

Hello,

I am pretty new to xcode, and I am trying to write a small app that can retrieve an email address from a postgres database. Seems to me the only way to go is using BaseTen.

In the requirements list (for BaseTen) it says PostgreSQL 8.2 – I have an old version running (7.4) – how would I go about writing a Cocoa app that can query it? Is there a way I can use BaseTen – or is it simply not possible?

Many thanks,

Mike

 
Avatar Tuukka Norri Administrator 11 post(s)

Hi!
Unfortunately we rely on the RETURNING clause in INSERT, UPDATE and DELETE queries, which appeared in version 8.2. Adapting our code to work with 7.4 would probably require a copious amount of work.

The aforementioned queries are needed when updating fetched objects’ caches. If you just want to fetch rows from the database, you could use these BXDatabaseContext’s methods:
- (NSArray ) executeQuery: (NSString *) queryString error: (NSError *) error;
- (unsigned long long) executeCommand: (NSString ) commandString error: (NSError *) error;
However, they do sort of throw away most of BaseTen’s functionality (notifying other clients for changes in fetched objects etc.).

There are other means to fetch rows from the database, though. You could use PostgreSQL’s libpq, although it retrieves everything as a C-string. Libpqxx is also an option, but I haven’t used it. Finally, there are also other Objective-C frameworks for using PostgreSQL. I can’t remember any by name right now but I’d guess that it’s easy to find them.

Forums BaseTen