Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
790 B

  1. <?php
  2. use Friendica\Database\DBA;
  3. /**
  4. * @brief execute SQL query with printf style args - deprecated
  5. *
  6. * Please use the DBA:: functions instead:
  7. * DBA::select, DBA::exists, DBA::insert
  8. * DBA::delete, DBA::update, DBA::p, DBA::e
  9. *
  10. * @param $args Query parameters (1 to N parameters of different types)
  11. * @return array|bool Query array
  12. * @deprecated
  13. */
  14. function q($sql) {
  15. $args = func_get_args();
  16. unset($args[0]);
  17. if (!DBA::$connected) {
  18. return false;
  19. }
  20. $sql = DBA::cleanQuery($sql);
  21. $sql = DBA::anyValueFallback($sql);
  22. $stmt = @vsprintf($sql, $args);
  23. $ret = DBA::p($stmt);
  24. if (is_bool($ret)) {
  25. return $ret;
  26. }
  27. $columns = DBA::columnCount($ret);
  28. $data = DBA::toArray($ret);
  29. if ((count($data) == 0) && ($columns == 0)) {
  30. return true;
  31. }
  32. return $data;
  33. }