[Gambas-user] Retrieving picture from Database Mysql

Hamilton Geminiano Andrioli Junior handriolijr at ...626...
Wed Apr 11 15:39:03 CEST 2007


Benoit Minisini escreveu:
> On mardi 10 avril 2007, timothy wrote:
>   
>>> -----Original Message-----
>>> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
>>> bounces at lists.sourceforge.net] On Behalf Of Steven Lobbezoo
>>> Sent: Monday, 09 April 2007 08:27 AM
>>> To: mailing list for gambas users
>>> Subject: Re: [Gambas-user] Retrieving picture from Database Mysql
>>>
>>> But, You should watch it :
>>> Gambas does NOT recognise blob fields correctly.
>>> You need to define a "Large Blob" in Mysql, not a medium ore small or
>>> varchar
>>> unlimited. All these other formats are interpreted (I suppose in the
>>>       
>> name
>>
>>     
>>> of
>>> compatibility) as char and not transferred (You will only get the
>>>       
>> first
>>
>>     
>>> four
>>> characters (8 Bytes)) correctly.
>>> I consider this leveling at a common lowest dominator a very bad
>>>       
>> thing,
>>
>>     
>>> since
>>> it prives you from all kind of features in MySql, but anyway.... I
>>>       
>> suppose
>>
>>     
>>> it's the french way (THey do that in politics too). ;-))
>>>       
>> I do not think comments like this really help anyone.
>>
>>     
>>> That why I use db.Exec all the time, pity!
>>>
>>> Steven
>>>       
>> Attached is a example that I think illustrates the bug in the BLOB type
>> database field.
>>
>> This example will create the database for you if it does not exist.
>> (This will also help if you know the structure of the database when
>> debugging.)
>>
>> The Select(), Add() and Delete() methods work fine. The problem is with
>> the Update() method. For some reason this method removes the data in the
>> thumb field of the database. In this method I only update the
>> description:
>>
>> PUBLIC SUB Update(Row AS Integer, Description AS String)
>>   ResultPictures.MoveTo(Row)
>>   ResultPictures["description"] = Conv(Description, Desktop.Charset,
>> databaseConnection.Charset)
>>   ResultPictures.Update()
>> CATCH
>>   Error.Raise("<b>Update database record error</b><hr>Error:<br>" &
>> DConv(Error.Text))
>> END
>>
>> But with DB.Debug = TRUE we can see that the SQL created sets 'thumb' =
>> NULL
>>
>> sqlite: 0x80fd968: UPDATE 'pictures' SET 'id' = 5, 'thumb' = NULL,
>> 'image' = X'89504...
>>
>> though the 'image' blob field is correct. Here I have used a SQLite 3
>> database but the same happens in a MySQL database. I have not tries it
>> with a PostgressSQL database, but my guess is that it is the same.
>>
>>
>> Hope this helps
>>
>> 8-{)} Timothy Marshal-Nichols
>> <mailto: timothy.marshal-nichols at ...247...>
>>     
>
> Yes!
>
> I found the bug and fixed in the svn trunk.
>
> Can I add your project to the gambas examples?
>
>   
Hi All!
Yes! you can.
But, give me about a week or two to finish the first part of project.
Then i'll send you a complet and function Sales Control System!

Regards
Hamilton From Brazil!




More information about the User mailing list