Sign in to follow this  
Followers 0
ProgAndy

MySQL UDFs (without ODBC)

141 posts in this topic

#21 ·  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

Share this post


Link to post
Share on other sites



#22 ·  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

Share this post


Link to post
Share on other sites

#23 ·  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]

Share this post


Link to post
Share on other sites

#24 ·  Posted

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]

Share this post


Link to post
Share on other sites

#25 ·  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")

Share this post


Link to post
Share on other sites

#26 ·  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

Share this post


Link to post
Share on other sites

#27 ·  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]

Share this post


Link to post
Share on other sites

#28 ·  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

Share this post


Link to post
Share on other sites

#29 ·  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]

Share this post


Link to post
Share on other sites

#30 ·  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)

Share this post


Link to post
Share on other sites

#31 ·  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

Share this post


Link to post
Share on other sites

#32 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#35 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#37 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#39 ·  Posted

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

Share this post


Link to post
Share on other sites

#40 ·  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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Similar Content

    • Wicked_Caty
      DLL tutorial
      By Wicked_Caty
      I finally gave a look into DLLs and want to make use of them in Autoit.
      I know that a DLL is basically a library with some code, that can be used by several other programs at the same time to get some advantages.
      Yet, I need to know how they are properly used. Also it might be helpful to know what DLL is doing what task. Can you provide some resources?
      Thanks!
    • tarretarretarre
      miniSQL - A simple Standalone PDO-syntax-like MySQL-library with AutoitObject
      By tarretarretarre
      Now its my turn to give back to the community ( Better late than never :P)..
       
      First i want to thank progAndy for his amazing UDF which this idea came from

       
      And the AutoitObject Team (For making autoit fun again)
       

      I dont have so much to say more thant to let the project speak for itself, ive had this for a couple of months but it was "integrated" into my own "framework" but today I decided to release it because i have seen some people on the forum search for something like this.
      What libraries does this use and are they included?
      Connector/C 6.1.6 ( https://dev.mysql.com/downloads/connector/c/ ) And yes, they are included in the download so nothing has to be installed or anything

      What are the features:
      Prepared statements 32 and 64 bit environment Multiline prepared statements  Simplicity User-friendly PDO-like Syntax & Methods (http://php.net/pdo)  
      So whats the difference between this and x's Mysql UDF?
      When you are fetching your data from your database, you use your table-names to display them, like this:
      with $MySql Local $Vars = ["?", $lastname, "?", $age] .prepare("SELECT id, surname, lastname FROM users WHERE lastname = ? AND AGE > ?") .execute($Vars) Consolewrite(stringformat("Searchresult: %d Hits", .rowCount()) for $row in $oRows consolewrite("Surname: " & $row.surname & @crlf) consolewrite("Lastname: " & $row.lastname & @crlf) next endwith  
      Function-list (Yeah i might improve this when i have time)
      ; Every parameter is a default value of method _miniSQL_setDllDir(@ScriptDir); returns nothing Local Const $MySql = _miniSQL_LoadLibrary(); Returns object with methods ; Starts the library, connects to the database and returns the object $MySql.Startup($sHost, $sUser, $sPass = "", $sDatabase = "", $iPort = 0, $sUnix_socket = "", $iClient_Flag = 0); Returns TRUE if connection was succeded otherwise FALSE ; Shuts down the library and prevents any methods to be executed $MySql.Shutdown() ; The desired SQL query goes here (SELECT x FROM table) $MySql.prepare($sQuery); Returns nothing ; Used for multi-line prepared statements (See Example3 - newline prepared statements) $MySql.PrepareGlue($sQuery); Returns nothing ; Cleans any previous prepared statement of any kind $MySql.PrepareClean(); Returns nothing ; Executes a prepared statement of any kind, with or without passed arguments $MySql.execute($aVars = Null, $iExecuteStyle = $_miniSQL_ExecuteStoreResult); returns TRUE if success, otherwise FALSE ; Options for $iExecuteStyle: $_miniSQL_ExecuteStoreResult = 0 and $_miniSQL_ExecuteOnly = 1 ; Fetches previous executed prepared statement (If anything was stored "see Options for iExecuteStyle") $MySql.fetchAll($iFetchStyle = $_miniSQL_FetchObject); Returns (Depends on $iFetchStyle) ; Options for $iFetchStyle: $_miniSQL_FetchObject = 0 (Default), $_miniSQL_FetchSingleObject = 1, $_miniSQL_FetchArray = 2, $_miniSQL_FetchSingleValue = 3 ; Gives you the "lastinsertId" (The last id that was affected) $MySql.lastInsertId(); Returns the last affected id ; Counts the affected rows done by any MySQL operation (INSERT\SELECT\UPDATE\DELETE) $MySql.rowCount(); Returns how affected rows ; Use this if want to know why nothing is working (Can be used anywhere after $MySql.Startup()) $MySql.debug(); Returns nothing ; Retrives the last MysqlError set $MySql.SQLerror(); Returns error (If any) Here is some example code:
      #include <miniSQL\miniSQL.au3> ; Set default dir for our dlls (Only has to be done once) _miniSQL_setDllDir(@ScriptDir & "\miniSQL") ; Declared as CONST since we never want to accidentally change the variables original value Local Const $MySql = _miniSQL_LoadLibrary() ;Connect to database & Init library If Not $MySql.Startup("localhost", "user", "pass", "db", 3306) Then MsgBox(0, "Failed to start library", $MySql.debug()) Exit EndIf With $MySql .prepare("SELECT * FROM members") If Not .execute() Then MsgBox(0, "Failed to execute query", .sqlError()) Local $oRows = .fetchAll() ; Print how many rows got affected by latest query ConsoleWrite(StringFormat("Number of rows to display: %s", .rowCount()) & @CRLF) ; we use isObj to check if we got any result. If IsObj($oRows) Then For $row In $oRows ConsoleWrite(StringFormat("Id: %s", $row.id) & @CRLF) ConsoleWrite(StringFormat("Name: %s", $row.name) & @CRLF) ConsoleWrite(StringFormat("Bio: %s", $row.bio) & @CRLF) Next Else ConsoleWrite("No rows to show"&@CRLF) EndIf EndWith ; Use this in your app when you are done using the database $MySql.Shutdown() #include <miniSQL\miniSQL.au3> ; Set default dir for our dlls (Only has to be done once) _miniSQL_setDllDir(@ScriptDir & "\miniSQL") ; Declared as CONST since we never want to accidentally change the variables original value Local Const $MySql = _miniSQL_LoadLibrary() ;Connect to database & Init library If Not $MySql.Startup("localhost", "user", "pass", "db", 3306) Then MsgBox(0, "Failed to start library", $MySql.debug()) Exit EndIf With $MySql ; We use an array to make our query look nicer Local $vars = [":name", @UserName&Random(1,10,1)] ; Prepare our statement .prepare("UPDATE members SET name = :name WHERE 1") If Not .execute($vars) Then MsgBox(0, "Failed to execute query", .sqlError()) ; Print how many rows got affected by latest query ConsoleWrite(StringFormat("Example 1 rows affected: %s", .rowCount()) & @CRLF) EndWith ; We can also prepare like this With $MySql Local $vars = ["?", @UserName, "?", 1] ; Prepare our statement .prepare("UPDATE members SET name = ? WHERE id = ?") If Not .execute($vars) Then MsgBox(0, "Failed to execute query", .sqlError()) ; Print how many rows got affected by latest query ConsoleWrite(StringFormat("Example 2 rows affected: %s", .rowCount()) & @CRLF) EndWith ; Use this in your app when you are done using the database $MySql.Shutdown()  
      With $MySql ; We use an array to make our query look nicer Local $vars = ["?", 1] ;Line by line prepared statement .prepareClean(); .prepareGlue("SELECT *") .prepareGlue("FROM members") .prepareGlue("WHERE id = ?") If Not .execute($vars) Then MsgBox(0, "Failed to execute query", .sqlError()) ; Print how many rows got affected by latest query ConsoleWrite(StringFormat("Example 1 rows affected: %s", .rowCount()) & @CRLF) EndWith ; Use this in your app when you are done using the database $MySql.Shutdown() Some code from one of my applications at work using this UDF
      With $MySql .prepareClean() .prepareGlue("SELECT") .prepareGlue("cases.cases_dedu_casenumber,") .prepareGlue("cases.cases_created_by_ugid,") .prepareGlue("cases.cases_dedu_ftg,") .prepareGlue("cases.cases_date_created,") .prepareGlue("cases.cases_date_finished,") .prepareGlue("cases.cases_protocol_director,") .prepareGlue("cases.cases_finished_by_ugid,") .prepareGlue("IFNULL(uid1.names_name, 'none') as createdByFullname,") .prepareGlue("IFNULL(uid2.names_name, 'none') as finishedByFullname") .prepareGlue("FROM cases") .prepareGlue("LEFT JOIN names AS uid1") .prepareGlue("ON cases.cases_created_by_ugid = uid1.names_uid") .prepareGlue("LEFT JOIN names AS uid2") .prepareGlue("ON cases.cases_finished_by_ugid = uid2.names_uid") if $_App_Case_SearchFor Then .prepareGlue(StringFormat("WHERE cases_dedu_casenumber LIKE '%s'",$_App_Case_SearchFor)) .prepareGlue("ORDER BY cases.cases_date_created DESC") .prepareGlue("LIMIT 0, 30") if not .execute() then return __ThrowException(.sqlError()) Local $oRows = .fetchAll() EndWith  
       
      Git: https://gitlab.com/xdtarrexd/MiniSQL.git
      Download: Zip generated from Github
       
      Feel free to open your mind about this
    • Architerion
      Load Cell DLL Help
      By Architerion
      Hi All
      Not sure if this is the right area: I would like to create a small sub that runs a timer and uses a dll to query a USB load cell. I have had a general look at some of the resources on the forum...there is a lot...but was wondering whether someone could give me a bump in the right direction; I have linked the docs that came with the dll (5mg). Thanks for any advice.
       
      https://drive.google.com/file/d/0B-w8yhiZiUL3WkhtdE43dU8tdnc/view?usp=sharing
      https://drive.google.com/file/d/0B-w8yhiZiUL3bE12Qnh3LWVoTHM/view?usp=sharing
       
    • TheDcoder
      Help with calling a DLL
      By TheDcoder
      Hello!
      I am trying to call my first DLL function but it won't work , I am trying to call GetFinalPathNameByHandle
      $sFile = @DesktopDir & '\Test.txt' $hFile = FileOpen($sFile) $sFilePath = "" DllCall("Kernel32.dll", "STR", "GetFinalPathNameByHandle", "HANDLE", $hFile, "sz*", $sFilePath) MsgBox(0, 0, @error)Thanks in Advance, TD
    • PanStefan
      MySQL include (cdkid) error
      By PanStefan
      Hello, it's me again.
      This time I have problem with MySQL plugin.

      Here is my code
      #include <MySQL.au3> #include <Date.au3> #include <MsgBoxConstants.au3> $User="" $Password="" $Database="" $Serwer="" ;I guess you guys know, why those variables are empty :) $Column = _NowDate() $BazaDanych = _MySQLConnect($User, $Password, $Database, $Serwer) $Variable1 = InputBox("", "Enter a value: ") $Query = "UPDATE autoit SET '" & $Column & "' = '" & $Variable1 & "'" MsgBox(0, "MySQL Query Preview", $Query) _Query($BazaDanych, $Query) _MySQLEnd($BazaDanych)