PX_PUT_DATA_BCD(3)

πŸ’– PX_PUT_DATA_BCD(3) β€” put value into a bcd data field πŸ’–

okay so bestie, we're in section 3 of the library functions manual, and this is the glow-up guide for PX_put_data_bcd. it's giving "lowkey niche but highkey important" and i'm obsessed. let's get into it 🫢


✨ NAME ✨

PX_put_data_bcd β€” put value into a bcd data field

like. that's the whole job. put the value. into the bcd data field. iconic behaviour honestly πŸ’…


🌸 SYNOPSIS 🌸

#include <paradox.h>

void PX_put_data_bcd(pxdoc_t *pxdoc, char *data, int len, char *value)

no cap, that's the whole signature. she takes pxdoc, data, len and value, and she returns absolutely nothing because she's a void girlie and she's at peace with that ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she do? she converts a bcd string into a value for a data field, exactly the way it's stored in the database file. that's the vibe. that's the mission. periodt πŸ’œ

the string may only contain these characters, no others, i'm so serious:

  • +
  • -
  • 0-9
  • .
🚨 bestie listen. ONLY those. anything else and you're on your own. don't test her.

and here's the part that matters: you should use this function instead of accessing the record data directly. i know, i know, poking at the raw record data feels very main character of you, but no. use the function. trust the process. it's giving "i know better than you and also i love you" 😭

now, data points to the start of the data field in the record. and this is the bit everyone gets wrong, so let's say it slowly πŸŽ€

it must be calculated by summing up all field length before the field to operate on, and adding it to the base pointer of the record.

fr fr. sum up every field length that comes before the field you're operating on, then add that to the base pointer of the record, and that is your data. it's giving math homework but make it database πŸ’€


🌈 SEE ALSO 🌈

she doesn't run alone, she runs with the whole squad:

collect them all, they're the set πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

this manual page was written by Uwe Steinmann uwe@steinmann.cx. thank you for your service king, we appreciate you 🫢✨


and that's the whole page bestie, tysm for reading πŸ’…πŸŒΈ this lil love letter to the PX_put_data_bcd page lives in the Library Functions Manual and its name is, of course, PX_PUT_DATA_BCD(3) β€” go forth and bcd responsibly πŸ¦‹πŸ’œπŸŽ€