pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oleg <lego12239@yandex.ru>
To: Dmitry Igrishin <dmitigr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: libpq PQexecParams & value placeholders
Date: Fri, 14 Dec 2018 15:09:19 +0300
Message-ID: <20181214120919.GB4644@legohost> (raw)
In-Reply-To: <CAAfz9KNzi26oUxuiJdiNB5-_mvddxjsiyLtP7GNKWkqEDtPNDQ@mail.gmail.com>
References: <20181214113338.GA4644@legohost>
	<CAAfz9KNzi26oUxuiJdiNB5-_mvddxjsiyLtP7GNKWkqEDtPNDQ@mail.gmail.com>

On Fri, Dec 14, 2018 at 02:47:12PM +0300, Dmitry Igrishin wrote:
> пт, 14 дек. 2018 г. в 14:33, Oleg <lego12239@yandex.ru>:
> >
> > Hi, all.
> >
> > Do we really need a numeric value placeholders like $1 in command string?
> It's a syntax defined at the backend side.
> (https://www.postgresql.org/docs/current/sql-prepare.html)

I know this, but i can't understand why this approach is used.

> > Construction of such string for complex non-static queries is very annoying.
> That's why there are libraries like Pgfe
> (https://github.com/dmitigr/pgfe) or libpqtypes

This is C++ :-(.

> (http://libpqtypes.esilo.com/)

This is great! PQexecf() is what i need. Why this api is not the part of libpq?
Thank you for the link!

> > Why do we can't simply use $$ placeholder, which take the next value from an
> > array of values?
> Because $$ means a dollar-quoted opening tag
> (https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING)

Ok. We can use any other placeholder string for such purpose. But not numeric
placeholders - these are not convenient.


-- 
Олег Неманов (Oleg Nemanov)




view thread (4+ messages)  latest in thread

Message-ID: <20181214120919.GB4644@legohost>
Permalink:  ../20181214120919.GB4644@legohost/
Also on:    postgresql.org/message-id/20181214120919.GB4644@legohost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: lego12239@yandex.ru, dmitigr@gmail.com
  Subject: Re: libpq PQexecParams & value placeholders
  In-Reply-To: <20181214120919.GB4644@legohost>
  References: <20181214113338.GA4644@legohost> <CAAfz9KNzi26oUxuiJdiNB5-_mvddxjsiyLtP7GNKWkqEDtPNDQ@mail.gmail.com> <20181214120919.GB4644@legohost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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