分类: Python/Ruby
2011-11-15 14:53:19
mysql.au3.txt mysql-connector-odbc-3.51.29-win32.part1.rar mysql-connector-odbc-3.51.29-win32.part2.rar
Title: MySQL UDF functions
Filename: MySQL.au3
Description: A collection of functions for interacting with MySQL
Author: cdkid
Version: 1.6
Requirements: Autoit V3 with COM support.
Note: Make sure to add _MySQLEnd to the end of any script you use this with or you will have open connections to your DB left open!!!!
Note2: at the end of your script i find that it helps to turn your connection object (in the examples i use $sql) to "" so add $sql = "" to the end
Note3: I think it is because using COM from a non-server connecting to a DB on a server, but these can take an EXTREMELY long time.
---> functions:
_MySQLConnect()
Open a connection to the specified Database
_MySQLEnd()
Close the connection (read notes!)
_AddRecord()
Adds a record to a specified table
_DeleteRecord()
Deletes a record from the specifed table.
_Query()
Execute a query to the database
_CreateTable()
Adds a table to the database
_CreateColumn()
Adds a column to the given table
_DropCol()
Deletes a column from the given table
_DropTbl()
Deletes a table from the given DB
_CountRecords()
Counts the number of records in the given column
_CountTables()
Counts the number of tables in the database
_GetColNames()
Gets the names of all the columns in the given table
_GetTblNames()
Gets the names of all the tables in the database
_GetColvals()
Gets all of the values of the specified column
_GetColType()
Gets the DATA TYPE of the specified column
_GetColCount()
Gets a count of all columns in the specified table
_MySQLTableExists()
Find out whether or not a specified table exists
_GetDBNames()
Get a list & count of databases on the current server.
_ChangeCon()
Change your connection string.
here are a few examples
#1 start a connection, do a SELECT statement, write the return value to 'C:\test.txt' then end connection
#2 start a connection, add a record, delete a record, end connection
#3 - Connect, create a table, add a record, count records in the table, drop the table, end connection
#4 - Connect, get a list of databases, MessageBox the result
if you're getting errors...i've found a good way to track em. this was in the idea lab, written by SvenP
put this at the top:
and then this anywhere
example