本帖最后由 l4ever 于 2014-3-27 14:07 编辑
写了执行mysql的函数,测试了一下,2500条数据需要8秒才能跑完
去掉_Array2D_Add,把结果写到文本里面会快很多.最多两秒搞定.......
有什么更好的方法呢?
Func _MysqlQuery($sql,$type ="0")
Local $hTimer = TimerInit()
_Writelog("信息", "Mysql查询开始")
If Not _EzMySql_Query($sql) Then
_Writelog("错误", "#" & @error & " 详情:" & _EzMySql_ErrMsg())
Return
EndIf
$rows = _EzMySql_Rows()
$Cols = _EzMySql_Columns()
$ColName = _EzMySql_FetchNames()
if $type = 0 Then
return $rows
Else
Local $dataArr[1][$Cols]
For $i= 1 To $rows
$data = _EzMySql_FetchData()
_Array2D_Add($dataArr, $data)
Next
msgbox(32,"", "Mysql查询完毕,耗时:" & Round(TimerDiff($hTimer)/1000,2)& "秒")
_Array2D_Delete($dataArr,0)
return $dataArr
EndIf
EndFunc
|