PX_RETRIEVE_RECORD(3)

πŸ’– PX_RETRIEVE_RECORD πŸ’–

okay bestie, welcome to the PX_retrieve_record(3) page from the Library Functions Manual β€” yes it's a library function, yes it's giving ✨database girlie✨, let's get into it 🫢


🌸 NAME 🌸

PX_retrieve_record β€” literally hands you a record out of a Paradox file. that's the whole job. no cap. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <paradox.h>

pxval_t ** PX_retrieve_record(pxdoc_t *pxdoc, int recno)

✨ DESCRIPTION ✨

So here's the tea: this function returns the record with the given number inside a Paradox file. The first record has number 0, and the last one has number number_of_records-1. Zero-indexed, obviously, we love that for us. πŸ‘‘

And listen β€” if you're grabbing a bunch of records, pls do it in ascending order. It's genuinely the most efficient way and the vibes will be immaculate. πŸ”₯

The return value is an array of field values, and every single value is tucked inside a structure that looks exactly like this:

typedef struct px_val pxval_t;
struct px_val {
char isnull;
int type;
union {
long lval;
double dval;
struct {
char *val;
int len;
} str;
} value;
};

okay let's break down the members because this is the part where people get lost and we are NOT letting that happen to you πŸ’–

  • The element isnull is set to 1 if the value is NULL, otherwise it gets set to 0. That's it, that's the flag.
  • type is the type of the paradox field as defined in paradox.h.
  • A field value can be either a long int, a double, or a string, depending on the paradox field type.

Now for the mapping, and this matters so stay with me:

  • The paradox field types pxfShort, pxfLong, pxfDate, pxfTime, pxfLogical, and pxfAutoInc are returned as long int values.
  • pxfTimestamp, pxfNumber, and pxfCurrency are returned as double values.
  • All the remaining paradox field types are stored as strings, with the length sitting in value.len. And yes, you can rely on strings being Null terminated. πŸŽ€
⚠️ except bestie, careful: Blobs are stored as string but are not guarented to be Null terminated. so do not go assuming, okay? πŸ™ˆ

One more thing β€” the paradox field types pxfTimestamp, pxfTime, and pxfDate use an uncommon format. If you want them as a string, you convert them with PX_timestamp2string(3), PX_time2string(3), and PX_date2string(3). they've got your back πŸ’œ


🌈 RETURN VALUE 🌈

Returns a pointer on success and NULL on failure. simple as that. slay. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘


πŸŽ€ AUTHOR πŸŽ€

This manual page was written by Uwe Steinmann uwe@steinmann.cx. iconic behaviour, we stan a documentation author πŸ’–


and that's the whole page, bestie!! this was PX_RETRIEVE_RECORD(3) from the Library Functions Manual, footer title and all β€” no date, no version, just the name holding it down at the bottom. go retrieve those records, you're gonna ate πŸ¦‹πŸ’…βœ¨