beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
seninha has quit [Remote host closed the connection]
_whitelogger has quit [Ping timeout: 240 seconds]
_whitelogger has joined #picolisp
aw- has joined #picolisp
inara has joined #picolisp
casaca has joined #picolisp
payphone has joined #picolisp
buffet1 has joined #picolisp
rob_w has joined #picolisp
buffet1 is now known as buffet
tankf33der has joined #picolisp
abu[7] has quit [Ping timeout: 248 seconds]
abu[7] has joined #picolisp
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
tankf33der[m] has quit [Read error: Connection reset by peer]
abu[m] has quit [Read error: Connection reset by peer]
rob_w has quit [Quit: Leaving]
abu[m] has joined #picolisp
msavoritias has joined #picolisp
seninha has quit [Quit: Leaving]
msavoritias has quit [Remote host closed the connection]
seninha has joined #picolisp
pablo_escoberg has joined #picolisp
<pablo_escoberg> So, I've done a cursory search and found nothing, but I want to make absolutely sure this doesn't exist before I start building it, "this" being an interface to sql databases (start with sqlite, maybe add postgres). Has nobody done this?
<abu[m]> Hi pablo_escoberg! I have not heard of anybody doing this so far.
<pablo_escoberg> goddammit! OK, looks like it's on me. Shouldn't be too tough. I figure I'll use a pipe to communicate with the binary rather than write a wrapper for the C API. Does that sound right?
<abu[m]> What I did occasiondlly was importing from other DBs via CSV or XML
<abu[m]> but that's trivial
<pablo_escoberg> yeah, I need read/write in real time. I have 0 experience in this kind of thing. I'll check how they did it in Ruby unless someone here has specific advice on how I should approach this.
<abu[m]> Well I did something like that in the early 90s with a DB called "Informix". There was a C-API allowing to send SQL strings. Probably things are still similar today.
<pablo_escoberg> Yeah, they are. But that seems like a lot more work than piping commands to a running executable. I have no idea if there are any issues with that...
<abu[m]> Or you start a pipe
<pablo_escoberg> Yeah, that's my plan as of now. I just need to figure out if there are performance or stability issues with that (broken pipes, piping overhead, etc).
<abu[m]> (in '("sqlite3" "-header" "-column" "/path/x.db" "select" "\"*\"" "from" ...) (while (line) ...
<pablo_escoberg> Yeah, that kind of thing.
<pablo_escoberg> any reason to think that will be problematic?
<abu[m]> It is not the fastest
<pablo_escoberg> what kind of overhead would you say, percentage wise?
<abu[m]> Forking the db process and reading from the pipe. Many small accesses are probably slow, but when reading larger amounts of data in one call it will not matter much
<abu[m]> A direct C library call is perhaps hundred times faster
<pablo_escoberg> Right, but I'm thinking there should be no need to fork the process for every call. I can just keep it running in a pipe, no?
<abu[m]> that's true
<pablo_escoberg> so no forking, it's just a matter of the pipe overhead. Is that much greater than the function call overhead?
<abu[m]> Not sure, a pipe in Unix is quite efficient. And the data conversions (to/from string etc) are roughly the same in both cases
<abu[m]> So it would be something like (setq *FD (pipe (exec "sqlxxx" ...)))
<abu[m]> then (out *FD (prinl ...)) (in *FD ...
<pablo_escoberg> Right. Thanks so much! That's how I will proceed. If nothing else, it's orders of magnitude less code than wrapping the C lib. If it doesn't work out, I'll probably hire one of you fine folks to do that for me. Thanks again. You guys rock!
<abu[m]> :)
pablo_escoberg has left #picolisp [#picolisp]
seninha has quit [Ping timeout: 268 seconds]
seninha has joined #picolisp