Skip to content

Commit 5410e56

Browse files
committed
update files 2019年 5月17日 星期五 18时02分08秒 CST
1 parent 3ed31b5 commit 5410e56

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

errors.md

+8
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,17 @@ after all.
123123
You should only run into this error when you're using `QueryRow()`. If you
124124
encounter this error elsewhere, you're doing something wrong.
125125

126+
您应该只在使用 `QueryRow()` 时遇到此错误。如果你在其他地方遇到这个错误,你做错了什么。
127+
126128
Identifying Specific Database Errors
127129
====================================
128130

131+
识别特定的数据库错误
132+
129133
It can be tempting to write code like the following:
130134

135+
编写如下代码很有诱惑力:
136+
131137
<pre class="prettyprint lang-go">
132138
rows, err := db.Query("SELECT someval FROM sometable")
133139
// err contains:
@@ -141,6 +147,8 @@ This is not the best way to do it, though. For example, the string value might
141147
vary depending on what language the server uses to send error messages. It's
142148
much better to compare error numbers to identify what a specific error is.
143149

150+
但这并不是最好的方法。例如,字符串值可能会有所不同,具体取决于服务器用于发送错误消息的语言。比较错误号以识别特定错误是更好的。
151+
144152
The mechanism to do this varies between drivers, however, because this isn't
145153
part of `database/sql` itself. In the MySQL driver that this tutorial focuses
146154
on, you could write the following code:

0 commit comments

Comments
 (0)