Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id BC50B650499 for ; Tue, 9 Dec 2008 11:29:52 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 09359-04 for ; Tue, 9 Dec 2008 11:29:47 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.189]) by mail.postgresql.org (Postfix) with ESMTP id D1E17650490 for ; Tue, 9 Dec 2008 11:29:46 -0400 (AST) Received: by rn-out-0910.google.com with SMTP id k40so11472rnd.0 for ; Tue, 09 Dec 2008 07:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=Ss4Rjx4Kcn8SCacxWK3GSO2Ftg0lkr9KJ2zklDO03jw=; b=FtU+UkfVDlS7aQBe+yx8G11BeUszdjzp8Al63rFeqQY65k5QBg5KscMZYvVMnYuU7w 0r64C01ZH71wTqhp8ZCBn+4Tib3E7imky9Op4psJeIVeC8LIn9+nUNS/ls7JYHq+sgpg PjV6lMV0RFwBG5nWlhCneI/kkVnZugFE5SSoc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=PEDZ0gP6/bS/q4vtjI+gDNA26J6kfMf4db2pSLeF2Bxm9WfZOJamn2uXjZSh5vnbec 6tA7lCNu+Rlo2CeotM5hNdv9uS84eROPWrjLzkVHeiAbDP9OoJ50Hj2QfgR6a0eq28C5 hhJjzgGSSo+GOG1c1i16Sok1UGXQYwnHc53CM= Received: by 10.151.105.13 with SMTP id h13mr141230ybm.171.1228835315691; Tue, 09 Dec 2008 07:08:35 -0800 (PST) Received: by 10.151.136.2 with HTTP; Tue, 9 Dec 2008 07:08:35 -0800 (PST) Message-ID: <8ec76080812090708g93000f9l7e7f3e2162587331@mail.gmail.com> Date: Tue, 9 Dec 2008 10:08:35 -0500 From: "Whit Armstrong" To: pgsql-interfaces@postgresql.org Subject: simple example of copying data from a c/c++ array into postgres MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_83686_2172252.1228835315694" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200812/8 X-Sequence-Number: 6825 ------=_Part_83686_2172252.1228835315694 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline would someone mind showing me an example of making an insert from binary data to postgres? I'm currently doing the inserts via a scripting languge, but I would like to do them directly in c/c++ code. my data looks like this (date and double): 2008-12-03 2.6585 2008-12-04 2.5513 2008-12-05 2.7037 2008-12-08 2.7378 my script does something like this: insert into kls_clnt.obs (id, asofdate, datavalue) values (100, 2008-12-03, 2.6585); for every row of the data. Since, I already have this data in a C array, it must be faster to iterate through the rows of the array and persist the data directly from C to the database. Can someone direct me to a simple example of doing this? Thanks, Whit ------=_Part_83686_2172252.1228835315694 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline would someone mind showing me an example of making an insert from binary data to postgres?

I'm currently doing the inserts via a scripting languge, but I would like to do them directly in c/c++ code.

my data looks like this (date and double):

2008-12-03         2.6585
2008-12-04         2.5513
2008-12-05         2.7037
2008-12-08         2.7378


my script does something like this:

insert into kls_clnt.obs (id, asofdate, datavalue) values (100, 2008-12-03, 2.6585);

for every row of the data.

Since, I already have this data in a C array, it must be faster to iterate through the rows of the array and persist the data directly from C to the database.   Can someone direct me to a simple example of doing this?

Thanks,
Whit

------=_Part_83686_2172252.1228835315694--