October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Piotr Szturmaj | On 17.10.2011 17:26, Piotr Szturmaj wrote:
>
> You probably meant me. If we create MySQL client without using C
> bindings then we would have one of the fastest bindings at all. It may
> attract some people who write web apps to D. The same applies to
> PostgreSQL for which I wrote client without using a C binding.
Why would a reimplementation be much faster? Is the C library "slow"? Or is there any overhead I'm not thinking of?
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | simendsjo wrote:
> On 17.10.2011 17:26, Piotr Szturmaj wrote:
>>
>> You probably meant me. If we create MySQL client without using C
>> bindings then we would have one of the fastest bindings at all. It may
>> attract some people who write web apps to D. The same applies to
>> PostgreSQL for which I wrote client without using a C binding.
>
> Why would a reimplementation be much faster? Is the C library "slow"? Or
> is there any overhead I'm not thinking of?
There is always a function call overhead and also most of the fields are returned as strings, whereas in underlying protocol they are encoded binary, i.e. int is not sent as its decimal string representation but as 4 bytes. This saves some time taken by string to int conversion (parsing).
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Mon, 17 Oct 2011 11:40:44 -0400, Kagamin wrote:
> Steve Teale Wrote:
>
>> Header files may be an issue with the database implementations. For example my mysql.d is a straight translation of mysql.h (and a couple of others). Does that mean it is tainted by GPL and I can't make it Boost?
>
> As an alternative why not make ODBC bindings? This way you'll be able to use virtually any database. ODBC is the most important database binding.
We are/were heading down the road of having ODBC as one of the options, but what's the status of its header files I wonder?
But it sounds to me as if Walter's CAPI concept should be expanded to have three directories - C headers, equivalent D interfaces, and derived works.
Steve
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Piotr Szturmaj | On 17.10.2011 17:55, Piotr Szturmaj wrote:
> simendsjo wrote:
>> On 17.10.2011 17:26, Piotr Szturmaj wrote:
>>>
>>> You probably meant me. If we create MySQL client without using C
>>> bindings then we would have one of the fastest bindings at all. It may
>>> attract some people who write web apps to D. The same applies to
>>> PostgreSQL for which I wrote client without using a C binding.
>>
>> Why would a reimplementation be much faster? Is the C library "slow"? Or
>> is there any overhead I'm not thinking of?
>
> There is always a function call overhead and also most of the fields are
> returned as strings, whereas in underlying protocol they are encoded
> binary, i.e. int is not sent as its decimal string representation but as
> 4 bytes. This saves some time taken by string to int conversion (parsing).
I see. I've looked a bit at the C library, and it seems the protocol isn't very stable. Trying to support older MySQL versions and keep up with protocol changes might be (too) tedious.
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | simendsjo wrote:
> On 17.10.2011 17:55, Piotr Szturmaj wrote:
>> simendsjo wrote:
>>> On 17.10.2011 17:26, Piotr Szturmaj wrote:
>>>>
>>>> You probably meant me. If we create MySQL client without using C
>>>> bindings then we would have one of the fastest bindings at all. It may
>>>> attract some people who write web apps to D. The same applies to
>>>> PostgreSQL for which I wrote client without using a C binding.
>>>
>>> Why would a reimplementation be much faster? Is the C library "slow"? Or
>>> is there any overhead I'm not thinking of?
>>
>> There is always a function call overhead and also most of the fields are
>> returned as strings, whereas in underlying protocol they are encoded
>> binary, i.e. int is not sent as its decimal string representation but as
>> 4 bytes. This saves some time taken by string to int conversion
>> (parsing).
>
> I see. I've looked a bit at the C library, and it seems the protocol
> isn't very stable. Trying to support older MySQL versions and keep up
> with protocol changes might be (too) tedious.
PostgreSQL's protocol is stable since 2003, but MySQL's is not very friendly indeed. Phobos might follow opportunistic path and support direct access with recent MySQL versions and C wrapper for older ones.
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Piotr Szturmaj | On 17.10.2011 18:16, Piotr Szturmaj wrote:
> simendsjo wrote:
>> On 17.10.2011 17:55, Piotr Szturmaj wrote:
>>> simendsjo wrote:
>>>> On 17.10.2011 17:26, Piotr Szturmaj wrote:
>>>>>
>>>>> You probably meant me. If we create MySQL client without using C
>>>>> bindings then we would have one of the fastest bindings at all. It may
>>>>> attract some people who write web apps to D. The same applies to
>>>>> PostgreSQL for which I wrote client without using a C binding.
>>>>
>>>> Why would a reimplementation be much faster? Is the C library
>>>> "slow"? Or
>>>> is there any overhead I'm not thinking of?
>>>
>>> There is always a function call overhead and also most of the fields are
>>> returned as strings, whereas in underlying protocol they are encoded
>>> binary, i.e. int is not sent as its decimal string representation but as
>>> 4 bytes. This saves some time taken by string to int conversion
>>> (parsing).
>>
>> I see. I've looked a bit at the C library, and it seems the protocol
>> isn't very stable. Trying to support older MySQL versions and keep up
>> with protocol changes might be (too) tedious.
>
> PostgreSQL's protocol is stable since 2003, but MySQL's is not very
> friendly indeed. Phobos might follow opportunistic path and support
> direct access with recent MySQL versions and C wrapper for older ones.
Since 2003? That's pretty impressive!
About MySql: The reason D is missing a lot of wrappers and libraries is the lack of manpower. This "duplicated" effort sounds like too much job at the current time. I think more people will flock to D once modules such as database and web-programming exists, and then more focus can go into optimizing.
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Piotr Szturmaj | > PostgreSQL's protocol is stable since 2003, but MySQL's is not very friendly indeed. Phobos might follow opportunistic path and support direct access with recent MySQL versions and C wrapper for older ones.
But it looks like the C wrapper approach for MySQL won't fly for Phobos because of the GPL taint. MySQL support might have to be consigned to the Deimos 'derived works' directory. Either that or Phobos only supports versions > 5.xx.
Steve
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | >
> As an alternative why not make ODBC bindings? This way you'll be able to use virtually any database. ODBC is the most important database binding.
I can't find any definitive source for the ODBC header files. I've seen various versions that seem to make conflicting copyright claims or to have conflicting license statements. Does anyone have what might be considered to be a definitive version of these?
Steve
|
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve Teale | Am 17.10.2011, 18:38 Uhr, schrieb Steve Teale <steve.teale@britseyeview.com>: >> PostgreSQL's protocol is stable since 2003, but MySQL's is not very >> friendly indeed. Phobos might follow opportunistic path and support >> direct access with recent MySQL versions and C wrapper for older ones. > > But it looks like the C wrapper approach for MySQL won't fly for Phobos > because of the GPL taint. MySQL support might have to be consigned to the > Deimos 'derived works' directory. Either that or Phobos only supports > versions > 5.xx. > > Steve Do people not upgrade their database to MySQL 5? I never had to deal with that and especially large complicated databases. If it is easy to upgrade to MySQL 5 and it is faster and more secure there are probably few *actively developed* projects accessing MySQL 4 DBs. (MySQL 5 is pretty much exactly 6 years old now.) |
October 17, 2011 Re: [std.database] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | Am 17.10.2011, 19:46 Uhr, schrieb Marco Leise <Marco.Leise@gmx.de>: > Am 17.10.2011, 18:38 Uhr, schrieb Steve Teale <steve.teale@britseyeview.com>: > >>> PostgreSQL's protocol is stable since 2003, but MySQL's is not very >>> friendly indeed. Phobos might follow opportunistic path and support >>> direct access with recent MySQL versions and C wrapper for older ones. >> >> But it looks like the C wrapper approach for MySQL won't fly for Phobos >> because of the GPL taint. MySQL support might have to be consigned to the >> Deimos 'derived works' directory. Either that or Phobos only supports >> versions > 5.xx. >> >> Steve > > Do people not upgrade their database to MySQL 5? I never had to deal with that and especially large complicated databases. If it is easy to upgrade to MySQL 5 and it is faster and more secure there are probably few *actively developed* projects accessing MySQL 4 DBs. (MySQL 5 is pretty much exactly 6 years old now.) I found this: http://www.gentoo.org/doc/en/mysql-upgrading.xml#doc_chap1 Leaving away the safety net it looks like a call to mysql_upgrade_shell is all that's needed in the general case. |
Copyright © 1999-2021 by the D Language Foundation