PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/arc2/store/ARC2_StoreAskQueryHandler.php

https://bitbucket.org/rhiaro/public-notices-as-georss
PHP | 53 lines | 26 code | 14 blank | 13 comment | 0 complexity | c4922907acbbe23cce94a2feeefa4738 MD5 | raw file
  1. <?php
  2. /**
  3. * ARC2 SPARQL ASK query handler
  4. *
  5. * @author Benjamin Nowack
  6. * @license <http://arc.semsol.org/license>
  7. * @homepage <http://arc.semsol.org/>
  8. * @package ARC2
  9. * @version 2010-11-16
  10. */
  11. ARC2::inc('StoreSelectQueryHandler');
  12. class ARC2_StoreAskQueryHandler extends ARC2_StoreSelectQueryHandler {
  13. function __construct($a, &$caller) {/* caller has to be a store */
  14. parent::__construct($a, $caller);
  15. }
  16. function __init() {/* db_con */
  17. parent::__init();
  18. $this->store = $this->caller;
  19. }
  20. /* */
  21. function runQuery($infos) {
  22. $infos['query']['limit'] = 1;
  23. $this->infos = $infos;
  24. $this->buildResultVars();
  25. return parent::runQuery($this->infos);
  26. }
  27. /* */
  28. function buildResultVars() {
  29. $this->infos['query']['result_vars'][] = array('var' => '1', 'aggregate' => '', 'alias' => 'success');
  30. }
  31. /* */
  32. function getFinalQueryResult($q_sql, $tmp_tbl) {
  33. $con = $this->store->getDBCon();
  34. $rs = mysql_query('SELECT success FROM ' . $tmp_tbl, $con);
  35. $r = ($row = mysql_fetch_array($rs)) ? $row['success'] : 0;
  36. return $r ? true : false;
  37. }
  38. /* */
  39. }