run q-sql as string

I want to run q-sql which is inputted as string to the program. ALL of them run fine in the console. I can use eval ( parse queryString) however the big ones dont parse fine and hence dont run. Is there a way to just run them without using eval/parse ?

To: analyst valuevalue"1+1"(works for a lot more than strings like value(+;1;1) works)? Original Message ?From: analystSent: Friday, October 30, 2015 12:52To: Kdb+ Personal DevelopersReply To: personal-kdbplus@googlegroups.comSubject: [personal kdb+] run q-sql as stringI want to run q-sql which is inputted as string to the program. ALL of them run fine in the console. I can use eval ( parse queryString) however the big ones dont parse fine and hence dont run. Is there a way to just run them without using eval/parse ?–

Submitted via Google Groups

parse and value do not work well with “\n”.  do your ‘big ones’ have “\n”?

eg. 

q)value “x:1\nx+1”

'type

in this example:

q)last value each “\n"vs"x:1\nx+1”

2

It doesn’t sound like you’ll need it but another option is to write to a temp file:<o:p></o:p>

<o:p> </o:p>

q){hsym[`$f:“c:\temp\blah.q”] 0: enlist x; system"l ",f}“x:1\nx+1”<o:p></o:p>

2<o:p></o:p>

q)x<o:p></o:p>

1<o:p></o:p>

<o:p> </o:p>

This approach will work if there are multi-line function definitions.<o:p></o:p>

<o:p> </o:p>

The main disadvantage is you can’t grab the final output, only see it on screen (but you see intermediate outputs too) unlike value.<o:p></o:p>

<o:p> </o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Jack Andrews
Sent: Friday, October 30, 2015 9:18 PM
To: Kdb+ Personal Developers
Subject: Re: [personal kdb+] run q-sql as string<o:p></o:p>

<o:p> </o:p>

parse and value do not work well with “\n”.  do your ‘big ones’ have “\n”?<o:p></o:p>

<o:p> </o:p>

eg. <o:p></o:p>

 q)value “x:1\nx+1”<o:p></o:p>

 'type<o:p></o:p>

<o:p> </o:p>

in this example:<o:p></o:p>

<o:p> </o:p>

 q)last value each “\n"vs"x:1\nx+1”<o:p></o:p>

 2<o:p></o:p>

<o:p> </o:p>

<o:p> </o:p>

On 31 October 2015 at 07:07, David Demner <david.demner@aquaq.co.uk> wrote:<o:p></o:p>

value

value"1+1"

(works for a lot more than strings like value(+;1;1) works)

  Original Message  
From: analyst
Sent: Friday, October 30, 2015 12:52
To: Kdb+ Personal Developers
Reply To: personal-kdbplus@googlegroups.com
Subject: [personal kdb+] run q-sql as string<o:p></o:p>

I want to run q-sql which is inputted as string to the program. ALL of them run fine in the console. I can use eval ( parse queryString) however the big ones dont parse fine and hence dont run. Is there a way to just run them without using eval/parse ?


Submitted via Google Groups