Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data
- Imports MySql.Data
- Imports MySql.Data.MySqlClient
- Module Module1
- Public cmd As MySqlCommand
- Sub main()
- StartTesting()
- End Sub
- Private Function StartTesting() As Boolean
- Dim value(8) As String
- Try
- set_database_mysql("127.0.0.1", "DemonstracaoFramework", "root", "YES")
- value = select_query("select * from ctinserirloginparaautenticacao where Status = 'Passed' && executed = 'no'")
- Dim Id = value(0)
- Dim testId = value(1)
- Dim Status = value(2)
- Dim result = value(3)
- Dim expectedResult = value(4)
- Dim login = value(5)
- Dim password = value(6)
- Dim path = value(7)
- Dim versao = value(8)
- Dim executed = value(9)
- Return True
- Catch ex As Exception
- 'falha
- Return False
- End Try
- End Function
- Public Function select_query(query As String)
- set_database_mysql("127.0.0.1", "DemonstracaoFramework", "root", "123456za")
- cmd.CommandText = query
- Dim readerr As MySqlDataReader
- Try
- readerr = cmd.ExecuteReader()
- readerr.Read()
- Dim value(4) As String
- value(0) = reader(readerr, "Id")
- value(1) = reader(readerr, "testId")
- value(2) = reader(readerr, "Status")
- value(3) = reader(readerr, "result")
- value(4) = reader(readerr, "expectedResult")
- Return value
- Return Nothing
- Catch ex As Exception
- 'falha
- Return Nothing
- End Try
- End Function
- '---------------------função reader----------------------
- Public Function reader(rea As MySqlDataReader, read As String) As String
- If IsDBNull(rea(read)) Then
- Return ""
- Else
- Return rea(read)
- End If
- End Function
- Public Sub UpdateStatus(query As String)
- Try
- set_database_mysql("127.0.0.1", "DemonstracaoFramework", "root", "gg1011922467")
- cmd.CommandText = query
- cmd.ExecuteReader()
- Catch ex As Exception
- 'falha
- End Try
- End Sub
- Private Sub set_database_mysql(server As String, database As String, user As String, password As String)
- 'Dim Type()
- Dim sql = ""
- Dim sqlTable = ""
- Dim sql_connect As MySqlConnection
- Dim conexaoDataSet As DataSet
- Dim cmd As MySqlCommand
- Try
- 'Type = "MySQL"
- conexaoDataSet = New DataSet()
- sql_connect = New MySqlConnection("Server=" + server + "; Database=" + database + "; Uid=" + user + "; Pwd=" + password)
- sql_connect.Open()
- cmd = New MySqlCommand(sql, sql_connect)
- Catch ex As Exception
- 'falha
- End Try
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement