本文整理汇总了PHP中Quote::find_by_query方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::find_by_query方法的具体用法?PHP Quote::find_by_query怎么用?PHP Quote::find_by_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote::find_by_query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Quote
function _min_max($date)
{
$conn = $this->get_connection();
$quote = new Quote();
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($_GET['isin'])}' " . "AND `data` >= '{$conn->escape($date)}' " . 'ORDER BY `quotazione` DESC ' . 'LIMIT 1');
$max_quote = $quotes[0]->quotazione;
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($_GET['isin'])}' " . "AND `data` >= '{$conn->escape($date)}' " . 'ORDER BY `quotazione` ASC ' . 'LIMIT 1');
$min_quote = $quotes[0]->quotazione;
die('({min:' . $min_quote . ',max:' . $max_quote . '})');
}
示例2: for_range_and_order
public static function for_range_and_order($isin, $date_from, $date_to, $order_by, $sort_dir)
{
$conn = Db::get_connection();
$quote = new Quote();
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($isin)}' " . "AND `data` > '{$conn->escape($date_from)}' " . "AND `data` < '{$conn->escape($date_to)}' " . "ORDER BY `{$conn->escape($order_by)}` {$conn->escape(strtoupper($sort_dir))} " . 'LIMIT 1');
// print_r($quotes);
Db::close_connection($conn);
return $quotes[0];
}
示例3: index
function index()
{
$conn = $this->get_connection();
$item_factory = new WatchlistItem();
$this->items = $item_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($_COOKIE['username'])}' ", 'order_by' => sprintf('`%s` %s', $this->get_sort('isin'), $this->get_dir()), 'limit' => $this->get_limit()));
if (count($this->items) > 0) {
foreach ($this->items as $item) {
$item->stock = new Stock();
$item->stock->find_by_id($item->isin);
$quote = new Quote();
$quotes = $quote->find_all(array('where_clause' => "`isin` = '{$conn->escape($item->isin)}' ", 'order_by' => '`data` DESC, `ora` DESC', 'limit' => 1));
$item->quote = $quotes[0];
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($item->isin)}' " . "AND `data` >= '{$conn->escape(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') - 1)))}' " . 'ORDER BY `quotazione` DESC ' . 'LIMIT 1');
$item->max_quote = $quotes[0];
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($item->isin)}' " . "AND `data` >= '{$conn->escape(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') - 1)))}' " . 'ORDER BY `quotazione` ASC ' . 'LIMIT 1');
$item->min_quote = $quotes[0];
}
}
}
示例4: inspect
/**
* @fn inspect
* @short Inspects an instrument
* @details Action to inspect an instrument, used internally by #browse to
* render the main view.
*/
public function inspect()
{
$conn = $this->get_connection();
$isin = isset($_REQUEST['id']) ? $_REQUEST['id'] : $_REQUEST['isin'];
$this->stock = new Stock();
$this->stock->find_by_id($isin);
$yesterday = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) - 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
$tomorrow = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) + 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
$quote = new Quote();
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($this->stock->isin)}' " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `quotazione` DESC ' . 'LIMIT 1');
$this->stock->day_max = count($quotes) > 0 ? $quotes[0] : $quote;
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($this->stock->isin)}' " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `quotazione` ASC ' . 'LIMIT 1');
$this->stock->day_min = count($quotes) > 0 ? $quotes[0] : $quote;
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($this->stock->isin)}' " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` ASC, `ora` ASC ' . 'LIMIT 1');
$this->stock->open = count($quotes) > 0 ? $quotes[0] : $quote;
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($this->stock->isin)}' " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` DESC, `ora` DESC ' . 'LIMIT 1');
$this->stock->last = count($quotes) > 0 ? $quotes[0] : $quote;
}