Jump to content

mysql selesct with EzMySql_Dll.au3 help


Recommended Posts

hi friends i'm trying to read some data just entered from a mysql database, using this code, but

Local $sMySqlStatement = "SELECT * FROM fxe_option WHERE ID=160 ;"
                        ConsoleWrite($sMySqlStatement & @CRLF)
                        If Not _EzMySql_Exec($sMySqlStatement) Then
                            MsgBox(0, "Error inserting data to Table", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
                            Exit
                        Else
                            For $i = 1 To _EzMySql_Rows() Step 1
                                $a1Row = _EzMySql_FetchData()
                                _ArrayDisplay($a1Row, "Result: " & $i)
                            Next
                        EndIf
                        MsgBox(0, 'DE', $sMySqlStatement)

not read and script  go in stop and not return error   anyone  

SELECT * FROM fxe_option WHERE ID=160 ;
!>10:47:19 AutoIt3.exe ended.rc:-1073741819

does anyone know how I can do to get more details of the error in question is there a log somewhere?

thank you

 

Link to post
Share on other sites
Posted (edited)
Quote

 

; Name...........: _EzMySql_Exec
; Description ...: Executes a MySql query. Can be multi line . does not handle result
 

;                    1 - A MySQL struct does not exist
;                    2 - Dll Query Call failed
;                    3 - Database error - check _EzMySql_ErrMsg() for error
;                    4 - Dll Store result call failed
;                    5 - Empty $querystring parameter passed to function

 


 

_EzMYSql_Query() instead?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to post
Share on other sites
If Not _EzMYSql_Query($sMySqlStatement) Then
    MsgBox(0, "Error inserting data to Table", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
Else
    For $i = 1 To _EzMySql_Rows() Step 1
        $a1Row = _EzMySql_FetchData()
        _ArrayDisplay($a1Row, "Result: " & $i)
    Next
EndIf

just replace your _EzMySql_Exec with _EzMYSql_Query

 

Full example with no autoit crash that worked on my db (change username, pass, db, and port if testing with it)

#include <Array.au3>
#include "EzMySql.au3"
#include <String.au3>
#include <Date.au3>
If Not _EzMySql_Startup() Then Exit MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
If Not _EzMySql_Open("192.168.1.1", "remote", "remotepass", "test", "3306") Then _sqlRetryToRecconect(_EzMySql_ErrMsg(), @error)

Local $sMySqlStatement = "SELECT * FROM fxe_option WHERE ID=160"
ConsoleWrite($sMySqlStatement & @CRLF)
If Not _EzMYSql_Query($sMySqlStatement) Then
    MsgBox(0, "Error reading data from Table", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
Else
    For $i = 1 To _EzMySql_Rows() Step 1
        $a1Row = _EzMySql_FetchData()
        _ArrayDisplay($a1Row, "Result: " & $i)
    Next
EndIf
MsgBox(0, 'DE', $sMySqlStatement)

Func _sqlRetryToRecconect($sqlerror1, $error = "")
    Do
        ConsoleWrite("!> " & _NowCalc() & "--> SQL Connection problem (error:" & $error & " '" & _EzMySql_ErrMsg() & "'), will retry in 5 seconds!" & @CRLF)
        Sleep(5000)
        _EzMySql_Close()
        _EzMySql_Startup()
    Until _EzMySql_Open("192.168.1.1", "remote", "remotepass", "test", "3306")
    ConsoleWrite(">+ " & _NowCalc() & "--> Connected." & @CRLF)
EndFunc   ;==>_sqlRetryToRecconect

 

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...