mysql-d 0.2.0
Mysql client C library binding.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Mysql.d
mysql library binding. Extraction from https://github.com/adamdruppe/arsd
Documentation is not ready yet
import std.stdio;
import mysql.d;
void main() {
auto mysql = new Mysql("localhost", "root", "root", "mysql_d_testing");
mysql.query("DROP TABLE IF EXISTS users");
mysql.query("CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
sex tinyint(1) DEFAULT NULL,
birthdate DATE,
PRIMARY KEY (id)
);");
mysql.query("insert into users (name, sex, birthdate) values (?, ?, ?);", "Paul", 1, "1981-05-06");
mysql.query("insert into users (name, sex, birthdate) values (?, ?, ?);", "Anna", 0, "1983-02-13");
auto rows = mysql.query("select * from users");
rows.length; // => 2
foreach (user; rows) {
writefln("User %s, %s, born on %s", user["name"], user["sex"] == "1" ? "male" : "female", user["birthdate"]);
}
}
Output is:
User Paul, male, born on 1981-05-06
User Anna, female, born on 1983-02-13
Compiling
- Install dub with
brew install dub
or from here http://code.dlang.org/download - Run
dub
Testing
- run
dub test
Example application
- Registered by Pavel Evstigneev
- 0.2.0 released 10 years ago
- paxa/mysql.d
- MIT
- Copyright © 2014, Pavel
- Authors:
- Dependencies:
- dunit
- System dependencies:
- mysqlclient
- Versions:
-
0.3.3 2016-Jul-28 0.3.2 2015-Sep-03 0.3.1 2015-Jan-10 0.3.0 2014-Aug-31 0.2.0 2014-Jul-01 - Download Stats:
-
-
2 downloads today
-
2 downloads this week
-
8 downloads this month
-
11482 downloads total
-
- Score:
- 2.0
- Short URL:
- mysql-d.dub.pm