Jump to content
ProgAndy

MySQL UDFs (without ODBC)

Recommended Posts

@ProgAndy

I tried to download this today, and your server is just returning a 403: Forbidden response.

I'm actually getting a 403 from all links on your domain web server http://progandy.de/

Looking forward to trying out this UDF.   Thanks

 

 

Share this post


Link to post
Share on other sites

Actually, a whois lookup suggests the domain might no longer be active.  If someone else has a copy of this UDF, please repost a link to an alternate download location.  Or if it's small enough, perhaps even paste the code here in the forum?   It would be a shame for this to become no longer available, as it looks like it could be really useful to many people.  Thanks!

Share this post


Link to post
Share on other sites

Hey Guys, i have a statement problem.. i don't know, how put on this correctly.. 

$fdata = "INSERT INTO `asd`.`qwe` (`name`,`lname`,`email`,`note`) VALUES (" & _
"'" & $sName & "'," & _
"'" & $sLname & "'," & _
"'" & $sEmail & "'," & _

;~ If StringInStr($ctrl, "'") Then
;~ If StringInStr($val, ",") Then
;~  "'" & StringSplit($val, ',', $STR_ENTIRESPLIT)[1] & "');"
;~ Else
;~  "'" & $val & "');"
;~ EndIf
;~ Else
;~  "'" $empty "');"
;~ EndIf
_MySQL_Real_Query($cnn, $fdata)

i'll be so much grateful..

*****************************************

Solution..

$fdata = "INSERT INTO `asd`.`qwe` (`name`,`lname`,`email`,`note`) VALUES (" & _
;~ db col - name
"'" & $sName & "'," & _
;~ db col - lname
"'" & $sLname & "'," & _
;~ db col - email
"'" & $sEmail & "',"
;~ db col - note
If StringInStr($ctrl, "'") Then
  If StringInStr($val, ",") Then
    $fdata = $fdata & "'" & StringSplit($val, ',', $STR_ENTIRESPLIT)[1] & "');"
  Else
    $fdata = $fdata & "'" & $val & "');"
  EndIf
Else
  $fdata = $fdata & "'" & $empty & "');"
EndIf
_MySQL_Real_Query($cnn, $fdata)

maybe it helps someone..

Edited by Ujube

Share this post


Link to post
Share on other sites

Does anyone still have the zip file for this? I am working on a project to use a MySQL database for data collection at each client. I can't seem to follow any of the links (as they are very old apparently), and locate the zip for download.

Share this post


Link to post
Share on other sites

Hi , Anydy

Thanks for your great work.  Today , I tried to use this UDF  and had successful fetch records from my databae. Unfortunately , It can not display the Chinese big5 character. what's wrong with it ? my c connector driver version is 6.1 1 and  mysql was 8.0.17.  Could you help me with it ?  Much Thanks in advance!  Or someone's help  would be appreciated

Asparagus

 

.mysql.jpg.9d74c068f02e17a24354dc73bd6f670d.jpg

Share this post


Link to post
Share on other sites

I haven't looked and I don't use MySQL but most probably the various functions in this UDF deal with native AutoIt strings which are Unicode UTF16-LE.

In case this is the cause, you can convert wide strings to any codepage (including double-byte types like Big5) and vice-versa with these functions:

Func _StringToCodepage($sStr, $iCodepage = Default)
    If $iCodepage = Default Then $iCodepage = 65001        ; or Int(RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Nls\Codepage", "OEMCP"))
    Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodepage, "dword", 0, "wstr", $sStr, "int", StringLen($sStr), _
            "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
    Local $tCP = DllStructCreate("char[" & $aResult[0] & "]")
    $aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodepage, "dword", 0, "wstr", $sStr, "int", StringLen($sStr), _
            "struct*", $tCP, "int", $aResult[0], "ptr", 0, "ptr", 0)
    Return DllStructGetData($tCP, 1)
EndFunc   ;==>_StringToCodepage

Func _CodepageToString($sCP, $iCodepage = Default)
    If $iCodepage = Default Then $iCodepage = 65001        ; or Int(RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Nls\Codepage", "OEMCP"))
    Local $tText = DllStructCreate("byte[" & StringLen($sCP) & "]")
    DllStructSetData($tText, 1, $sCP)
    Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", StringLen($sCP), _
            "ptr", 0, "int", 0)
    Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]")
    $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", StringLen($sCP), _
            "struct*", $tWstr, "int", $aResult[0])
    Return DllStructGetData($tWstr, 1)
EndFunc   ;==>_CodepageToString

