October 20, 2011
Steve Teale Wrote:

> Given that Piotr has, I think, already done the same work at protocol level for Postgres, that SQLite is public domain, and that a similar API can be done with ODBC, we should be able to cover a fair range of systems without falling foul of GPL.

It is said ODBC is compatible with SQL/CLI https://www2.opengroup.org/ogsys/jsp/publications/PublicationDetails.jsp?catalogno=c451 and applications written for SQL/CLI will work when compiled with ODBC headers.
The description says the spec gives C binding, so should be viable to write D translation. I took a look at iODBC and MS ODBC headers they look similar, probably copied from SQL/CLI specification.
October 20, 2011
> Steve Teale wrote:
>> It looks as if it is not a big deal to use the MySQL protocol rather than the client library. I can now log in that way, so the rest should follow, and I am working on the changeover. The current MySQL protocol has been around since version 4.1.
> 
Unfortunately I am now reasonably sure that such documentation as there is about the protocol tells lies. So getting it right is going to be like trench warfare. I was hoping to do it without resorting to dissection of the MySQL source code, but the latter may be required.
October 20, 2011
Steve Teale wrote:
>> Steve Teale wrote:
>>> It looks as if it is not a big deal to use the MySQL protocol rather
>>> than the client library. I can now log in that way, so the rest should
>>> follow, and I am working on the changeover. The current MySQL protocol
>>> has been around since version 4.1.
>>
> Unfortunately I am now reasonably sure that such documentation as there
> is about the protocol tells lies. So getting it right is going to be like
> trench warfare. I was hoping to do it without resorting to dissection of
> the MySQL source code, but the latter may be required.

I guess you're right about that requirement. I also did read some Postgres source code to see how data types are encoded. Don't give up! :-)
October 20, 2011
On Thu, 20 Oct 2011 13:41:05 -0400, Piotr Szturmaj <bncrbme@jadamspam.pl> wrote:

> Steve Teale wrote:
>>> Steve Teale wrote:
>>>> It looks as if it is not a big deal to use the MySQL protocol rather
>>>> than the client library. I can now log in that way, so the rest should
>>>> follow, and I am working on the changeover. The current MySQL protocol
>>>> has been around since version 4.1.
>>>
>> Unfortunately I am now reasonably sure that such documentation as there
>> is about the protocol tells lies. So getting it right is going to be like
>> trench warfare. I was hoping to do it without resorting to dissection of
>> the MySQL source code, but the latter may be required.
>
> I guess you're right about that requirement. I also did read some Postgres source code to see how data types are encoded. Don't give up! :-)

Please be cautious about reading GPL'd source code to understand the protocol.  It's possible to be in violation of the license based on this.

It generally takes two people to do this correctly, one to read and understand the original code, and one to implement the new version based on information conveyed by the first person.

I'd recommend someone taking the existing protocol document and updating it with the corrections, then you using that document to fix the protocol implementation in your code.

-Steve
October 20, 2011
> 
> Please be cautious about reading GPL'd source code to understand the protocol.  It's possible to be in violation of the license based on this.
> 
> It generally takes two people to do this correctly, one to read and understand the original code, and one to implement the new version based on information conveyed by the first person.
> 
> I'd recommend someone taking the existing protocol document and updating it with the corrections, then you using that document to fix the protocol implementation in your code.

Will do. I shall attempt to do it on the basis of the network packets I get from the server in the first instance.

Steve
> -Steve

October 20, 2011
Kagamin Wrote:

> Steve Teale Wrote:
> 
> > Given that Piotr has, I think, already done the same work at protocol level for Postgres, that SQLite is public domain, and that a similar API can be done with ODBC, we should be able to cover a fair range of systems without falling foul of GPL.
> 
> It is said ODBC is compatible with SQL/CLI https://www2.opengroup.org/ogsys/jsp/publications/PublicationDetails.jsp?catalogno=c451 and applications written for SQL/CLI will work when compiled with ODBC headers.
> The description says the spec gives C binding, so should be viable to write D translation. I took a look at iODBC and MS ODBC headers they look similar, probably copied from SQL/CLI specification.

yes, ISO 9075-3 provides whole sqlcli.h C header which looks like a copy to/from ms odbc sql.h header.
October 20, 2011
Steven Schveighoffer Wrote:

> Please be cautious about reading GPL'd source code to understand the protocol.  It's possible to be in violation of the license based on this.

As long as he doesn't copy the code, there's no violation. He can even organize code better (or worse), e.g. use OOP, templates and/or ranges.
October 20, 2011
On Thu, 20 Oct 2011 15:56:24 -0400, Kagamin <spam@here.lot> wrote:

> Steven Schveighoffer Wrote:
>
>> Please be cautious about reading GPL'd source code to understand the
>> protocol.  It's possible to be in violation of the license based on this.
>
> As long as he doesn't copy the code, there's no violation. He can even organize code better (or worse), e.g. use OOP, templates and/or ranges.

Isn't it copying if I retype exactly what I'm reading?  If so, wouldn't it be copying if I read code, then the code I write looks similar?

It may feel like not copying, and it may not be copying, but it's sometimes (and I stress sometimes) difficult to prove that it's not copying.

The easiest way to prove is not to read the code.  Then any coincidental similarities are provable coincidences.  It shouldn't be too difficult.  The protocol spec should be nearly accurate (it technically should be 100% accurate, seems like mysql doesn't keep it up well enough), so you just have to fix any discrepancies.  It sounds like Steve is already on the right track.

If it comes down to it, someone can volunteer to help debug the code by comparing it to the GPL'd library in areas where the spec seems to be incorrect and completing the spec.  I can help with this if you really need it, I'd love to see native D support for MySQL, as it's my DB of choice ;)

-Steve
October 21, 2011
> If it comes down to it, someone can volunteer to help debug the code by comparing it to the GPL'd library in areas where the spec seems to be incorrect and completing the spec.  I can help with this if you really need it, I'd love to see native D support for MySQL, as it's my DB of choice ;)

Steve,

It's coming along quite well. I can log in and do simple queries, and clean up after them (how MySQL does that is horrifying), and now I'm attacking prepared statements - so far so good. I'd say in another 3-4 days I'll be back to where I was with the library dependent version.

I agree with you 100% that getting the library out of the way is a top priority. What's more, now I'm getting my head round the protocol I'm thinking the binding for prepared statements can be simplified from what I had before.

Kagamin,

I'll get that header file. I already have a good chunk of the ODBC stuff done from a Windows header file a couple of years ago, so I should be able to get a quick start.

Steve
October 30, 2011
Just a quick progress report.

Since it was clear that my original ideas for a MySQL D interface were not going to make it into Phobos at least because of license issues, I have been investigating the use of the published MySQL client/server protocol (this was expressly removed from GPL, if it could ever have belonged there in the first place, some time ago.)

The results are encouraging, and I am pretty well back to the point I had reached using the C API, but now without files derived from GPL material, linking to a library, and mimicry of the C API methods.

In the course of going over the whole thing again, and with a knowledge now of how the MySQL client/server relationship works, I think I may have improved the interface, even in its present experimental form.

Steve