[fpc-pascal] MySQL5

ik idokan at gmail.com
Tue Jan 17 14:27:46 CET 2012


On Tue, Jan 17, 2012 at 15:19, <michael.vancanneyt at wisa.be> wrote:

>
>
> On Tue, 17 Jan 2012, Mattias Gaertner wrote:
>
>
>> michael.vancanneyt at wisa.be hat am 17. Januar 2012 um 13:28 geschrieben:
>>
>>
>>>
>>> On Tue, 17 Jan 2012, Mattias Gaertner wrote:
>>>
>>>  Hi,
>>>>
>>>> I tried connecting to a mysql 5.5 database and used the fpc unit
>>>>
>>> mysql51.
>>
>>> There are only examples for 3 and 4, so I started with testdb4.pp and
>>>> adapted it.
>>>> It turned out that the MYSQL record is missing some new fields, so the
>>>> mysql_init overwrites the memory behind.
>>>> After adding some dummy bytes at the end it worked nice.
>>>>
>>>> Is there a better way?
>>>>
>>>
>>> Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match
>>>
>> the
>>
>>> 5.5 specs.
>>>
>>
>>
>> ;)
>>
>
> You asked for a better way. not a faster :-)


The best way imho is not to use this "db" toy. Unless you do not have a way
to avoid it, and then "it sucks to be you" ;)


>
>
>
>>
>>
>>
>>  That is how we bring it up-to-date whenever a new MySQL version appears.
>>>
>>
>>
>> I only found mysql51 headers. Are there some newer ones?
>>
>
> Not to my knowlegde.
>
>
>
>> I would like my program to still run when the next small upgrade comes.
>>
>
> We cannot guarantee that. You even can't guarantee that in C. An upgrade of
> the mysql library may break your perfectly running program. (I have known
> it to happen for a client of mine)
>
> Most people don't notice this, since all distributions recompile
> everything that depends on MySQL from scratch anyway. But for FPC, the case
> is different.


MySQL is "deprecated", and there are several open source projects that uses
the same code base, but try to provide better support
(http://mariadb.org/for example).
The problem is, that most people know "MySQL". so here is the problem you
describe :(


>
>
>  As
>> far as I can see new things are only added at the end, so adding some
>> dummy
>> bytes for "future extensions" may help here. Is this wishful thinking?
>>
>
> No, because sometimes they change the size or position of a field, and
> then resolve it with macros in C. Since we need the correct size and
> position this does not guarantee you solve everything. They also change
> the number of arguments to calls and change the export symbols, again they
> mask this with C macros.
>
> In short: You never know, hence you must upgrade the headers.
>
> This mess is why I urge people not to use MySQL. Their API is not stable.
> e.g. Firebird's API has been stable for the last 12 years, but features are
> nevertheless added all the time.
>
> So: upgrade the 5.1 to 5.5, and I'll add it in FPC and create a 5.5 mysql
> connection object as soon as I have received the upgraded headers.
>
>
> Michael.
> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120117/231bcd4b/attachment.html>


More information about the fpc-pascal mailing list