php-sql-query-builder icon indicating copy to clipboard operation
php-sql-query-builder copied to clipboard

Get part of a generated query

Open alexschwarz89 opened this issue 10 years ago • 2 comments

Is there any possibility to generate a part of a query manually?

I need this ALIASED Select for example

MATCH(a,b) AGAINST ('term') AS relevance

So I already have this part generated by matchBoolean, would be nice to re-use

alexschwarz89 avatar May 25 '15 17:05 alexschwarz89

OK – figured out this way. Maybe there is a shorter? ;-)

$whereCond = new Where(QueryFactory::createSelect());
$whereCond->eq('test', 1);

$writer = new WhereWriter(new GenericBuilder(), new PlaceholderWriter());
var_dump($writer->writeWhereClauses($whereCond));

alexschwarz89 avatar May 25 '15 17:05 alexschwarz89

No shortcut right now for this!

Certainly this should be documented and a shortcut could be build... Thanks for reporting, I will consider! :)

nilportugues avatar May 25 '15 18:05 nilportugues