Skip to content

Commit c553c7a

Browse files
authored
Merge pull request #266 from schveiguy/newreadme
Update links to generated docs.
2 parents 598c444 + 30b582c commit c553c7a

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,29 @@ See also:
3939
API
4040
---
4141

42-
*NOTE: the most recent release of mysql-native has been updated to be usable from `@safe` code, using the `mysql.safe` package. This document is still relevant, as the default is to use the unsafe API. Please see the [safe migration document](SAFE_MIGRATION.md) for more details*
42+
*NOTE: the most recent release of mysql-native has been updated to be usable from `@safe` code, using the `mysql.safe` package. Please see the [safe migration document](SAFE_MIGRATION.md) for more details*
4343

4444
[API Reference](https://mysql-d.github.io/mysql-native/)
4545

46-
The primary interfaces:
47-
- [Connection](https://mysql-d.github.io/mysql-native/mysql/connection/Connection.html): Connection to the server, and querying and setting of server parameters.
48-
- [MySQLPool](https://mysql-d.github.io/mysql-native/mysql/pool/MySQLPool.html): Connection pool, for Vibe.d users.
49-
- [exec()](https://mysql-d.github.io/mysql-native/mysql/commands/exec.html): Plain old SQL statement that does NOT return rows (like INSERT/UPDATE/CREATE/etc), returns number of rows affected
50-
- [query()](https://mysql-d.github.io/mysql-native/mysql/commands/query.html): Execute an SQL statement that DOES return rows (ie, SELECT) and handle the rows one at a time, as an input range.
51-
- [queryRow()](https://mysql-d.github.io/mysql-native/mysql/commands/queryRow.html): Execute an SQL statement and get the first row.
52-
- [queryValue()](https://mysql-d.github.io/mysql-native/mysql/commands/queryValue.html): Execute an SQL statement and get the first value in the first row.
53-
- [prepare()](https://mysql-d.github.io/mysql-native/mysql/connection/prepare.html): Create a prepared statement
54-
- [Prepared](https://mysql-d.github.io/mysql-native/mysql/prepared/Prepared.html): A prepared statement, optionally pass it to the exec/query function in place of an SQL string.
55-
- [Row](https://mysql-d.github.io/mysql-native/mysql/result/Row.html): One "row" of results, used much like an array of Variant.
56-
- [ResultRange](https://mysql-d.github.io/mysql-native/mysql/result/ResultRange.html): An input range of rows. Convert to random access with [std.array.array()](https://dlang.org/phobos/std_array.html#.array).
46+
The primary interfaces (all these are the safe versions):
47+
- [Connection](https://mysql-d.github.io/mysql-native/mysql/impl/connection/Connection.html): Connection to the server, and querying and setting of server parameters.
48+
- [MySQLPool](https://mysql-d.github.io/mysql-native/mysql/impl/pool/MySQLPoolImpl.html): Connection pool, for Vibe.d users.
49+
- [exec()](https://mysql-d.github.io/mysql-native/mysql/safe/commands/exec.html): Plain old SQL statement that does NOT return rows (like INSERT/UPDATE/CREATE/etc), returns number of rows affected
50+
- [query()](https://mysql-d.github.io/mysql-native/mysql/safe/commands/query.html): Execute an SQL statement that DOES return rows (ie, SELECT) and handle the rows one at a time, as an input range.
51+
- [queryRow()](https://mysql-d.github.io/mysql-native/mysql/safe/commands/queryRow.html): Execute an SQL statement and get the first row.
52+
- [queryValue()](https://mysql-d.github.io/mysql-native/mysql/safe/commands/queryValue.html): Execute an SQL statement and get the first value in the first row.
53+
- [prepare()](https://mysql-d.github.io/mysql-native/mysql/safe/connection/prepare.html): Create a prepared statement
54+
- [Prepared](https://mysql-d.github.io/mysql-native/mysql/impl/prepared/SafePrepared.html): A prepared statement, optionally pass it to the exec/query function in place of an SQL string.
55+
- [Row](https://mysql-d.github.io/mysql-native/mysql/impl/result/SafeRow.html): One "row" of results, used much like an array of Variant.
56+
- [ResultRange](https://mysql-d.github.io/mysql-native/mysql/impl/result/SafeResultRange.html): An input range of rows. Convert to random access with [std.array.array()](https://dlang.org/phobos/std_array.html#.array).
5757

5858
Also note the [MySQL <-> D type mappings tables](https://mysql-d.github.io/mysql-native/mysql.html)
5959

6060
Basic example
6161
-------------
6262
```d
6363
import std.array : array;
64-
import std.variant;
65-
import mysql;
64+
import mysql.safe; // Please use the safe api, it's the future
6665
6766
void main(string[] args)
6867
{
@@ -80,8 +79,8 @@ void main(string[] args)
8079
// Query
8180
ResultRange range = conn.query("SELECT * FROM `tablename`");
8281
Row row = range.front;
83-
Variant id = row[0];
84-
Variant name = row[1];
82+
MySQLVal id = row[0];
83+
MySQLVal name = row[1];
8584
assert(id == 1);
8685
assert(name == "Ann");
8786
@@ -115,7 +114,7 @@ void main(string[] args)
115114
"INSERT INTO `tablename` (`id`, `name`) VALUES (?,?)",
116115
null, "Cam"); // Can also take Nullable!T
117116
range = conn.query("SELECT * FROM `tablename` WHERE `name`='Cam'");
118-
assert( range.front[0].type == typeid(typeof(null)) );
117+
assert( range.front[0].kind == MySQLVal.Kind.Null );
119118
}
120119
```
121120

0 commit comments

Comments
 (0)