PHP PQL StatementBuilder(): cannot use an array as a bind variable for an IN clause.

572 views
Skip to first unread message

Rolf

unread,
Mar 27, 2015, 10:38:23 PM3/27/15
to google-doubleclick...@googlegroups.com

Hi,

I'm trying to use an array as a bind variable for a PQL IN clause in the context of service=LineItemService and method=getLineItemsByStatement.
The idea is that it is good practice to use bind vars instead of manually concatenating/converting/encoding values within the PQL command strings.
But I cannot get it to work.

The client library seems to accept it but the SOAP response always contains this fault:
faultMessage=[PublisherQueryLanguageContextError.UNEXECUTABLE @ com.google.ads.publisher.infrastructure.persistence.common.pebl.sqlgen.AnnotationDrivenValueGenerator@e162b31 doesn't support com.google.ads.publisher.common.query.model.value.SetValue@34110ad9 (class com.google.ads.publisher.common.query.model.value.SetValue)


PHP Code:
    $lineItemService = $user->GetService('LineItemService', 'v201502');
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Where('id IN (:myIdList)')
        ->OrderBy('id ASC')
        ->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)
        ->WithBindVariableValue(
            'myIdList',
            array('32889088','34320688')
            //'34320688'
        );

Logs:



Can you please help me with this?

--
Thank you,
Rolf.


Vincent Tsao (DFP API Team)

unread,
Mar 30, 2015, 9:49:33 PM3/30/15
to google-doubleclick...@googlegroups.com
Hi Rolf:

PQL doesn't currently support arrays as bind values. You'll need to convert it into a comma delimited string.

Thanks,
Vincent Tsao, DFP API Team

Rolf

unread,
Mar 31, 2015, 8:40:05 AM3/31/15
to google-doubleclick...@googlegroups.com
Vincent,
Okay.

Regarding the IN() clause containing a comma delim string and Order Id's and LineItem ID's: do these ID's have to be enclosed in single quotes, or can I enumerate them as numbers? If both are possible, which approach do you prefer?



--
Rolf.

Vincent Tsao (DFP API Team)

unread,
Mar 31, 2015, 11:01:20 AM3/31/15
to google-doubleclick...@googlegroups.com
I believe they should both work, but I would enumerate them as numbers.

Thanks,
Vincent Tsao, DFP API Team

Tatiana Kononova

unread,
Aug 31, 2015, 6:08:53 AM8/31/15
to Google's DoubleClick for Publishers API Forum
Hi, Vincent!

I tried to use com.google.api.ads.dfp.axis.v201502.SetValue as binding value with following query
  
id IN (:id)

and got such error:

[PublisherQueryLanguageContextError.UNEXECUTABLE @ Unable to execute filter: where id in (('262', '382', '50062', '502', '51022', '51142', '51262', '54022', '54142', '60742', '60862', '62182', '62302', '65062', '65422', '68302', '69382', '70342', '71182', '76462', '76702', '76822', '76942', '79222', '82582', '84502', '8902', '89542', '9262', '9382', '96142', '96502', '96982', '97342', '97582', '97822', '9862', '99982'))]

Do you plan to support SetValue in binding?

Best regards,
Tatiana

Vincent Tsao (DFP API Team)

unread,
Aug 31, 2015, 8:58:51 AM8/31/15
to Google's DoubleClick for Publishers API Forum
Hi Tatiana:

We have considered it, but no immediate plans. I will give your feedback to the team. But for now, you'll need to join your array into a comma delimited string.

Thanks,
Vincent Tsao, DFP API Team


Tatiana Kononova

unread,
Aug 31, 2015, 9:09:30 AM8/31/15
to Google's DoubleClick for Publishers API Forum
Looks like it almost implemented :)
Thanks!
Reply all
Reply to author
Forward
0 new messages