bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Update on SQL support


From: Blake McBride
Subject: Re: [Bug-apl] Update on SQL support
Date: Mon, 14 Apr 2014 12:44:56 -0500

In terms of connecting to PostgreSQL (and probably most other 'real' databases), I think the connection string should have more (optional) arguments separated by a comma.  The ones I use everyday with PostgreSQL are:

driver=org.postgresql.Driver
url="">
user=userxyz
password=thepassword

Of course this is an example from Java.  C must have corresponding parameters.  (I hope you are not _requiring_ an ODBC setup.)  The point being that you cannot connect to a database by just knowing where it is.  You usually need a username and password so the database can determine your access permissions.  The driver option probably makes more sense for Java or if you are linking (via static library or shared library) to a native PostgreSQL library.  But it can be useful if you are using runtime loading.

I'm sorry, I actually came from the APL world and not the APL2 world (although I know what nested arrays are).  I do not understand your SQL∆Select and SQL∆Exec lines do.  Could you provide a brief explanation?

Thanks!

Blake



On Mon, Apr 14, 2014 at 11:25 AM, Elias Mårtenson <address@hidden> wrote:
Just an update: Postgres support almost works now. I have some issues determining the correct data type of the returned values, but once that is resolved it's time to work on the 2D array arguments.

I've changed SQL[1] (connect) to accept a left argument, being the database type. I will also make it register mnemonic functions so that you don't have to see the function numbers. Thus, once the 2D stuff is ready you'll be able to copy the content of "foo" in an SQLite database into table "bar" in a Postgres database like this:

'libsql' ⎕FX 'SQL'
dbA ← 'sqlite' SQL∆Connect '/path/to/database'
dbB ← 'postgresql' SQL∆Connect 'host=hostname.of.database.com'
result ← 'select * from foo' SQL∆Select[dbA] ⍬
'insert into bar (a,b) values (?,?)' SQL∆Exec[dbB] result
SQL∆Close dbA
SQL∆Close dbB

Are you all OK with this syntax?

Regards,
Elias


reply via email to

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