dibi::fetchSingle PHP Method

fetchSingle() public static method

Executes SQL query and fetch first column - Monostate for Dibi\Connection::query() & fetchSingle().
public static fetchSingle ( $args ) : string
return string
    public static function fetchSingle($args)
    {
        $args = func_get_args();
        return self::getConnection()->query($args)->fetchSingle();
    }

Usage Example

示例#1
0
 /**
  * Translates the given string.
  * @param  string	translation string
  * @param  int		count (positive number)
  * @return string
  */
 public function translate($message, $count = 1)
 {
     $message = (string) $message;
     //		if (!empty($message) && isset($this->dictionary[$message])) {
     //			$word = $this->dictionary[$message];
     //			if ($count === NULL) $count = 1;
     //
     //			$s = preg_replace('/([a-z]+)/', '$$1', "n=$count;" . $this->meta['Plural-Forms']);
     //			eval($s);
     //			$message = $word->translate($plural);
     //		}
     if (!isset($this->translate[$message]) or $this->translate[$message] == '') {
         $message = $message;
         //			echo $message;exit;
         if (!dibi::fetchSingle("SELECT 1 FROM [lang_translate] WHERE [key] LIKE %s", $message, "AND [id_lang] = %i", $this->id_lang)) {
             //				echo dibi::$sql;
             Lang::insertTranslateKey($message, $this->id_lang);
         }
         $this->translate[$message] = $message;
         Lang::invalidateCache();
     } else {
         $message = $this->translate[$message];
     }
     //
     //		$args = func_get_args();
     //		if (count($args) > 1) {
     //			array_shift($args);
     //			$message = vsprintf($message, $args);
     //		}
     //
     //
     return $message;
 }
All Usage Examples Of dibi::fetchSingle