ARC2_StoreAskQueryHandler.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. }