Actually, the question is: how to connect to a PostgreSQL 9.2 database using s / s ++ in the Xcode environment (osx 10.8.2)?

upd. The situation is as follows. There is a code working under Linux, here’s a piece that connects:

#include <stdio.h> #include <string.h> EXEC SQL include sqlca; EXEC SQL BEGIN DECLARE SECTION; char ConnectionString [] = "login@192.168.1.1:5432"; char Login [] = "login"; char Password [] = "password"; EXEC SQL END DECLARE SECTION; EXEC SQL BEGIN DECLARE SECTION; int my_id; char my_data[256]; int my_count; char date1[10]; char date2[10]; EXEC SQL END DECLARE SECTION; EXEC SQL WHENEVER SQLERROR SQLPRINT; int main() { EXEC SQL CONNECT TO :ConnectionString USER :Login using :Password; if( sqlca.sqlcode != 0 || strncmp(sqlca.sqlstate,"00",2)) { printf("connect -- NoOK\n"); exit(-1); } else { printf("connect --OK\n"); menu(); } exec sql disconnect; printf("disconnect --OK\n"); } 

This code is highly desirable to transfer to the Mac and run in XCode. In principle, this code is not necessarily exactly; it is enough to implement similar functionality, but there is one key problem - Xcode does not recognize any SQL inserts (that is, everything that starts with EXEC). How to implement support for these inserts in this environment?

  • And you watched in Google? The first link: stackoverflow.com/a/1138516/276994 - VladD
  • Thanks, of course, for an early reaction, but doesn’t it seem strange to you that the question is asked on a resource, where they share experience , and not links in Google? Do you have experience connecting to postgres in an xcode environment? If yes - well-received answers, always welcome; if not - go through, do not delay. - Gerych
  • And I, naive, thought that here they simply answer questions. - Alexey Lobanov
  • So far no answer to the question has been given. - Gerych

0