pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Parameterized queries
3+ messages / 3 participants
[nested] [flat]

* Parameterized queries
@ 2003-11-14 16:05 Jan Klostermann <klostermann@rhf.de>
  2003-11-14 16:28 ` Re: Parameterized queries Jeroen T. Vermeulen <jtv@xs4all.nl>
  2003-11-14 16:41 ` Re: Parameterized queries Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Jan Klostermann @ 2003-11-14 16:05 UTC (permalink / raw)
  To: pgsql-interfaces

Hello,

I would like to know, if there exists a way in PostgreSQL to insert data
not exclusively via the SQL-query-string but using a direct data
interface, thus avoiding parsing the data into string and then back into
binary data representation (e.g. Double). 

What I would like to use is a query like this: INSERT INTO table
(number1, number2) VALUES (?,?)
Before executing the query the command structure would be fill with the
parameters for the 2 values (e.g. 3.33 and 5.555) and then there would
follow the execution, where the query parser would replace the "?" with
the current data of the parameters and execute the appopriate query.

Unfortunately I cannot find anything about query-contructions with
question marks ("?"), therefore I am already wondering if this way of
transfering data exists with PostgreSQL!?

Is there anybody out there, who can help me with this?
Is there another way of efficiently transfering data, avoiding parsing
back and forth? 

Jan Klostermann

PS: I tried to do it via the ODBC interface and it did not work. Then I
scanned through the documentation, incl. libpq and did not find anything
related. 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Parameterized queries
  2003-11-14 16:05 Parameterized queries Jan Klostermann <klostermann@rhf.de>
@ 2003-11-14 16:28 ` Jeroen T. Vermeulen <jtv@xs4all.nl>
  1 sibling, 0 replies; 3+ messages in thread

From: Jeroen T. Vermeulen @ 2003-11-14 16:28 UTC (permalink / raw)
  To: Jan Klostermann <klostermann@rhf.de>; +Cc: pgsql-interfaces

On Fri, Nov 14, 2003 at 05:05:46PM +0100, Jan Klostermann wrote:
> 
> I would like to know, if there exists a way in PostgreSQL to insert data
> not exclusively via the SQL-query-string but using a direct data
> interface, thus avoiding parsing the data into string and then back into
> binary data representation (e.g. Double). 
 
You could use binary cursors.


> What I would like to use is a query like this: INSERT INTO table
> (number1, number2) VALUES (?,?)
> Before executing the query the command structure would be fill with the
> parameters for the 2 values (e.g. 3.33 and 5.555) and then there would
> follow the execution, where the query parser would replace the "?" with
> the current data of the parameters and execute the appopriate query.

Wouldn't it be easier in this case to skip the SQL altogether and just
use the COPY command to pump data into the table with minimal processing?  
You'd still go through the parsing, but that may end up saving you trouble
anyway if you ever need to run the server and the client on different
machines--and I wouldn't be surprised if going through SQL is costing you
more than the value parsing anyway.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Parameterized queries
  2003-11-14 16:05 Parameterized queries Jan Klostermann <klostermann@rhf.de>
@ 2003-11-14 16:41 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2003-11-14 16:41 UTC (permalink / raw)
  To: Jan Klostermann <klostermann@rhf.de>; +Cc: pgsql-interfaces

"Jan Klostermann" <klostermann@rhf.de> writes:
> I would like to know, if there exists a way in PostgreSQL to insert data
> not exclusively via the SQL-query-string but using a direct data
> interface,

This ability exists as of 7.4.  I do not know whether the ODBC interface
supports it, but libpq does and I believe JDBC does.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-11-14 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-14 16:05 Parameterized queries Jan Klostermann <klostermann@rhf.de>
2003-11-14 16:28 ` Jeroen T. Vermeulen <jtv@xs4all.nl>
2003-11-14 16:41 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox