jacQues Posted January 28, 2009 Share Posted January 28, 2009 Try this: For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) Switch $length=0 Case True $RowArr[$i - 1] = "" Case Else $RowArr[$i - 1] = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) EndIf NextoÝ÷ Ù.j·«mzjmÊËkx,¥u·r²Úâî¶'ßé]ÃT,¼¨ºÈhºW[y¦åzÚ+yÊ ,ÞÑÚ½ëh¶§¦èºØ¶§¥ê]j×çhÂyhißêº^ %²Û|ýVÞ$x¢¼Ûh¶·¶Ë©¦íßrzX½ì!zw^rV«xªëk(§ëh"Ö¥é^éí±ªÞzjmÊËkx,o'^}«¥µ*-çèZ0x0¢é]mçڲ׫jëh×6 For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) If $length>0 $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $RowArr[$i - 1] = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) EndIf Next jacQues Link to comment Share on other sites More sharing options...
ProgAndy Posted January 28, 2009 Author Share Posted January 28, 2009 (edited) Yeah, you are right... but switch is faster than select is faster than if //Edit: I think, i will do this: $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) Select Case $length ; if there is data $RowArr[$i - 1] = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) Case $NULLasPtr0 And Not $fieldPtr ; is NULL and Parameter return NULL as Ptr(0) is true $RowArr[$i - 1] = $NULLPTR ;~ Case Else ; Empty String or NULL as empty string ; Nothing needs to be done, since array entries are default empty string ;~ $RowArr[$i - 1] = "" EndIf Edited January 28, 2009 by ProgAndy *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...
M a k a v e l ! Posted February 2, 2009 Share Posted February 2, 2009 @ProdandyI have 2 errors while testing:ERROR: IsPtr(): undefined function.ERROR: StringToBinary(): undefined function.#include <mysql.au3> #include <array.au3>$Host, $User, $Pass, $Database and $Port are set up right.and connection error !any help ? [font="Lucida Sans Unicode"]M a k. a v e L ![/font] Link to comment Share on other sites More sharing options...
JavaScript_Freek Posted February 2, 2009 Share Posted February 2, 2009 I am guessing this only work on "localhost". I tried connecting to my server on my website and I have provided the right details but I keep getting "Cannot connect to Localhost." [center]Cookyx.com :: Simple LAN Chat[/center] Link to comment Share on other sites More sharing options...
ghetek Posted February 6, 2009 Share Posted February 6, 2009 how would i express the following code utilizing this udf?$sid=_Security__LookupAccountName(@UserName) $query="SELECT `auth`.`id` FROM `auth` WHERE (`auth`.`sid` " & _StringEncrypt(1,$sid[0],"secretpassword") & ") ORDER BY `auth`.`sid` DESC, `auth`.`id` DESC"what i am trying to do: get id value of the row where the SID value = _StringEncrypt(1,$sid[0],"secretpassword") Link to comment Share on other sites More sharing options...
ghetek Posted February 6, 2009 Share Posted February 6, 2009 (edited) I am guessing this only work on "localhost". I tried connecting to my server on my website and I have provided the right details but I keep getting "Cannot connect to Localhost."-does dbuser@0.0.0.0/0 have access privs to the database/table/field?-when working with your db remotely did you change "localhost" to "dbserver.domain.com"?-most hosting companies do not let you have remote access without first requesting it.-can you telnet (telnet dbserver.domain.com 3306) into the db server?i would just make a user with a host of % Edited February 6, 2009 by ghetek Link to comment Share on other sites More sharing options...
M a k a v e l ! Posted February 10, 2009 Share Posted February 10, 2009 (edited) @Prodandy I have 2 errors while testing: ERROR: IsPtr(): undefined function.ERROR: StringToBinary(): undefined function. #include <mysql.au3> #include <array.au3> $Host, $User, $Pass, $Database and $Port are set up right. and connection error ! any help ? For people interests: works on 3.3.0.0. Thanks @ Prodandy for this UDF no ODBC. I'm now working on some of them German-text Msgbox. (Want to know what them words are !!! ) Nice tool. Edited February 10, 2009 by M a k a v e l ! [font="Lucida Sans Unicode"]M a k. a v e L ![/font] Link to comment Share on other sites More sharing options...
seesoe Posted February 13, 2009 Share Posted February 13, 2009 i have a php code that i want to translate from php to autoit, how would i do this? $results = mysql_query("SELECT * FROM online_order WHERE status='ordering") or die(mysql_error()); $row = mysql_fetch_array( $results ); $old_item = $row['item']; $first_name = $row['first_name']; $old_items = unserialize($old_item); and display the info in a loop $old_items is now an array and $first_name is just a varchar with the users name Link to comment Share on other sites More sharing options...
M a k a v e l ! Posted February 14, 2009 Share Posted February 14, 2009 i have a php code that i want to translate from php to autoit, how would i do this? $results = mysql_query("SELECT * FROM online_order WHERE status='ordering") or die(mysql_error()); $row = mysql_fetch_array( $results ); $old_item = $row['item']; $first_name = $row['first_name']; $old_items = unserialize($old_item); and display the info in a loop $old_items is now an array and $first_name is just a varchar with the users name You should post topic in general help and/or try out the 'MySQL UDFs' from ProgAndy with your query. http://www.autoitscript.com/forum/index.php?showtopic=85617 [font="Lucida Sans Unicode"]M a k. a v e L ![/font] Link to comment Share on other sites More sharing options...
DarBro Posted March 8, 2009 Share Posted March 8, 2009 Ok I have this all working yay. But How do I do other queries like UPDATE. I see where I am supposed to put it but it seems to creash the program when I do it. (P.S. I am a newb) Link to comment Share on other sites More sharing options...
ProgAndy Posted March 8, 2009 Author Share Posted March 8, 2009 (edited) Ok I have this all working yay. But How do I do other queries like UPDATE. I see where I am supposed to put it but it seems to creash the program when I do it. (P.S. I am a newb) You should use $Query = _MySQL_Real_Query(...) If $Query = $MYSQL_SUCCESS Then; MsgBox(0,"","Success") EndIf no _MySQL_Store_Result since you don't return data. You can call _MySQL_Store_Result, but it returns 0, because there's no data to be fetched. but you mustn't call _MySQL_FetchRow or other funcs which use the return value from _MySQL_Store_Result. If they get a 0-Value as pointer they crash. Edited March 8, 2009 by ProgAndy *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...
ludics Posted May 29, 2009 Share Posted May 29, 2009 CREATE TABLE IF NOT EXISTS `Server_Sscreens` ( `SscreensID` int(11) NOT NULL AUTO_INCREMENT, `SteamID` varchar(255) NOT NULL DEFAULT '', `Ssdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `FileName` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`SscreensID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; As you can get a list of all columns in a MsgBox Example: 1|0:13132154|12:12:12|text.txt 2|0:13132154|12:12:12|text.txt 3|0:13134154|12:12:12|text.txt Link to comment Share on other sites More sharing options...
zackrspv Posted May 31, 2009 Share Posted May 31, 2009 I love this UDF With the existing issues w/ Vista x64 and OLEx64 having issues connecting with ODBC (which MS says they'll have fixed in Win7 lol), this UDF is a major life saver. Aside from that, it seems to be quite a bit faster. One issue, however, is that from time to time, the production zip for this UDF includes a libmysql that's a bit problematic. From time to time, you'll get an error about unable to close 1, 2, or 3 different threads, etc, and have to wait for windows to close the threads in order for the script/program (if you compiled it) to quit. The way to resolve this would be to go to PHP's website, download the zip for 5.2.1, use the libmysq from in there, instead of the one provide in this UDF; it resolves all the issues w/ the threads that I could have found Just need the 1 file, btw -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ 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...
zackrspv Posted December 22, 2009 Share Posted December 22, 2009 can you post an example script? There is already error checking, but the error has to be handled manually: $mysql_bool = _MySQL_Real_Query($MysqlConn, $query) If $mysql_bool = $MYSQL_SUCCESS Then MsgBox(0, '', "Query OK") Else $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) EndIf Tis a great UDF, and one i'm using for a major project (jabber/xmpp linked with our sql), however, the issue that I have is that for some users, it seems the libmysql.dll error keeps cropping up. i have tried upgrading and downgrading the libmysql.dll file, even to 6.0.0 which is a stable C connecter version, but still getting those errors. And the commands being sent to the dll are cake: DllCall("libmysql.dll", "int", "mysql_real_query", "ptr", 0x028A2760, "str", SELECT * FROM techs, ulong, 19) It may execute that function sucesfully 800 times, and them boom fail, randomly. Or it may just fail outright. One of the other issues i have is that sometimes the $rows returned is an extreme number, like 10293938, which isn't possible to do for an array in autoit. I have since put in a return row check that if it's over X amount, to specify a lower amount, but that is only a stop gap, not a fix. I did add an isPTR() check to your query functions to ensure the pointer was still active, which seemed to stop some of the failures, but they still happen, eventually. Is it possible that the connection to the server is terminating? Does libmysql have a connection handler that we can poll every now and then, and if disconnected, reconnect? It's really the only thing i can think of that would be killing the app. -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ 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...
ProgAndy Posted December 22, 2009 Author Share Posted December 22, 2009 The Library can reconnect automatically. Thereofre you have to call after each call of _NySQL_Real_Connect _MySQL_Options($pConnection, $MYSQL_OPT_RECONNECT, 1, 'int*') MYSQL_OPT_RECONNECT (argument type: my_bool *) Enable or disable automatic reconnection to the server if the connection is found to have been lost. Reconnect is off by default; this option provides a way to set reconnection behavior explicitly. PS: I know, i have left much error handling to the user. If you don't do that, null-pointers can crash the library. Maybe i will add this to the funcs. *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...
zackrspv Posted December 22, 2009 Share Posted December 22, 2009 The Library can reconnect automatically. Thereofre you have to call after each call of _NySQL_Real_Connect _MySQL_Options($pConnection, $MYSQL_OPT_RECONNECT, 1, 'int*') PS: I know, i have left much error handling to the user. If you don't do that, null-pointers can crash the library. Maybe i will add this to the funcs. If you have a quick example of that particular check, i'll add it to my release and we'll see if it is causing that issue Thanks Andy! -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ 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...
ProgAndy Posted December 23, 2009 Author Share Posted December 23, 2009 If you have a quick example of that particular check, i'll add it to my release and we'll see if it is causing that issue Thanks Andy! Just add something like this to the funcs, but be aware of the return value. Sometimes it should be an empty string, or an error code instead of zero. If Not $MySQL_ptr Then Return SetError(3,0,0) If Not $MySQL_ptr Then Return SetError(3,0,'') If Not $MySQL_ptr Then Return SetError(3,0,$CR_NULL_POINTER) Also, __MySQL_ReOrderULONGLONG should be removed now, it is not needed anymore. *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...
zackrspv Posted December 26, 2009 Share Posted December 26, 2009 Just add something like this to the funcs, but be aware of the return value. Sometimes it should be an empty string, or an error code instead of zero. If Not $MySQL_ptr Then Return SetError(3,0,0) If Not $MySQL_ptr Then Return SetError(3,0,'') If Not $MySQL_ptr Then Return SetError(3,0,$CR_NULL_POINTER) Also, __MySQL_ReOrderULONGLONG should be removed now, it is not needed anymore. Works perfectly, i added the PTR checks previously (before talking to you) and it reduced the # of checks, but i added the rest of the checks, as you outlined above, for th most of the rest of the functions, and it is working perfectly. No one has reported a crash with libmysql.dll as of the change, (i'll know more after more testing). In either case, thanks for the information, glad we resolved that buggy issue -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ 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...
slayerz Posted December 27, 2009 Share Posted December 27, 2009 @ProgAndy I'm having a problem to download ur UDF, it say the link is broken. U hv any working link? TQ AUTOIT[sup] I'm lovin' it![/sup] Link to comment Share on other sites More sharing options...
ProgAndy Posted December 27, 2009 Author Share Posted December 27, 2009 @ProgAndyI'm having a problem to download ur UDF, it say the link is broken. U hv any working link? TQI'm really sorry. It's working for me with Firefox and IE7+8 so i can not reproduce your problem. Anyways, i uploaded it to radpidshare for you. (@all: please do not download it unless you have problems with the original download, there are only 10 available downloads on rapidshare) *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...
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