Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require ( "mysqloo" )
- function mySQLConnect ( sqlServer , sqlUsername , sqlPassword , sqlDatabase , sqlPort )
- sqlPort = sqlPort or 3306
- if ( !mySQL.hasConnection ) then
- mySQLConnection = mysqloo.connect ( sqlServer , sqlUsername , sqlPassword , sqlDatabase , sqlPort )
- mySQLConnection.onConnected = function()
- print ( "mySQL: Successfully Connected!" )
- mySQL.hasConnection = true
- end
- mySQLConnection:connect()
- mySQLConnection:wait()
- end
- end
- function mySQLQuery ( Query )
- if ( mySQL.hasConnection ) then
- if ( Query ) then
- if ( mySQLConnection:status() == 0 ) then
- print ("STATUS = 0 -- CONNECTED")
- query = mySQLConnection:query ( Query )
- query.onData = function(Q,D) print("Q2") PrintTable(D) end
- query.onSuccess = function()
- print ( "success" )
- end
- query:start()
- else
- print ( "mySQL: No Active Connection!!!" )
- end
- else
- print ( "mySQL: No Query Given!!!" )
- end
- else
- print ( "mySQL: No Active Connection!!!" )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement