← Back to team overview

maria-discuss team mailing list archive

Re: mariasql client question (zappajs, coffeescript, nodejs)


Karl-L. Rumpf
Málaga, Spain

Thanks, I got a conclusive answer from the author Brian White

On 05/02/13 14:28, Kristian Nielsen wrote:
klrumpf<klrumpf@xxxxxxxxx>  writes:

I now want to switch to the mariasql client...
Cool, that is an interesting project ...

     res.on("row", (row) ->
       console.log "Result row: " + inspect(row)
@get '/': (req,res) ->      # LANDING PAGE)
    result = doSql("select pakz from pkt where pktnr=10001")
    console.log "919, result = ",result
Console log in the doSql functions shows the results correctly but I
have been
playing around for a while and I can't get the function to return the
result for
further processing to the @get routine. Seems like I have not understood
I assume you mean that

  - You get output linis with "Result row: ..."

  - You get no line "919, result = ", or it is empty.

Unfortunately, there may not be many on this list who are familiar with

I have only general knowledge about event-driven programming. This leads me to
think that you need to pass a handler to your doSql() function and invoke this
handler in your res.on() handler. But I frankly admit I do not know if
something else could work with node.js.

Thanks, hope this is the right list for this, Karl
You are welcome to try :-). Maybe someone with knowledge of node.js will
answer. But it might not be the best list, your problem looks more related to
general node.js than to MariaDB.

Hope this helps (a little),

  - Kristian.