Arc Forumnew | comments | leaders | submit | justgord's commentslogin

As an interim hack to get to postgres data, I'm currently using system to call the external psql command - less than ideal :[

<pre> (def sqltxt (sql) (system (string "psql -c " "\"" sql "\"" ))) </pre>

[ I guess opening a socket to the db server and parsing the resultset wouldn't be much harder if its text mode - could probably use the perl or ruby pglib as a guide, and port from that... ]

-----

2 points by shader 5733 days ago | link

Hmm. I would think that you wouldn't want to open a new psql connection every time you want to look something up.

How about running the system command in a thread, which redirects psql's stdin and stdout to named pipes so that another arc thread could read from it using file read commands? That would give you more persistence, so you wouldn't have to keep loading psql.

Also, have a look at lib/mysql-ffi.arc in anarki; supposedly it has a ffi for mysql, though I haven't really looked at it much myself.

-----

1 point by justgord 5733 days ago | link

yeah or theres the mz: extension to access one of mzschemes pgsql libs...

Sure its ugly/slow.. but allows me to prototype in the meantime.

Thanks for the mysql ref, I'll take a look.

-----

2 points by absz 5733 days ago | link

I can't help you with the SQL, but I can give you a formatting tip: to get

  code formatted like this,
surround your code block with a blank line on each side and indent each line of code by at least two spaces.

-----

2 points by justgord 5733 days ago | link

  (prn "thanks absz")

-----


In fact I wonder if anyone has ported pg's Arc macros to Scheme... it seems a lot of the benefit of the language would still be there without a full Arc syntax implementation.

It could be seen as an experiment to see how much an Arc without special language extensions would feel like the real Arc - eg. minus square brackets etc.

My feeling is that merely having nice short abbreviations buys quite a lot - but hell, Ive written mostly C code, so you may rightly cringe at the lobotimization.

-----


Please do share.

Enjoyed your ppt slide talk on Arc posted elsewhere on this forum. [ converted to text - let me know if you want that]

They'd both be helpful on a Wiki.

gord.

-----

1 point by justgord 5734 days ago | link | parent | on: Arc presentation

Ive been using arc for a while, but some things were made clearer by this presentation.

Any chance you'll put it up on a blog/website? [so it would come up when googled]

One reason I ask, is I noticed my Linux box go CPU bound when loading that ppt in OO.org [hardly your fault I know]

-----