libpq

ODBC v Libpq: C library for PostgreSQL

跟風遠走 提交于 2020-01-12 10:09:30
问题 I am going to be using a C library to connect and use a PostgreSQL database, I was wondering what are the pros and cons to ODBC and Libpq. From what I can tell, libpq seems to be faster but I was not able to get any clear answers or benchmarks. Also, is there any other library that might be better then ODBC/Libpq. 回答1: ODBC is useful if you want a standard adapter that speaks a similar API for different databases. I personally think it's an awful API, but it's widely understood and well

ODBC v Libpq: C library for PostgreSQL

自作多情 提交于 2020-01-12 10:06:01
问题 I am going to be using a C library to connect and use a PostgreSQL database, I was wondering what are the pros and cons to ODBC and Libpq. From what I can tell, libpq seems to be faster but I was not able to get any clear answers or benchmarks. Also, is there any other library that might be better then ODBC/Libpq. 回答1: ODBC is useful if you want a standard adapter that speaks a similar API for different databases. I personally think it's an awful API, but it's widely understood and well

libpq: How to get the error code after a failed PGconn connection

烈酒焚心 提交于 2020-01-01 15:09:16
问题 Given the following code. PGconn* const conn=PQconnectdbParams(keywords, values, false); if(! conn || PQstatus(conn)!=CONNECTION_OK){ /* error code? */ } In case of a failed connection is there a way to get the error code to be able to distinguish between a bad password and the server being down. (I know I can get the error message, but I want to be able to react to the cause of the error according to its cause). Thanks. 回答1: So after doing some more research and asking postgres developers it

How to manage endianess of double from network

笑着哭i 提交于 2019-12-29 07:11:48
问题 I have a BIG problem with the answer to this question Swap bits in c++ for a double Yet, this question is more or less what I search for: I receive a double from the network and I want to encoded it properly in my machine. In the case I receive an int I perform this code using ntohl : int * piData = reinterpret_cast<int*>((void*)pData); //manage endianness of incomming network data unsigned long ulValue = ntohl(*piData); int iValue = static_cast<int>(ulValue); But in the case I receive an

Library not loaded: libpq.5.dylib

一曲冷凌霜 提交于 2019-12-28 14:25:09
问题 I have app that is running Ruby 1.9.2, Rails 3, and postgreSQL 8.3. It was originally setup and working with postgreSQL 9.1, but I uninstalled 9.1 and installed and changed to 8.3 insure compatibility on a Heroku shared database setup. It was running ok, but it's not now Now, when working on this app, when I run a database upgrade I get this error: dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib Referenced from:

Library not loaded: libpq.5.dylib

岁酱吖の 提交于 2019-12-28 14:25:08
问题 I have app that is running Ruby 1.9.2, Rails 3, and postgreSQL 8.3. It was originally setup and working with postgreSQL 9.1, but I uninstalled 9.1 and installed and changed to 8.3 insure compatibility on a Heroku shared database setup. It was running ok, but it's not now Now, when working on this app, when I run a database upgrade I get this error: dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib Referenced from:

Is libpq more like a JDBC driver or JavaSE's java.sql package?

拥有回忆 提交于 2019-12-25 01:36:00
问题 Is it correct that the following two are different concepts: a JDBC driver (e.g. a JDBC driver for PostgreSQL) and JavaSE's java.sql package? Is it correct that the JavaSE's java.sql package is an API built upon a JDBC driver, to become driver-agnostic? In C for PostgreSQL, what is the equivalence to a JDBC driver, and what is the equivalence to java.sql? Is libpq more like a JDBC driver for PostgreSQL or JavaSE's java.sql package? 回答1: Java SE' java.sql package defines interfaces that Java

How to get the double value using libpq?

故事扮演 提交于 2019-12-22 10:00:04
问题 The examples in the libpq documentation show how to get the the integer value by converting it to the host-endian representation. I am curious what must be done to get the double precision value using libpq (without libpqtyppes)? I have tried reinterpret_cast with no luck. Also why text and byte data doesn't need endian conversions? The DB runs locally on Windows 7, I am using Visual C++ 2013. pptr is a double vaule I am trying to retrieve. #include <iostream> #include <memory> #include

Compiling libpq with iOS SDK 4.2

坚强是说给别人听的谎言 提交于 2019-12-21 19:33:06
问题 I'm trying to compile again the libpq for arm and i386 with the iOS SDK 4.2. I did last year for SDK3.x without any problems. Now, when I want to create the fat binary file with two files, I'm getting this error: specifed architecture type (arm) for file (/Users/montx/mylibs_sdk42/libpq.arm) does not match its cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0)) I'm compiling again because my compiled files doesn't work with the latest iOS4.2 Detected an attempt to call

Compiling libpq with iOS SDK 4.2

我与影子孤独终老i 提交于 2019-12-21 19:33:03
问题 I'm trying to compile again the libpq for arm and i386 with the iOS SDK 4.2. I did last year for SDK3.x without any problems. Now, when I want to create the fat binary file with two files, I'm getting this error: specifed architecture type (arm) for file (/Users/montx/mylibs_sdk42/libpq.arm) does not match its cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0)) I'm compiling again because my compiled files doesn't work with the latest iOS4.2 Detected an attempt to call