Jump to content

Recommended Posts

Posted

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

Posted (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 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

Posted

@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 ?

[font="Lucida Sans Unicode"]M a k. a v e L ![/font]

Posted

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")

Posted (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 by ghetek
Posted (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 by M a k a v e l !

[font="Lucida Sans Unicode"]M a k. a v e L ![/font]

Posted

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

Posted

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]

  • 4 weeks later...
Posted

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)

Posted (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 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

  • 2 months later...
Posted

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

Posted

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 :party: Just need the 1 file, btw :idea:

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

  • 6 months later...
Posted

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ë 맧ëñ§ë øƒ !ïƒë.

Posted

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

Posted

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ë 맧ëñ§ë øƒ !ïƒë.

Posted

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

Posted

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ë 맧ëñ§ë øƒ !ïƒë.

Posted

@ProgAndy

I'm having a problem to download ur UDF, it say the link is broken. U hv any working link? TQ

I'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

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
×
×
  • Create New...