PX_ADD_PRIMARY_INDEX(3)

πŸ’– PX_ADD_PRIMARY_INDEX πŸ’–

okay bestie, gather round, because we're talking about PX_add_primary_index(3) from the Library Functions Manual and it's honestly giving "quiet little function, huge main character energy" ✨


✨ NAME ✨

PX_add_primary_index β€” Assigns primary index to database file πŸŽ€


🌸 SYNOPSIS 🌸

#include <paradox.h>

int PX_add_primary_index(pxdoc_t *pxdoc, pxdoc_t *pindexdoc)

like. two pointers in, one int out. we love a minimalist king πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So what this does is: it assigns a primary index to a database file. that's the whole vibe. you're basically introducing your database to its index and being like "you two belong together now, periodt" πŸ’ž

BUT. and this is the important part, bestie, do not skip this β€”

The primary index must be loaded before as any Paradox file with PX_open_fp(3) or PX_open_file(3). so like, load it first, then attach it. order matters, no cap πŸ™ˆ

Also, pxdoc must be a Paradox database file. like, it has to actually be one. don't be out here passing random stuff and hoping for the best, i'm begging 😭

And one more thing for the girlies who want to actually use the index:

In order to be able to use the index you will have to call PX_read_primary_index(3) before accessing any record data.

so the pipeline is: load the index β†’ PX_add_primary_index it β†’ PX_read_primary_index(3) it β†’ then you can touch the record data. do it out of order and it's giving chaos, not slay 🫢


⭐ RETURN VALUE ⭐

  • 0 β€” success!! we ate, no crumbs πŸ‘‘
  • -1 β€” failure πŸ’€ it did not work out

that's it. binary. iconic.


🌈 SEE ALSO 🌈

your little friend group, right there. go read them too, they're all connected 🧚


πŸ’œ AUTHOR πŸ’œ

This manual page was written by Uwe Steinmann uwe@steinmann.cx. thank you for your service, legend πŸŽ€


and that's the page, bestie!! this one came straight out of the Library Functions Manual, filed under PX_ADD_PRIMARY_INDEX(3), and if you ever forget how it works just remember: load it, add it, read it, then touch the data. mwah πŸ’‹ ✨ πŸ¦‹