* For all regular queries please use dba::select or dba::exists
*
* @param string $sql SQL statement
- * @return object statement object
+ * @return bool|object statement object
*/
public static function p($sql) {
$a = get_app();
}
/**
- * @brief Fetches the first row
- *
- * Please use dba::select or dba::exists whenever this is possible.
+ * Fetches the first row
+ *
+ * Please use dba::selectOne or dba::exists whenever this is possible.
*
+ * @brief Fetches the first row
* @param string $sql SQL statement
* @return array first row of query
*/
/**
* @brief Returns the number of rows of a statement
*
- * @param object Statement object
+ * @param PDOStatement|mysqli_result|mysqli_stmt Statement object
* @return int Number of rows
*/
public static function num_rows($stmt) {
/**
* @brief Fetch a single row
*
- * @param object $stmt statement object
+ * @param PDOStatement|mysqli_result|mysqli_stmt $stmt statement object
* @return array current row
*/
public static function fetch($stmt) {
/**
* @brief Select rows from a table
*
- * @param string $table Table name
- * @param array $fields array of selected fields
- * @param array $condition array of fields for condition
- * @param array $params array of several parameters
+ * @param string $table Table name
+ * @param array $fields Array of selected fields, empty for all
+ * @param array $condition Array of fields for condition
+ * @param array $params Array of several parameters
*
- * @return boolean|object If "limit" is equal "1" only a single row is returned, else a query object is returned
+ * @return boolean|object
*
* Example:
* $table = "item";
* or:
* $condition = array("`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr');
*
- * $params = array("order" => array("id", "received" => true), "limit" => 1);
+ * $params = array("order" => array("id", "received" => true), "limit" => 10);
*
* $data = dba::select($table, $fields, $condition, $params);
*/
* @brief Closes the current statement
*
* @param object $stmt statement object
- * @return boolean was the close successfull?
+ * @return boolean was the close successful?
*/
public static function close($stmt) {
if (!is_object($stmt)) {
$name = ltrim(basename($uri), '~');
} else {
$local = str_replace('acct:', '', $uri);
- if (substr($local, 0, 2) == '//')
+ if (substr($local, 0, 2) == '//') {
$local = substr($local, 2);
+ }
$name = substr($local, 0, strpos($local, '@'));
}