Re: [NOVICE] Executing prepared statements in the multithreaded envs - Mailing list pgsql-novice

From Ruslan R. Laishev
Subject Re: [NOVICE] Executing prepared statements in the multithreaded envs
Date
Msg-id 2410381508253395@web22g.yandex.ru
Whole thread Raw
In response to Re: [NOVICE] Executing prepared statements in the multithreaded envs  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [NOVICE] Executing prepared statements in the multithreaded envs  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-novice
A quotation from the docs "for me" :
 
PQprepare
Submits a request to create a prepared statement with the given parameters, and waits for com-
pletion.
PGresult
* PQprepare(PGconn * conn,
const char
* stmtName,
const char
* query,
int nParams,
const Oid
* paramTypes);
PQprepare creates a prepared statement for later execution with PQexecPrepared . This fea-
ture allows commands to be executed repeatedly without being parsed and planned each time;
see PREPARE for details. PQprepare is supported only in protocol 3.0 and later connections; it
will fail when using protocol 2.0.
The function creates a prepared statement named stmtName from the query string, which must
contain a single SQL command. stmtName can be "" to create an unnamed statement, in which
case any pre-existing unnamed statement is automatically replaced; otherwise it is an error if the
statement name is already defined in the current session. If any parameters are used, they are
referred to in the query as $1 , $2 , etc. nParams is the number of parameters for which types
are pre-specified in the array paramTypes[] . (The array pointer can be NULL when nParams is
zero.) paramTypes[] specifies, by OID, the data types to be assigned to the parameter symbols.
If paramTypes is NULL , or any particular element in the array is zero, the server assigns a data
type to the parameter symbol in the same way it would do for an untyped literal string. Also, the
query can use parameter symbols with numbers higher than nParams ; data types will be inferred
for these symbols as well. (See PQdescribePrepared for a means to find out what data types
were inferred.)
 
 
The result is not documented at all. So ...
Thanks David for your time. :-)
 
 
17.10.2017, 18:08, "David G. Johnston" <david.g.johnston@gmail.com>:
On Tue, Oct 17, 2017 at 8:02 AM, Ruslan R. Laishev <zator@yandex.ru> wrote:
Ho to check the PQprepare result ?
NULL or noNULL ?
 
 
That seems like it should be documented...I'm not a C programmer and don't have time right now to go look at the docs for you.
 
David J.​
 
 
-- 
С уважением,
Ruslan R. Laishev
OpenVMS bigot, natural born system/network progger, C contractor.
+79013163222
+79910009922
 

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Executing prepared statements in the multithreaded envs
Next
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Executing prepared statements in the multithreaded envs