mysql函数 用来查询匹配不到的数据_erlang连接mysql数据库后为什么fetch说匹配不到这个函数...
展開全部
需要注意,官方放在googlecode的測試代碼已經舊e69da5e887aa62616964757a686964616f31333337383865了,fetch接口實際上需要一個二進制list,所以是[<>]格式,而不是<>格式。
以下是增、刪、改、查操作的測試代碼:-module(mysql_test).
-export([start/0]).
start?()?->
%?連接數據庫
mysql:start_link(conn1,?"localhost",?"root",?"ybybyb",?"webgame"),
%?插入數據
Result1?=?mysql:fetch(
conn1,
[<<
"INSERT?INTO"
"????????`player`"
"????SET"
"????????`username`?????????=?'test',"
"????????`joined_datetime`??=?now(),"
"????????`logined_datetime`?=?now();"
>>]
),
io:format("Result1:?~p~n",?[Result1]),
%?查詢數據
Result2?=?mysql:fetch(conn1,?[<>]),
io:format("Result2:?~p~n",?[Result2]),
%?更新數據
Result3?=?mysql:fetch(
conn1,
[<<
"UPDATE"
"????`player`"
"SET"
"????`username`?=?'test_player'"
"where"
"????`username`?=?'test'"
>>]
),
io:format("Result3:?~p~n",?[Result3]),
%?查詢數據
Result4?=?mysql:fetch(conn1,?[<>]),
io:format("Result4:?~p~n",?[Result4]),
%?刪除數據
Result5?=?mysql:fetch(
conn1,
[<<
"DELETE?FROM?`player`?WHERE?`username`?=?'test_player'"
>>]
),
io:format("Result5:?~p~n",?[Result5]),
%?查詢數據
Result6?=?mysql:fetch(conn1,?[<>]),
io:format("Result4:?~p~n",?[Result6]),
ok.
總結
以上是生活随笔為你收集整理的mysql函数 用来查询匹配不到的数据_erlang连接mysql数据库后为什么fetch说匹配不到这个函数...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: unity 阳光插件_网络广告,阳光创信
- 下一篇: linux cmake编译源码,linu