From 000e5de7ba8ea296b0b00a9d504548ce3c5055e5 Mon Sep 17 00:00:00 2001 From: Anchor Date: Wed, 17 Sep 2014 10:46:50 -0700 Subject: [PATCH] Fix grammar and typos for 05.2.md --- en/eBook/05.2.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/en/eBook/05.2.md b/en/eBook/05.2.md index 1ca94d7c..31a62247 100644 --- a/en/eBook/05.2.md +++ b/en/eBook/05.2.md @@ -1,24 +1,24 @@ # 5.2 MySQL -The framework call LAMP is very popular on the internet in recent years, and the M is the MySQL. MySQL is famous by its open source, easy to use, so it becomes the database in the back-end of many websites. +The LAMP stack has been very popular on the internet in recent years, and the M in LAMP stand for MySQL. MySQL is famous because it's open source and easy to use. As such, it became the defacto database in the back-ends of many websites. ## MySQL drivers -There are couple of drivers that support MySQL in Go, some of them implemented `database/sql` interface, and some of them use their only interface standards. +There are a couple of drivers that support MySQL in Go. Some of them implement the `database/sql` interface, and others use their own interface standards. -- [https://github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) supports `database/sql`, pure Go code. -- [https://github.com/ziutek/mymysql](https://github.com/ziutek/mymysql) supports `database/sql` and user defined interface, pure Go code. -- [https://github.com/Philio/GoMySQL](https://github.com/Philio/GoMySQL) only supports user defined interface, pure Go code. +- [https://github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) supports `database/sql`, written in pure Go. +- [https://github.com/ziutek/mymysql](https://github.com/ziutek/mymysql) supports `database/sql` and user defined interfaces, written in pure Go. +- [https://github.com/Philio/GoMySQL](https://github.com/Philio/GoMySQL) only supports user defined interfaces, written in pure Go. -I'll use the first driver in my future examples(I use this one in my projects also), and I recommend you to use this one for following reasons: +I'll use the first driver in the following examples (I use this one in my personal projects too), and I also recommend that you use it for the following reasons: - It's a new database driver and supports more features. -- Fully support `databse/sql` interface standards. -- Support keepalive, long connection with thread-safe. +- Fully supports `databse/sql` interface standards. +- Supports keepalive, long connections with thread-safety. ## Samples -In following sections, I'll use same database table structure for different databases, the create SQL as follows: +In the following sections, I'll use the same database table structure for different databases, then create SQL as follows: CREATE TABLE `userinfo` ( `uid` INT(10) NOT NULL AUTO_INCREMENT, @@ -28,7 +28,7 @@ In following sections, I'll use same database table structure for different data PRIMARY KEY (`uid`) ); -The following example shows how to operate database based on `database/sql` interface standards. +The following example shows how to operate on a database based on the `database/sql` interface standards. package main @@ -104,20 +104,20 @@ The following example shows how to operate database based on `database/sql` inte } } -Let me explain few important functions: +Let me explain a few of the important functions here: -- `sql.Open()` opens a registered database driver, here the Go-MySQL-Driver registered mysql driver. The second argument is DSN(Data Source Name) that defines information of database connection, it supports following formats: +- `sql.Open()` opens a registered database driver. The Go-MySQL-Driver registered the mysql driver here. The second argument is the DSN (Data Source Name) that defines information pertaining to the database connection. It supports following formats: user@unix(/path/to/socket)/dbname?charset=utf8 user:password@tcp(localhost:5555)/dbname?charset=utf8 user:password@/dbname user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname -- `db.Prepare()` returns SQL operation that is going to execute, also returns execute status after executed SQL. -- `db.Query()` executes SQL and returns Rows result. -- `stmt.Exec()` executes SQL that is prepared in Stmt. +- `db.Prepare()` returns a SQL operation that is going to be executed. It also returns the execution status after executing SQL. +- `db.Query()` executes SQL and returns a Rows result. +- `stmt.Exec()` executes SQL that has been prepared and stored in Stmt. -Note that we use format `=?` to pass arguments, it is for preventing SQL injection. +Note that we use the format `=?` to pass arguments. This is necessary for preventing SQL injection attacks. ## Links