Herb191 Posted March 7, 2011 Posted March 7, 2011 I am having problems getting a list of all the tables in a MySQL database. Any pointers on what I might be doing wrong would be appreciated. Here is what I have been trying: #include <Array.au3> #include "mysql.au3" _MySQL_InitLibrary() ;connect to MySQL DB $MysqlConn = _MySQL_Init() $connected = _MySQL_Real_Connect($MysqlConn, "Localhost", "root", "", "DB_name") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM *" _MySQL_Real_Query($MysqlConn, $query) $res = _MySQL_Store_Result($MysqlConn) $tables = _MySQL_List_Tables($res) _ArrayDisplay($tables) ; close the connection _MySQL_Close($MysqlConn) ; close the library _MySQL_EndLibrary()
ProgAndy Posted March 7, 2011 Posted March 7, 2011 You have mixed two ways of getting all tables. 1)_MySQL_Real_Query($MysqlConn, "SHOW TABLES") $res = _MySQL_Store_Result($MysqlConn) $tables = _MySQL_Fetch_Result_StringArray($res) ; I think, maybe the function name is a bit different _MySQL_Free_Result($res) _ArrayDisplay($tables) 2)$res = _MySQL_List_Tables($MysqlConn) $tables = _MySQL_Fetch_Result_StringArray($res) ; I think, maybe the function name is a bit different _MySQL_Free_Result($res) _ArrayDisplay($tables) *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
Herb191 Posted March 7, 2011 Author Posted March 7, 2011 Thanks ProgAndy. I had tried “SHOW TABLES” but was not using _MySQL_Fetch_Result_StringArray.
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