#include "mysql/MySql.bi"
Dim conn as MySql ptr
Dim res As MYSQL_RES Ptr
Dim row as MYSQL_ROW
conn = mysql_init(null)
If conn = null Then
Debug.Print "初始化失败"
Exit sub
End If
if mysql_real_connect(conn ,"localhost" ,"root" ,"usbw" ,"test" ,3307 ,"" ,0) = NULL Then
Debug.Print "连接失败"
Exit sub
End If
if mysql_query(conn ,"show tables") <> 0 Then
Debug.Print *mysql_error(conn)
End If
res = mysql_use_result(conn)
If res = NULL Then
Debug.Print *mysql_error(conn)
End If
''Debug.Print mysql_num_rows(res)
Do
row = mysql_fetch_row(res)
If row = NULL Then Exit Do
Dim s as ZString Ptr ptr = row
Debug.Print s[0][0]
Loop
mysql_free_result(res)
mysql_close(conn)