/** * In cases where the query is a raw string (as opposed to a `Query` object), the database must * determine the correct column names from the result resource. * * @param object|string $query * @param object $mysqliResult * @param object $context * @return array Field names */ public function columns($query, $mysqliResult = null, $context = null) { if (is_object($query)) { return parent::columns($query, $mysqliResult, $context); } $result = array(); while ($fieldInfo = $mysqliResult->fetch_field()) { $result[] = $fieldInfo->name; } return $result; }
/** * In cases where the query is a raw string (as opposed to a `Query` object), to database must * determine the correct column names from the result resource. * * @param mixed $query * @param resource $resource * @param object $context * @return array */ public function columns($query, $resource = null, $context = null) { if (is_object($query)) { return parent::columns($query, $resource, $context); } $result = array(); $count = $resource->numColumns(); for ($i = 0; $i < $count; $i++) { $result[] = $resource->columnName($i); } return $result; }
/** * In cases where the query is a raw string (as opposed to a `Query` object), to database must * determine the correct column names from the result resource. * * @param mixed $query * @param resource $resource * @param object $context * @return array */ public function columns($query, $resource = null, $context = null) { if (is_object($query)) { return parent::columns($query, $resource, $context); } $result = array(); $count = mysql_num_fields($resource); for ($i = 0; $i < $count; $i++) { $result[] = mysql_field_name($resource, $i); } return $result; }