rabothole Posted July 24, 2008 Posted July 24, 2008 i'm trying to read data from a blob field in a mysql database but just ge an emty string back, can someone help please.
rabothole Posted July 24, 2008 Author Posted July 24, 2008 the msgbox gives me no result. thanks or the quick reply. expandcollapse popup#include <GUIConstants.au3> #include <mysql.au3> Global $sql, $y, $SQL_b_address connect_db_local() ;~ address is a blob filed in the database $GetDetail = _Query($sql, "Select physical_addr from branch") With $GetDetail While Not .EOF $y += 0.01 $SQL_b_address = .Fields("physical_addr" ).value ; GUICtrlSetData($TxtAddress, $SQL_b_address, "Address") MsgBox(0,"Address", $SQL_b_address) .MoveNext WEnd EndWith func connect_db_local() Global $ssUsername="root" Global $ssPassword="1111" Global $ssDatabase="logging" Global $ssServer="localhost" Global $sDriver = "{MySQL ODBC 3.51 Driver}" Global $iPort=3306 Global $sql = _MySQLConnect($ssUsername, $ssPassword, $ssDatabase, $ssServer, $sDriver, $iPort) If @error then ProgressOff() MsgBox(0,"","error connecting to database") Exit EndIf EndFunc;==>connect_db_local could you post the code please
rabothole Posted July 25, 2008 Author Posted July 25, 2008 please help, I've search the forum and couldn't find anything.
peppercorngiant Posted July 25, 2008 Posted July 25, 2008 please help, I've search the forum and couldn't find anything.This is the only result in Google for blob: "blob site:www.autoitscript.com/forum/"I would also like to see an answer on this. [font="Lucida Console"]The truth is out there[/font]
rabothole Posted July 25, 2008 Author Posted July 25, 2008 This is the only result in Google for blob: "blob site:www.autoitscript.com/forum/"I would also like to see an answer on this.Yes can you see my dilemma ? Still no one ??
rabothole Posted July 25, 2008 Author Posted July 25, 2008 Yes can you see my dilemma ? Still no one ??can someone just say if I'm an idiot(for asking a dumb question) or something, just something, I still don't know what to do.
picaxe Posted July 25, 2008 Posted July 25, 2008 (edited) Try If IsBinary($SQL_b_address) Then MsgBox(0,"Address", String($SQL_b_address)) Else MsgBox(0,"Address", $SQL_b_address) EndIf Edited July 25, 2008 by picaxe
rabothole Posted July 25, 2008 Author Posted July 25, 2008 Try If IsBinary($SQL_b_address) Then MsgBox(0,"Address", String($SQL_b_address)) Else MsgBox(0,"Address", $SQL_b_address) EndIf thanks for the help but still does not return any thing, i thought of doing the following: Select cast(physical_addr as char) from branch - and running this gave me a result of the address in string that i can use but still done not display anything in Autoit
picaxe Posted July 26, 2008 Posted July 26, 2008 Maybe try this in your code to see if anything displays. Nulls are seen by AutoIt as string terminators. GUICtrlSetData($TxtAddress, StringReplace($SQL_b_address, Chr(0), ""), "Address")
rabothole Posted July 26, 2008 Author Posted July 26, 2008 (edited) thanks for the advice but there is a value in the address field in the database i'm 100% sure but even with your line added it returns nothing not even the default value you assigned, so that means the value is not NULL ? am i right?? Edited July 26, 2008 by rabothole
picaxe Posted July 26, 2008 Posted July 26, 2008 it returns nothing not even the default value you assigned, so that means the value is not NULL ? am i right??Yes
rabothole Posted July 28, 2008 Author Posted July 28, 2008 Yesis there a way for me to see the value in AutoIT, I really do not want to change the database we have a web app that runs on there and is functional, i would just like to do an app version of that.in the mysql.au3 i cannot find anything that resembles blob so i don't think it's written for blob's just the string and int values.
rabothole Posted July 28, 2008 Author Posted July 28, 2008 What is the format of the blob data ? this is the way they created the database: CREATE TABLE `branch` ( `branch_id` int(12) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', `physical_addr` blob, `postal_addr` blob, `city` varchar(50) default NULL, `province` varchar(20) default NULL, `phone` varchar(25) NOT NULL default '', `fax` varchar(25) default NULL, `pcanywhere` varchar(25) default NULL, `email` varchar(50) NOT NULL default '', `manager_name` varchar(50) default NULL, `manager_cell` varchar(20) default NULL, so i assume that its text, like i said if i run the following on the database i get a resault that is fine: select cast(physical_addr as char) from branch where branch_id = 10; i get the result: JAN PIET STR WATERKLOOF PRETORIA SOUTH AFRICA
picaxe Posted July 28, 2008 Posted July 28, 2008 Probably should have suggested this earlier. What does IsString returnWith $GetDetail While Not .EOF $y += 0.01 $SQL_b_address = .Fields("physical_addr" ).value ; GUICtrlSetData($TxtAddress, $SQL_b_address, "Address") ConsoleWrite("IsString=" & IsString($SQL_b_address) & @LF) MsgBox(0,"Address", $SQL_b_address) .MoveNext WEnd EndWith
rabothole Posted July 28, 2008 Author Posted July 28, 2008 Probably should have suggested this earlier. What does IsString returnWith $GetDetail While Not .EOF $y += 0.01 $SQL_b_address = .Fields("physical_addr" ).value ; GUICtrlSetData($TxtAddress, $SQL_b_address, "Address") ConsoleWrite("IsString=" & IsString($SQL_b_address) & @LF) MsgBox(0,"Address", $SQL_b_address) .MoveNext WEnd EndWith And this returns IsString=0 and the msgbox empty.
rabothole Posted July 28, 2008 Author Posted July 28, 2008 everything else in this exept the postal_addr (also Blob) returns IsString=1
picaxe Posted July 28, 2008 Posted July 28, 2008 Try ConsoleWrite("DataType=" & VarGetType($SQL_b_address) & @LF)
rabothole Posted July 29, 2008 Author Posted July 29, 2008 (edited) Try ConsoleWrite("DataType=" & VarGetType($SQL_b_address) & @LF) Thanks so far for the help. What returned was the following: DataType=Object thanks Edited July 29, 2008 by rabothole
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