Jump to content

Blob & mysql


Recommended Posts

the msgbox gives me no result. thanks or the quick reply.

#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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by rabothole
Link to comment
Share on other sites

Yes

is 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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Probably should have suggested this earlier. What does IsString return

With $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

Link to comment
Share on other sites

Probably should have suggested this earlier. What does IsString return

With $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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...