Use the codepage IDs defined there https://docs.microsoft.com/fr-fr/windows/win32/intl/code-page-identifiers

For instance, Big5 is 950.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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

  • Similar Content

    • By RAMzor
      Hello all!
      I got the Acroname Programmable USB Hub based on BrainStem platform. I will use it to manage ports and read current.
      They have development kit (BRAINSTEM DEVELOPMENT KIT) with examples for any languages like C#, C++, LabVIEW and python but no AutoIt.
      The kit include BrainStem2.dll (x32 and x64), BrainStem2_LabVIEW.dll, BrainStem2CLI.dll and many examples.
      Anyone used this dll and implemented it in AutoIt?
      Please share some example for Device Discovering, User LED Flashing or power enable/disable on port to start play with this HUB
      BrainStem Reference 
       
      BrainStem2 lib+example.7z USB HUB User Manual s79-usbhub-3p_v1.10_0.pdf
    • By matwachich
      Hi guys!
      A pretty simple UDF to convert HTML to PDF using wkHTMLtoPDF.
      It uses the C API of the tool (DLL), so no external process, no ActiveX or COM sh*t.
      See the example, and the documentation of wkHTMLtoPDF.
      Cheers
      https://github.com/matwachich/wkhtmltopdf-au3
    • By Skysnake
      This is relevant
      From here https://stackoverflow.com/questions/3454315/is-it-possible-to-pin-a-dll-in-memory-to-prevent-unloading
      I use several UDFs on the Forum to do various things.  Those UDFs work very well.
      Effectively the UDFs are DLL wrappers, that make it possible to access DLL functions easily without the long hard slog of DLLCall() every time.
      However, I have now run into the issue that multiple UDF DLLCalls are slow. Not mind numbingly slow, but slow enough to become noticeable with a large of repeated function calls.
      So I was wondering, is it possible to "load a DLL into memory" and leave it there for the duration of my script's lifetime, avoid repeated DLL on-disk reads with a persistent in memory DLL?
      From Microsoft
      https://docs.microsoft.com/en-us/windows/desktop/dlls/about-dynamic-link-libraries
      Looks like what I want to do is: load-time dynamic linking,
      So next question, (a) how do I do this with AutoIt (b) How would this impact on standard AutoIt type DLL calls?
       
      The point is speed.  Is there a different approach?
      Or am I barking up the wrong tree?
      Skysnake
    • By bladem2003
      Hello,
      i need help to translate the c code to autoit .
      I don't understand the callback function.
       
      #include <windows.h> #include <stdio.h> // native IR Data by PAnsiChar typedef void CALLBACK CallBackPAnsiChar(char*, char*, char*, char*); typedef int (__stdcall *impInitPAnsiChar)(CallBackPAnsiChar); CALLBACK MyCallBackPAnsiChar(char* Protocol, char* Address, char* Command, char* Flags) { printf("\nIR Data received: Protocol: %s, Address: 0x%s, Command: 0x%s, Flags: 0x%s", Protocol, Address, Command, Flags); fflush(stdout); } int main(int argc, char **argv) { impInitPAnsiChar InitPAnsiChar = NULL; // Load DLL file HINSTANCE hinstLib = LoadLibrary(TEXT("USB_IR_Remote_Receiver.dll")); if (hinstLib == NULL) { printf("\nERROR: unable to load DLL\n"); return 1; } // Get function pointer InitPAnsiChar InitPAnsiChar = (impInitPAnsiChar)GetProcAddress(hinstLib, "InitPAnsiChar"); if (InitPAnsiChar == NULL) { printf("\nERROR: unable to find DLL function\n"); FreeLibrary(hinstLib); return 1; } if (InitPAnsiChar(*MyCallBackPAnsiChar)) { printf("\nInit DLL with InitPAnsiChar successfull"); } else { // Unload DLL file FreeLibrary(hinstLib); return 0; } while(1) { } //return 0; }  
    • By Stacker
      Hi all,
      i want to start a new application that capture a screen or image from webcam an read all barcode inside the picture.
      I have test this code https://www.autoitscript.com/forum/topic/27925-webcam-example/
      Works fine for my webcam.
      Now i need to read all barcodes (code 128 code39, no 2d) inside the picture. I have found this https://www.codeproject.com/Articles/42852/Reading-Barcodes-from-an-Image-III
      It's possible to make a dll from VB source i linked  with this  parameters :  filename, Array of barcode founded, error code and launch from Autoit with function ?
      Anyone can help me to make dll and autoit function, i don't know VB.
      Thanks
×
×
  • Create New...