Re: mysql-native v2.1.0-rc1: New features
On 2/25/18 2:59 AM, Nick Sabalausky (Abscissa) wrote: On 02/25/2018 02:01 AM, Suliman wrote: What about string interpolation like: conn.exec("INSERT INTO table_name VALUES ({i}, {s})"); ? Instead of: conn.exec("INSERT INTO table_name VALUES (?, ?)", i, s); The syntax is purely, 100% server-side. Mysql-native just passes the whole string, question marks and all, straight off to the server. So whatever syntax the server supports, mysql-native supports. Whatever the server doesn't, mysql-native doesn't. I've heard about a MySQL (I think) syntax like this: "INSERT INTO table_name VALUES (:i, :s)" But I haven't given it a try, and I don't know about its compatability. I've been thinking about something more like this: conn.exec("INSERT INTO table_name VALUES (", i, s, ")"); What I like about this, is that a real SQL insert can have lots of fields. Getting them all straight can be a pain in the ass, especially if you are inserting a couple somewhere. But if the SQL library rearranges this for us, so we can put the data where it should be, it would be much nicer. The one wrinkle that makes this difficult is strings that should be parameters. Are they parameters or SQL statement? I suppose you could wrap the statement strings into something, or the string values into something. String interpolation would be really useful here. e.g.: https://forum.dlang.org/post/odb9hk$2jqm$1...@digitalmars.com -Steve
Re: mysql-native v2.1.0-rc1: New features
On 02/25/2018 02:01 AM, Suliman wrote: What about string interpolation like: conn.exec("INSERT INTO table_name VALUES ({i}, {s})"); ? Instead of: conn.exec("INSERT INTO table_name VALUES (?, ?)", i, s); The syntax is purely, 100% server-side. Mysql-native just passes the whole string, question marks and all, straight off to the server. So whatever syntax the server supports, mysql-native supports. Whatever the server doesn't, mysql-native doesn't. I've heard about a MySQL (I think) syntax like this: "INSERT INTO table_name VALUES (:i, :s)" But I haven't given it a try, and I don't know about its compatability.
Re: mysql-native v2.1.0-rc1: New features
What about string interpolation like: conn.exec("INSERT INTO table_name VALUES ({i}, {s})"); ? Instead of: conn.exec("INSERT INTO table_name VALUES (?, ?)", i, s);
Re: mysql-native v2.1.0-rc1: New features
Minor second release candidate, 'v2.1.0-rc2'. Only thing this changes is to update the example in the readme to include the new simplified prepared statement interface.
Re: mysql-native v2.1.0-rc1: New features
On Friday, 23 February 2018 at 22:15:37 UTC, Nick Sabalausky (Abscissa) wrote: An all-D MySQL/MariaDB client library: https://github.com/mysql-d/mysql-native == [...] That's a very useful feature. Will simplify some code. As well as additional tools for optional micro-management of registering/releasing prepared statements. [...]