libpq

Type conversion. What do I do with a PostgreSQL OID value in libpq in C?

主宰稳场 提交于 2019-12-01 15:54:34
I'm working with the PostgreSQL C API, libpq. I need to be able to convert the values in a PGresult* into their equivalent data types in Ruby. I'm currently just selecting all the data and using PQgetvalue() , which gives me a char* that I can convert into a ruby String. That's easy. But are there any examples somebody can share that do a type conversion from the char* to, say, int , float or double , according to the OID returned by PQftype() ? Actually, in short I have no idea how to interpret the OID and the documentation doesn't seem to give any pointers. I found this page , but that doesn

Type conversion. What do I do with a PostgreSQL OID value in libpq in C?

ⅰ亾dé卋堺 提交于 2019-12-01 14:57:45
问题 I'm working with the PostgreSQL C API, libpq. I need to be able to convert the values in a PGresult* into their equivalent data types in Ruby. I'm currently just selecting all the data and using PQgetvalue() , which gives me a char* that I can convert into a ruby String. That's easy. But are there any examples somebody can share that do a type conversion from the char* to, say, int , float or double , according to the OID returned by PQftype() ? Actually, in short I have no idea how to

PDO vs pg_* functions

徘徊边缘 提交于 2019-11-29 10:24:33
They both have prepared statements. pg_* is a wrapper to libpq. Right? I like the PDO in PHP, but I'm not going to change the database in the future. Which library should I use? Any benchmark? PHP version: 5.4 PDO offers a nice interface but more genericity also means more trouble to deal with subtle idiosyncrasies of each backend. If you look at the bugtracker , it has a number of open issues, and some of them are serious. Here's an anecdotal evidence with postgresql: PDO's parser has trouble with standard_conforming_strings set to ON (which is now the default, as of PG-9.1). Test case with

Connect iPhone App to PostgreSQL Using Libpq

落花浮王杯 提交于 2019-11-29 08:55:26
I need to create an application for the iPhone that will connect to a PostgreSQL 8.4 database using libpq. The problem is I can't get a simple iPhone that links to libpq to compile. I am however able to get the equivalent application that is a regular Mac desktop app to compile and connect to PostgreSQL without any issues. I'm on Xcode 3.2 running on Snow Leopard. I'm building libpq for both arm and for x86_84. The arm build is for the real iPhone and the x86_64 is for the iPhone simulator to use. I then create a fat binary that contains both files and end up with a file named libpq. This file

How to manage endianess of double from network

徘徊边缘 提交于 2019-11-29 07:47:18
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 double , I don't know what to do. The answer to the question suggest to do: template <typename T> void

Library not loaded: libpq.5.dylib

倾然丶 夕夏残阳落幕 提交于 2019-11-28 10:48:27
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: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle Reason: no suitable image

PDO vs pg_* functions

可紊 提交于 2019-11-28 03:47:44
问题 They both have prepared statements. pg_* is a wrapper to libpq. Right? I like the PDO in PHP, but I'm not going to change the database in the future. Which library should I use? Any benchmark? PHP version: 5.4 回答1: PDO offers a nice interface but more genericity also means more trouble to deal with subtle idiosyncrasies of each backend. If you look at the bugtracker, it has a number of open issues, and some of them are serious. Here's an anecdotal evidence with postgresql: PDO's parser has

Connect iPhone App to PostgreSQL Using Libpq

本秂侑毒 提交于 2019-11-28 02:08:13
问题 I need to create an application for the iPhone that will connect to a PostgreSQL 8.4 database using libpq. The problem is I can't get a simple iPhone that links to libpq to compile. I am however able to get the equivalent application that is a regular Mac desktop app to compile and connect to PostgreSQL without any issues. I'm on Xcode 3.2 running on Snow Leopard. I'm building libpq for both arm and for x86_84. The arm build is for the real iPhone and the x86_64 is for the iPhone simulator to

Link against a 3rd-party library with Visual Studio

寵の児 提交于 2019-11-26 23:40:12
问题 I'm trying to create a .dll with Visual Studios 2013. The project includes libpq functionality. Per other stackoverflow posts, and other sources I've found on the internet, I've (as far as I'm aware) correctly added the postgres lib and include directories to the project. However, when I go to build the project, it returns a number of "unresolved external symbol" errors. My paths are C:\Program Files\PostresSQL\9.3\... so I have them surrounded by quotation marks in the Additional Library

Rails 3 - can&#39;t install pg gem

橙三吉。 提交于 2019-11-26 12:03:31
When I try to run bundle (bundle install), I all the time get Installing pg (0.13.2) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/ryan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file