bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] ⎕SQL


From: Elias Mårtenson
Subject: Re: [Bug-apl] ⎕SQL
Date: Sat, 7 Jan 2017 12:52:01 +0800

Actually, MSSQL uses the same protocol as Sybase, and I believe if you write the code to be compatible with Sybase's CTLIB API it'll work with MSSQL as well.

You can also use the ODBC API. If GNU APL supported it, you might also get support for other databases with ODBC drivers for free.

If you want to look at implementing support for a new database API in GNU APL, start by looking at the file apl-sqlite.cc. In the function init_provider_map(), the available database types are registered (currently sqlite and postgres).

Next, you have to actually write the provider, in this case CtlibProvider, it should be a class that subclasses Provider.  You need to implement the methods get_name() and open_database(). Whatever is returned from get_name() is what you use on the left-hand side of a call to SQL∆Connect. Once this function is called, the open_database() method of the provider is called. This method should return an instance of Connection.

The Connection class contains a set of methods that you need to implement in order to provide all the functionality. This includes:

In writing this, I realised that there is a pretty bad bug in the implementation of replace_bind_args(). It will replace question marks even in strings, meaning that you can't create a query with an explicit ? in a string. I'll look into fixing that.

If you need more advice, please please let me know.

Regards,
Elias


On 7 Jan 2017 12:15, "Christian Robert" <address@hidden> wrote:
I can help with MySQL/MariaDB

I have a C++ class made by myself more than 10 years ago (still compile fine in 2017).

It may be a starting point. well we can discuss that. I can provide the source to help you if needed.

Yes Oracle interface is awful, I know. And it always near depend on version of the server.

About MS SQL, I don't know of any API available on Unix, able to connect to it. It's proprietary Microsoft API, I think
and really fine with me ;-)  As usual, I may be wrong.

Xtian.

On 2017-01-06 21:42, Elias Mårtenson wrote:
I personally have nothing against adding other providers, the API to do so is very simple and I'll be happy to help anyone who wants to do it.

It's just that I have neither interest nor need to do it myself, so I won't be the person doing this work.

I was looking into adding Oracle support, but the OCI library that you have to use to do that is absolutely awful, so I stopped that effort. I might pick it up again at some point if I really have the need to do that.

Regards,
Elias

On 7 Jan 2017 03:31, "Blake McBride" <address@hidden <mailto:address@hidden>> wrote:

    My component and keyed file systems are built on Elias' SQL DB interface.  Do I need to convert those?

    Also, if we are making the SQL interface an integral part of GNU APL, I would really like to see MS SQL Server support added.

    Thanks!

    Blake


    On Fri, Jan 6, 2017 at 9:57 AM, Juergen Sauermann <address@hidden <mailto:address@hiddenline.de>> wrote:

        Hi,

        Elias (the author of the SQL native function) and myself have
        converted the previously native function into a system function named
        *⎕SQL*. Everything else remains the same.

        The *wslib5/SQL.apl* workspace was updated accordingly; if you use
        that workspace instead of the native function directly then you should
        not notice any differences.

        The native function for SQL will remain for a while, but disappear eventually.

        Enjoy,
        Jürgen






reply via email to

[Prev in Thread] Current Thread [Next in Thread]