Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1D5FC632AFA for ; Sat, 11 Sep 2010 09:44:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 78308-07 for ; Sat, 11 Sep 2010 12:44:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.22]) by mail.postgresql.org (Postfix) with SMTP id 7480D632191 for ; Sat, 11 Sep 2010 09:44:27 -0300 (ADT) Received: (qmail 2998 invoked by uid 0); 11 Sep 2010 12:44:24 -0000 Received: from 193.247.250.11 by www110.gmx.net with HTTP; Sat, 11 Sep 2010 14:44:23 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Sat, 11 Sep 2010 14:44:23 +0200 From: "Steve" Message-ID: <20100911124423.75020@gmx.net> MIME-Version: 1.0 Subject: Question about PQexecParams To: pgsql-sql@postgresql.org X-Authenticated: #26630975 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+CtddJ8s6CGXZX61ckYZwwXVP0Ib/MNJGKI+Vzr1 m0QH0jbZ1xYbhLowob1cW3jEh0eCBvSE9DSg== Content-Transfer-Encoding: 8bit X-GMX-UID: n0u4eCRUX1V6BAs2+mBypRB/SDc4NAwP X-FuHaFi: 0.51000000000000001 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.261 tagged_above=-5 required=5 tests=BAYES_05=-0.5, HK_RANDOM_ENVFROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=0.77, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/25 X-Sequence-Number: 34556 Hello list, I would like to call a function from my C application by using libpq and PQexecParams. My problem is that I don't know how to specify that I want to send an array to the function. Assume the function is called lookup_data and takes the following parameters: lookup_data(integer,integer,bigint[]) I would like to specify the OID with my query. How would I do that? Assume I would like to query 3 values for bigint: const char *paramValues[5]; Oid paramTypes[5]; int paramLengths[5]; int paramFormats[5]; int32_t ivalue1 = htonl(value1); paramValues[0] = (char *)&ivalue1; paramTypes[0] = INT4OID; paramLengths[0] = sizeof(ivalue1); paramFormats[0] = 1; int32_t ivalue2 = htonl(value2); paramValues[1] = (char *)&ivalue2; paramTypes[1] = INT4OID; paramLengths[1] = sizeof(ivalue2); paramFormats[1] = 1; etc... How would I tell libpq that the next 3 values are an array of bigint? I tried to use INT8OID and specify the query like below but that did not work: SELECT * FROM lookup_data($1,$2,{$3,$4,$5}) Probably I have to set the query to be: SELECT * FROM lookup_data($1,$2,{$3}) Or: SELECT * FROM lookup_data($1,$2,$3) But what would I set for paramTypes? How can I say that the values are an array of bigint? I assume that I can set paramValues to be an array and paramLengths to be sizeof one value multiplied by the amount of elements in the array. I am somehow lost and don't know how to call the function and pass an array to libpq. Can any one help me with this? // Steve -- GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl