mko Posted July 4, 2009 Share Posted July 4, 2009 (edited) Hi togetherSeems there is a Bug in ODBC 3.5.1 with mysql.au3Environmet: odbc 3.5.1, mysql 5.1.14, 5.1.31 This runs fine...$SQLCode = "SELECT count(b.eingang) AS anz FROM berechnet b" $TableContents = _Query($SQLInstance,$SQLCode) MsgBox(0,"",$TableContents.Fields("anz").value ) If i want to use Mysql SUM function i got an error$SQLCode = "SELECT sum(b.eingang) AS anz FROM berechnet b" $TableContents = _Query($SQLInstance,$SQLCode) MsgBox(0,"",$TableContents.Fields("anz").value )MsgBox(0,"",$TableContents.Fields("anz").value )MsgBox(0,"",$TableContents.Fields("anz").value ^ ERROR Functions which seems to be OK:count, min, max, std, variance Functions which are not workingsum, avgI have changened now to MYSQL ODBC 5.1Installing Mysql ODBC 5.1Copy mysql.au3 to mysql51.au3Edit in Mysql51.au3 first Function declaration toFunc _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 5.1 Driver}", $iPort=3306) Change include in mainprogram to mysql51.au3 Now Select with Mysql Functions like sum and avg are running fine Edited July 4, 2009 by mko Link to comment Share on other sites More sharing options...
blitzkrg Posted September 26, 2009 Share Posted September 26, 2009 Hopefully someone can help me with this. All the functions work for me except the query function. if i want a list of db's it works. or to get a list of table names.. that works. so i know my connection data is right and i've verified my queries are valid. yet every single time, i get an error returned and i cant figure out why.. here is the function from mysql.au3 Func _Query($oConnectionObj, $sQuery) If IsObj($oConnectionObj) Then Return $oConnectionobj.execute ($sQuery) EndIf If @error Then SetError(1) Return 0 EndIf EndFunc ;==>_Query and here is a simple query that returns an error (error 1) $var = _Query($sql,"SELECT * FROM users") Any ideas? Link to comment Share on other sites More sharing options...
Negat1ve Posted October 2, 2009 Share Posted October 2, 2009 Oh god !!!! This is AWESOME WORK ! On of best when i even saw ! VERY BIG THANKS =)))))))) Link to comment Share on other sites More sharing options...
blitzkrg Posted October 5, 2009 Share Posted October 5, 2009 Oh god !!!! This is AWESOME WORK ! On of best when i even saw ! VERY BIG THANKS =))))))))does your _query function work? if so what o/s are you running and what version of autoit?thanks Link to comment Share on other sites More sharing options...
ilReverendli Posted October 16, 2009 Share Posted October 16, 2009 124 views and only one reply... anyone got some ideas on what else i should add or any other feedback?cdkid, Thanks man for posting this UDF, this thing rocks, its opening up new ideas. I have one request as for feedback however. I consider myself a noob at this still, even though I have made some pretty slick tools with autoit (Provisioning system) and since I am pretty much teaching myself as I go along, It would be extremely helpful if of you could go alittle deeper into the "_query" command, perhaps line by line comment, explaining what its doing. - I know that's alot to ask for but if you have the time, It would be much appreciated.Thanks again dude.-Dave Link to comment Share on other sites More sharing options...
MrMitchell Posted October 18, 2009 Share Posted October 18, 2009 Hopefully someone can help me with this. All the functions work for me except the query function. if i want a list of db's it works. or to get a list of table names.. that works. so i know my connection data is right and i've verified my queries are valid. yet every single time, i get an error returned and i cant figure out why.. here is the function from mysql.au3 Func _Query($oConnectionObj, $sQuery) If IsObj($oConnectionObj) Then Return $oConnectionobj.execute ($sQuery) EndIf If @error Then SetError(1) Return 0 EndIf EndFunc ;==>_Query and here is a simple query that returns an error (error 1) $var = _Query($sql,"SELECT * FROM users") Any ideas? I had the same problem...did some tweaking and finally got it working. As far as I could tell there are two options for output, either a string or an array. Both worked for me but I decided to go with the string route. I had to modify one of the functions in the MySQL.au3 UDF, then add another. The code is messy right now and even though I got it working, I am still having trouble figuring out how exactly. I'll try to clean it up some more then get it posted. It involves using the GetString (for string) or GetRows (for array) method against an ADODB.RecordSet. You open the connection then use one of those methods to dump the data into either a string or an array. My version isn't very versatile, but it gets the job done...for the most part. Link to comment Share on other sites More sharing options...
panlatv Posted November 15, 2009 Share Posted November 15, 2009 (edited) Hopefully someone can help me with this. All the functions work for me except the query function. if i want a list of db's it works. or to get a list of table names.. that works. so i know my connection data is right and i've verified my queries are valid. yet every single time, i get an error returned and i cant figure out why.. here is the function from mysql.au3 Func _Query($oConnectionObj, $sQuery) If IsObj($oConnectionObj) Then Return $oConnectionobj.execute ($sQuery) EndIf If @error Then SetError(1) Return 0 EndIf EndFunc ;==>_Query and here is a simple query that returns an error (error 1) $var = _Query($sql,"SELECT * FROM users") Any ideas? I'm not sure, but, if i do this: $sql = _MySQLConnect(...) $var=1 dim $namecol[2] $namecol[0]="actived" $namecol[1]="" dim $varcol[2] $varcol[0]=$var $varcol[1]="" _AddRecord($sql, 'tabledb', $namecol, $varcol) _MySQLEnd($sql) that returns an error ( it's the same if i add "$var" or chr(34)&$var&chr(34) ) But if i do this (add string function): $sql = _MySQLConnect(...) $var=1 dim $namecol[2] $namecol[0]="actived" $namecol[1]="" dim $varcol[2] $varcol[0]=String($var) $varcol[1]="" _AddRecord($sql, 'tabledb', $namecol, $varcol) _MySQLEnd($sql) It's ok. (my column is a int) Edited November 15, 2009 by panlatv Link to comment Share on other sites More sharing options...
lexty Posted December 2, 2009 Share Posted December 2, 2009 (edited) Im getting this error, will you please help me. TIA!Happened when Im trying to add values to an existing tabledim $values[5]$values[0] = "col1"$values[1] = "col2"$values[2] = "col3"$values[3] = "col4"$values[4] = "";make sure u have one extra blank element$sql = _MySQLConnect("root", "password", "perfdb", "localhost")_AddRecord($sql, 'mytable', $values, $values) ;this executes a query ("INSERT INTO mytable (col1, col2, col3, col4) VALUE (col1, col2, col3, col4);which adds a record where col1, col2, col3, and col4 have the value "col1", "col2" etc;that executes a MySQL query ("DELETE FROM mytable WHERE username = 'user'_MySQLEnd($sql)ERROR Message:C:\Program Files\AutoIt3\Include\mysql.au3 (132) : ==> The requested action with this object has failed.:$oconnectionobj.execute ($query)$oconnectionobj.execute ($query)^ ERROR Edited December 2, 2009 by lexty Link to comment Share on other sites More sharing options...
blitzkrg Posted December 14, 2009 Share Posted December 14, 2009 Im getting this error, will you please help me. TIA!I can't even get a simply query to work.we need someone to make a new udf Link to comment Share on other sites More sharing options...
ProgAndy Posted December 14, 2009 Share Posted December 14, 2009 I can't even get a simply query to work.we need someone to make a new udf Then try this: LibMySQL for AutoIt *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
yehia Posted December 23, 2009 Share Posted December 23, 2009 (edited) how can i get the result for query as "select now()" Edited December 23, 2009 by yehia My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
yehia Posted December 23, 2009 Share Posted December 23, 2009 ok just found it if anyone is running through this use .Fields(0).Value My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
hmobron Posted January 4, 2010 Share Posted January 4, 2010 (edited) Hello Guy's, I have a question about the error trapping. I can make succefuly a connection, only when the wrong username/password is provided, the script is stopped whit a error here: $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort) Error: \mysql.au3 (27) : ==> The requested action with this object has failed.: How to trap this and popup a msgbox Wrong username/password Thanks inadvanced, Hans fixed whit $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) $g_eventerror = 1 ; something to check for when this function returns Endfunc Edited January 5, 2010 by hmobron Link to comment Share on other sites More sharing options...
EndFunc Posted January 6, 2010 Share Posted January 6, 2010 Anybody know why this won't work? Error in expression.:$Result = .Fields('user_id').Value$Result = .Fields('user_id')^ ERRORI always get that or either the object failed message. I don't get an error on the connection but when I try to get the result is when I get an error. Any ideas? EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 11, 2010 Share Posted February 11, 2010 (edited) I have similar issue as some other people are reporting. Im getting this error when only try to execute a test command to the database. "SELECT * FROM USERS" >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\sy019852\Desktop\New Text document.au3" C:\Program Files\AutoIt3\Include\mysql.au3 (49) : ==> The requested action with this object has failed.: $odido = $oConnectionobj.execute($sQuery) $odido = $oConnectionobj.execute($sQuery)^ ERROR >Exit code: 1 Time: 3.634 I confirmed the connection is working fine as the _CountTables works just fine. I've searched the forum also and found people with the same problem but nothing to resolve it. Edited February 11, 2010 by Steveiwonder They call me MrRegExpMan Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 12, 2010 Share Posted February 12, 2010 Noone managed to find a solution to this issue? They call me MrRegExpMan Link to comment Share on other sites More sharing options...
boy233 Posted February 12, 2010 Share Posted February 12, 2010 I managed to select, update, delete and insert using MySQL connection! Connection Sybase anyone know? I'm not managing to do .. Can anyone help make a simple connection? Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 19, 2010 Share Posted February 19, 2010 Some nerd want to pick this back up? wtb support :S They call me MrRegExpMan Link to comment Share on other sites More sharing options...
zackrspv Posted February 20, 2010 Share Posted February 20, 2010 Some nerd want to pick this back up? wtb support :Sit's by far easier and more reliable to use the libmysql UDF instead of this one. with libmysql, and the proper calls, you do not have to worry if the system has any ADO/DAO issues, as the dll handles it all. It's also quite quick. -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ†ƒë@®, wï†høµ††ïmë, @ñd wï†høµ†@ †ïmïdï†ÿ ƒø® !ïƒë. €×阮ñø†, bµ†ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ††hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
ionut Posted July 8, 2010 Share Posted July 8, 2010 Hello, Can you suggest me the fastest way of exporting large csv files to MySQL using these UDFs? I have thought of 2 solutions: 1. export the content of .csv to arrays and then use _MySQLAddRecord to add the arrays into the db; I am afraid it will take a long time to export the values from CSV to arrrays 2. use the _MySQLExec to execute LOAD DATA INFILE directly into MySQL and just to put the headers for the csv fle into an array and use it for column names. Other suggestions would be great. I would really appreciate some examples, too. Thank you, Ionut Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now