mysql_real_query(3)

πŸ“¦
version 13.0.2 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– Name πŸ’–

okay so bestie, this is mysql_real_query(3) β€” MariaDB Connector/C edition, and she's here to execute a statement on the database server. Binary safe, no cap. πŸ’…


✨ Synopsis ✨

              #include <mysql.h>

              int mysql_real_query(MYSQL * mysql,
                                   const char * query,
                                   unsigned long length);

🌸 Description 🌸

mysql_real_query() is the binary safe function for performing a statement on the database server. It's giving "I can handle your query, bestie" energy. πŸ’–


πŸŽ€ Parameter πŸŽ€

  • mysql β€” a mysql handle, which was previously allocated by mysql_init(3) and connected by mysql_real_connect(3). Like, she needs to be initialized and connected first, periodt.
  • query β€” a string containing the statement to be performed. Your actual query goes here, and it's literally the main character.
  • length β€” length of the string. Yes, you have to tell her how long query is. Slay.

πŸ¦‹ Notes πŸ¦‹

  • Contrary to the mysql_query(3) function, mysql_real_query is binary safe. That's the whole point, bestie β€” she doesn't flinch at binary data. πŸ’…
  • To determine if mysql_real_query returns a result set use the mysql_num_fields(3) function. So if you're wondering "did I get a result set or not?", mysql_num_fields(3) is your girl. 🫢

πŸ’… Return value πŸ’…

Returns zero on success, otherwise non zero. So zero = she ate, non zero = something's off. πŸ‘‘


πŸ‘‘ See also πŸ‘‘


okay that's the whole vibe, bestie. MariaDB Connector/C, Version 3.4, mysql_real_query(3) β€” she's iconic, she's binary safe, and she's out. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ‘‘πŸŒˆβ­

πŸ“¦ where this page comes from