[CWB] Query lock violation

Alberto Simões ambs at di.uminho.pt
Wed Nov 24 20:18:34 CET 2010



On 24/11/2010 19:02, Stefan Evert wrote:
> That should work, and definitely _not_ produce a query lock violation.  Keep in mind that a bare query doesn't return any results in CWB::CQP, which sets "AutoShow off".  It's better to use the command
>
> 	A = "europe"
>
> so you can access the query results under a well-defined name (rather than the implicit "Last" variable).
>
> Query lock mode activates hooks in the parser that disallow _every_ command except for queries (assignment to a variable as in my example above is allowed).  That's about the only safe way to allow users to enter a CQP query through a Web interface without compromising your entire server.
>
> The typical idiom in a Web interface would be:
>
> $cqp->exec_query("A = $user_query");
> ($N) = $cqp->exec("size A");
> if ($N>  0) {
> 	@lines = $cqp->exec("cat A");
> }
>

Aha!
Thanks for the explanation, Stefan. Now I understand what's going on.

Cheers
Alberto
-- 
Alberto Simões


More information about the CWB mailing list