libpq

How to connect to postgresql from ios9

青春壹個敷衍的年華 提交于 2019-12-06 15:56:29
I'm building iOS9.3 app with Swift. I'm trying to connect the PostgreSQL directly, and yes I know usually the most common approach is to create a web api as bridge between apps and server(like MSSQL,PGSQL,MYSQL...), and that is the easy/safe way to do it. But right now I need to do direct connection, and I already tried several solution as below, but so far there is no luck. Basically these are build from Obj-C(2010~14), and I also have to create Bridging-Header to connect Obj-C and Swift(That is not a problem). But I'm stuck here. :( libpq.framework , PGSQLTouch , PGSQLKit-iOS-9.1.1 If I just

How to get the double value using libpq?

↘锁芯ラ 提交于 2019-12-06 02:19:21
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 <vector> #include <libpq-fe.h> #include <Winsock2.h> static void show_binary_results(PGresult *res) { int i,

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

徘徊边缘 提交于 2019-12-04 12:11:27
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. So after doing some more research and asking postgres developers it seems that it is not currently possible to get the error code from PQconnectdbParams(). This seems to be a

Compiling libpq with iOS SDK 4.2

梦想与她 提交于 2019-12-04 11:19:20
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 a symbol in system libraries that is not present on the iPhone: fcntl$UNIX2003 called from function pg

python connect to postgresql with libpq-pgpass

落爺英雄遲暮 提交于 2019-12-04 05:08:10
I read there is a more secure way to connect to postgresql db without specifying password in source code using http://www.postgresql.org/docs/9.2/static/libpq-pgpass.html . But unfortunatelly I was not able to find any examples of how to import it to my python program and how made my postgresql server to use this file. Please help. You don't import it into your Python program. The point of .pgpass is that it is a regular file subject to the system's file permissions, and the libpq driver which libraries such as psycopg2 use to connect to Postgres will look to this file for the password instead

Insert Binary Large Object (BLOB) in PostgreSQL using libpq from remote machine

你。 提交于 2019-12-03 15:27:17
Can you give an example of inserting binary data in PostgreSQL database from remote machine using libpq. My second question is: Is there any other API more efficient than libpq with C++. Thanks There are 2 types of blobs in PostgreSQL — BYTEA and Large Objects . I'd recommend against using large objects as you can not join them to tables. For BYTEA you'd use something like this in libpq: PGresult* put_data_to_tablename( PGconn* conn, int32_t id, int data_size, const char* const data ) { PGresult* result; const uint32_t id_big_endian = htonl((uint32_t)id); const char* const paramValues[] = {

PostgreSQL syntax error in parameterized query on “date $1”

给你一囗甜甜゛ 提交于 2019-12-02 10:44:11
问题 Trying to parameterize my SQL queries (using libpq function PQexecParams), I was stuck on a syntax error: SELECT date $1 The error is: ERROR: syntax error at or near "$1" 回答1: Prepared statements The explanation for this can be found in the chapter Constants of Other Types of the manual: The :: , CAST() , and function-call syntaxes can also be used to specify run-time type conversions of arbitrary expressions, as discussed in Section 4.2.9. To avoid syntactic ambiguity, the type 'string'

PostgreSQL syntax error in parameterized query on “date $1”

半城伤御伤魂 提交于 2019-12-02 05:14:09
Trying to parameterize my SQL queries (using libpq function PQexecParams ), I was stuck on a syntax error: SELECT date $1 The error is: ERROR: syntax error at or near "$1" Prepared statements The explanation for this can be found in the chapter Constants of Other Types of the manual : The :: , CAST() , and function-call syntaxes can also be used to specify run-time type conversions of arbitrary expressions, as discussed in Section 4.2.9 . To avoid syntactic ambiguity, the type 'string' syntax can only be used to specify the type of a simple literal constant. Another restriction on the type

Ruby on Rails / PostgreSQL - Library not loaded error when starting server

拜拜、爱过 提交于 2019-12-01 19:14:37
Heyo. I apologize in advance if this question has been answered in another thread. I've searched through the site but I didn't find an answer. However, the closest related issue was Ruby on Rails / PostgreSQL - Library not Loaded error when starting server- libq.5.dylib , but it was never resolved, and the answer doesn't help me. I'm trying to get PostgreSQL running on my Mac OSX 10.6.8. I already have Ruby 1.9.3p392 and Rails 3.2.13 installed. Since I've 10.6.8, and PostGresApp requires 10.7+, I tried installing PG using the manual installer (v9.2.3) available here: http://www.enterprisedb

Ruby on Rails / PostgreSQL - Library not loaded error when starting server

丶灬走出姿态 提交于 2019-12-01 18:04:03
问题 Heyo. I apologize in advance if this question has been answered in another thread. I've searched through the site but I didn't find an answer. However, the closest related issue was Ruby on Rails / PostgreSQL - Library not Loaded error when starting server- libq.5.dylib, but it was never resolved, and the answer doesn't help me. I'm trying to get PostgreSQL running on my Mac OSX 10.6.8. I already have Ruby 1.9.3p392 and Rails 3.2.13 installed. Since I've 10.6.8, and PostGresApp requires 10.7+