PX_GET_RECORD2(3)
π PX_get_record2 β the record-fetching glow-up π
okay bestie, listen up, because we're in the Library Functions Manual today and the vibe is records from Paradox files. this one's a classic, she's a little extra, and honestly? she's kind of deprecated. we'll get to that. no cap. π¦
β¨ SYNOPSIS β¨
#include <paradox.h>
int PX_get_record2(pxdoc_t *pxdoc, int recno, char *data, int *deleted,
pxdatablockinfo_t *pxdbinfo)
πΈ DESCRIPTION πΈ
so this function is literally the sister of PX_get_record(3) β same energy, except she takes two extra parameters. she said "let me give you more". π
- if
*deletedis set to1, she will consider any record in the database, even the deleted ones. she's inclusive like that. - if
*pxdbinfois notNULL, she'll hand you back some info about the data block the record got read from.
β οΈ heads up queen: you have to allocate the memory forpxdbinfobefore you callPX_get_record2. she does not do it for you. not her job.
on return, *deleted gets set to 1 if the record you asked for is deleted, or 0 if it isn't. simple as that. β¨
π the pxdatablockinfo_t struct π
here's what's inside, bestie, field by field:
blockpos(long) β the file position where the block starts. the first six bytes of the block are the header, and the record data comes right after.recordpos(long) β the file position where the record you asked for actually starts.size(int) β the size of the data block, not counting the six bytes of header.recno(int) β the record number within the data block. the first record in the block is number0.numrecords(int) β how many records live in this block.number(int) β the number of the data block itself.
π the messy part (read this, fr fr)
this function may return records with invalid data. why? because records aren't explicitly marked as deleted β instead, the size of a valid data block gets modified. that's the whole trick. π
a data block is a fixed-size area in the file that holds a certain number of records. so if for some reason a data block has never been completely filled with records, the algorithm anticipates deleted records in that blockβ¦ which aren't actually there. plot twist. π
this happens a lot with the last data block in a file, because it's likely to not be fully filled with records.
also, if you're accessing several records, do it in ascending order β that's the most efficient way. trust. π«Ά
π¨ Note: this function is deprecated. use PX_retrieve_record(3) instead. she's the newer model, the main character now. periodt.
π« RETURN VALUE π«
0on success π-1on failure π
π SEE ALSO π
π AUTHOR π
this manual page was written by Uwe Steinmann uwe@steinmann.cx. iconic of him honestly.
and that's the whole page, bestie!! this one comes to you straight from the Library Functions Manual, and ngl there's no date stamp on it, so we're just vibing timelessly. πβ¨π go call PX_retrieve_record(3) instead, i'm begging. π¦
π¦ where this page comes from
- debian bookworm: pxlib-dev 0.6.8-1+b1
- debian trixie: pxlib-dev 0.6.9-1+b1
- ubuntu jammy: pxlib-dev 0.6.8-1
- ubuntu noble: pxlib-dev 0.6.8-1
- ubuntu questing: pxlib-dev 0.6.9-1
- ubuntu resolute: pxlib-dev 0.6.9-1build1
- ubuntu stonking: pxlib-dev 0.6.10-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms