PQparamCreate(3)
π NAME π
PQparamCreate, PQparamCount PQparamReset, PQparamClear β the PGparam management girlies. Bestie, this whole squad is here to handle your PGparam object situation.
(also lowkey PQparamDup is in this friend group, she just wasn't invited to the NAME line. rude, but okay. we'll get to her.)
β¨ SYNOPSIS β¨
#include <libpqtypes.h>
PGparam *PQparamCreate(const PGconn *conn);
PGparam *PQparamDup(PGparam *param);
int PQparamCount(PGparam *param);
void PQparamReset(PGparam *param);
void PQparamClear(PGparam *param);
π«Ά DESCRIPTION π«Ά
Okay so. These functions manage the opaque PGparam object. Opaque means you don't get to peek inside her β she's mysterious, she's private, she's giving main character energy. You just use the functions and she handles the rest. π
PQparamCreate()β allocates and initializes a brand newPGparamobject. The second this call returns, she's ready for use, no warm-up needed, she's already dressed and out the door.
β οΈ WARNING bestie, listen to me: only types that have been registered via PQregisterXXX will be available to the param. Which means β the param is not updated with types registered after the param is created. She is frozen in time, she does not get new info later, periodt. So register your types FIRST, then create your param. Order matters, no cap.
PQparamDup()β duplicates a givenPGparam, and yes that includes any internal values that have already been put in there. Why is this iconic? Because you can queue up queries to execute at a later time β think connection pooler vibes. The problem:PQparamCreaterequires a connection object, and a connection object might not be available when you're trying to enqueue a query with itsPGparamobject. π Instead, aPGparamobject can be used for the sole purpose of creating duplicates while there are no availablePGconnobjects. So she's like a template, a blueprint, a little queen sitting on the shelf making copies. Obsessed.PQparamCount()β gets the number of parameters in aPGparamobject. Just the count. That's it. Simple, honest, reliable.PQparamReset()β clears out any previously put parameters, but will not free any memory. This is for the application that wants to "reuse" aPGparamobject. Reuse era. β»οΈPQparamClear()β releases all resources being used by aPGparamobject. And then? The object should not be used after a clear. She's gone. Do not text her back. πͺ¦
π¨ It is very important to callPQparamReset()if you plan on reusing aPGparamobject. Not "kinda important", not "if you feel like it" β VERY important. Do it. I'm not mad, I'm just disappointed. π
π RETURN VALUE π
PQparamCreate()returns a pointer to aPGparamobject on success, andNULLif something failed. If you gotNULL, go checkPQgeterror(3)for more information β she'll tell you what went wrong. πPQparamCount()returns the number of parameters in aPGparamobject.PQparamReset()andPQparamClear()have no return values. And if either function is provided aNULLPGparampointer, it will silently fail. No drama, no error, no nothing. Just quiet. The way that silence is so loud honestly.
πΈ EXAMPLES πΈ
None.
Yeah. Bestie, I know. We're all a little disappointed. No examples, just vibes. You'll figure it out. β¨
π AUTHOR π
A contribution of eSilo, LLC. for the PostgreSQL Database Management System. Written by Andrew Chernow and Merlin Moncure. Kings. Absolute icons. π«Ά
π¦ REPORTING BUGS π¦
Report bugs to <libpqtypes@esilo.com>. Tell them everything, don't be shy. π
π COPYRIGHT π
Copyright (c) 2011 eSilo, LLC. All rights reserved.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So like. She's free, she's generous, she's giving. But if she breaks? Not their problem. NO warranty. Zero. None. Read the source, bestie. π
π SEE ALSO π
That's the whole page, bestie! This one's from the libpqtypes manual, dated 2011. Go forth and manage your params responsibly. Mwah. πβ¨π
π¦ where this page comes from
- debian bookworm: libpqtypes-dev 1.5.1-9
- ubuntu jammy: libpqtypes-dev 1.5.1-7
- ubuntu noble: libpqtypes-dev 1.5.1-9.1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms