On Saturday, 3 March 2018 at 07:37:38 UTC, Nick Sabalausky
(Abscissa) wrote:
An all-D MySQL/MariaDB client library:
https://github.com/mysql-d/mysql-native
==========================================
Tagged 'v2.1.0', which mainly adds a few new features,
including greatly simplified shortcut syntax for prepared
statements (with automatic, implicit caching and re-use):
---
int i = 5;
string s = "Hello world";
conn.exec("INSERT INTO table_name VALUES (?, ?)", i, s);
conn.query("SELECT * FROM table_name WHERE id=? AND name=?", i,
s);
// Also works:
Prepared stmt = conn.prepare("INSERT ...blah... (?, ?)");
conn.exec(stmt, i, s);
---
As well as additional tools for optional micro-management of
registering/releasing prepared statements.
It also fixes #28: "MYXProtocol thrown when using large
integers as prepared parameters."
Full changelog
https://github.com/mysql-d/mysql-native/blob/master/CHANGELOG.md#v210---2018-03-02
I'm unsure how I'd go about implementing prepared statements in a
vibe.d application correctly.
With older versions it didn't work properly and I'm not sure how
to implement it with the new version of prepared statements.
I can't seem to find any examples on how they were updated and
what exactly to change in my code.
It would be nice with some more examples that aren't basics.
Especially, because I call setArgs() to set arguments from an
array since I have no control over the arguments passed to the
function as they're generated elsewhere and thus I cannot
manually specify the arguments.
I guess I will try to dig around and see what works and what
doesn't, unless you can pinpoint me in the correct direction.