Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libpq prepared statement



I am trying to get a libpq prepared statement to compile (not actually work) in my app. I am having difficulty finding an example of one on the internet somewhere. I don't really understand the documentation ( http://www.postgresql.org/docs/8.1/static/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO ) to well, but I thought I would try it before asking.

Here is what I have (it is probably nowhere close)

NSString *theUUID = @"test"; //this works
PGconn *conn = PQconnectdb(conninfo); // this works

PQprepare *statement = PQPrepare(theConnection, "stmtname", "SELECT * FROM admin WHERE id = %s", 1, [theUUID]);

I get two errors here
1) 'statement' undeclared (first use in this function)
2) syntax error before ']' token

The documentation says that this will be used with the PQexecPrepared, but I don't understand how.

If you have an example I could look at that would be great.

Thank you,

Justin Giboney

p.s. why is it that Apple has no documentation on having Cocoa work with Databases? Try typing in "mysql" or "postgresql" in the search box of this page http://developer.apple.com/cocoa/ while restricting it to cocoa. Do they not want business to use Cocoa?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.