本文整理汇总了PHP中CI_DB_result类的典型用法代码示例。如果您正苦于以下问题:PHP CI_DB_result类的具体用法?PHP CI_DB_result怎么用?PHP CI_DB_result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CI_DB_result类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _process_query
/**
* Process Query
*
* Converts a query result into an array of objects.
* Also updates this object
*
* @ignore
* @param CI_DB_result $query
*/
protected function _process_query($query)
{
if ($query->num_rows() > 0) {
// Populate all with records as objects
$this->all = array();
$this->_to_object($this, $query->row());
// don't bother recreating the first item.
$index = $this->all_array_uses_ids && isset($this->id) ? $this->id : 0;
$this->all[$index] = $this->get_clone();
if ($query->num_rows() > 1) {
$model = get_class($this);
$first = TRUE;
foreach ($query->result() as $row) {
if ($first) {
$first = FALSE;
continue;
}
$item = new $model();
$this->_to_object($item, $row);
if ($this->all_array_uses_ids && isset($item->id)) {
$this->all[$item->id] = $item;
} else {
$this->all[] = $item;
}
}
}
// remove instantiations
$this->_instantiations = NULL;
// free large queries
if ($query->num_rows() > $this->free_result_threshold) {
$query->free_result();
}
} else {
// Refresh stored values is called by _to_object normally
$this->_refresh_stored_values();
}
}
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:46,代码来源:datamapper.php
示例2: _authenticate
/**
* Authenticate
*
* @access private
*/
private function _authenticate(CI_DB_result $member, $password)
{
$always_disallowed = array(4);
if ($member->num_rows() !== 1) {
return FALSE;
}
if (in_array($member->row('group_id'), $always_disallowed)) {
return ee()->output->show_user_error('general', lang('mbr_account_not_active'));
}
$m_salt = $member->row('salt');
$m_pass = $member->row('password');
// hash using the algo used for this password
$h_byte_size = strlen($m_pass);
$hashed_pair = $this->hash_password($password, $m_salt, $h_byte_size);
if ($hashed_pair === FALSE or $m_pass !== $hashed_pair['password']) {
return FALSE;
}
// Officially a valid user, but are they as secure as possible?
// ----------------------------------------------------------------
reset($this->hash_algos);
// Not hashed or better algo available?
if (!$m_salt or $h_byte_size != key($this->hash_algos)) {
$m_id = $member->row('member_id');
$this->update_password($m_id, $password);
}
$authed = new Auth_result($member->row());
$member->free_result();
return $authed;
}
开发者ID:nigelpeters,项目名称:css-recruitment-ee,代码行数:34,代码来源:Auth.php
示例3: xml_from_result
/**
* Generate XML data from a query result object
*
* @param object $query Query result object
* @param array $params Any preferences
* @return string
*/
public function xml_from_result(CI_DB_result $query, $params = array())
{
// Set our default values
foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) {
if (!isset($params[$key])) {
$params[$key] = $val;
}
}
// Create variables for convenience
extract($params);
// Load the xml helper
get_instance()->load->helper('xml');
// Generate the result
$xml = '<' . $root . '>' . $newline;
while ($row = $query->unbuffered_row()) {
$xml .= $tab . '<' . $element . '>' . $newline;
foreach ($row as $key => $val) {
$xml .= $tab . $tab . '<' . $key . '>' . xml_convert($val) . '</' . $key . '>' . $newline;
}
$xml .= $tab . '</' . $element . '>' . $newline;
}
return $xml . '</' . $root . '>' . $newline;
}
开发者ID:rgaringoy,项目名称:royportfolio,代码行数:30,代码来源:DB_utility.php
示例4: authenticate
public function authenticate(CI_DB_result $query)
{
$data = $query->row();
$this->core->session->set_userdata(array('id' => $data->id, 'logged_in' => TRUE));
}
开发者ID:bagaswidodo,项目名称:ci3-app,代码行数:5,代码来源:Auth.php
示例5: __construct
/**
* Class constructor
*
* @param object &$driver_object
* @return void
*/
public function __construct(&$driver_object)
{
parent::__construct($driver_object);
// Required, due to mysql_data_seek() causing nightmares
// with empty result sets
$this->num_rows = mysql_num_rows($this->result_id);
}
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:13,代码来源:mysql_result.php
示例6: generate
/**
* Untuk menghasilkan data excel
*
* @access public
* @return Excel_generator
*/
public function generate()
{
$start = $this->start;
if (count($this->header) > 0) {
$abj = 1;
foreach ($this->header as $row) {
$this->getActiveSheet()->setCellValue($this->columnName($abj) . $this->start, $row);
if ($this->header_bold) {
$this->getActiveSheet()->getStyle($this->columnName($abj) . $this->start)->getFont()->setBold(TRUE);
}
$abj++;
}
$start = $this->start + 1;
}
foreach ($this->query->result_array() as $result_db) {
$index = 1;
foreach ($this->column as $row) {
if (count($this->width) > 0) {
$this->getActiveSheet()->getColumnDimension($this->columnName($index))->setWidth($this->width[$index - 1]);
}
$this->getActiveSheet()->setCellValue($this->columnName($index) . $start, $result_db[$row]);
$index++;
}
$start++;
}
return $this;
}
开发者ID:mutaqin07,项目名称:php,代码行数:33,代码来源:Excel_generator.php
示例7: num_rows
/**
* Number of rows in the result set
*
* @return int
*/
public function num_rows()
{
// sqlsrv_num_rows() doesn't work with the FORWARD and DYNAMIC cursors (FALSE is the same as FORWARD)
if (!in_array($this->scrollable, [FALSE, SQLSRV_CURSOR_FORWARD, SQLSRV_CURSOR_DYNAMIC], TRUE)) {
return parent::num_rows();
}
return is_int($this->num_rows) ? $this->num_rows : ($this->num_rows = sqlsrv_num_rows($this->result_id));
}
开发者ID:DeDoOozZz,项目名称:brighterycms,代码行数:13,代码来源:sqlsrv_result.php
示例8: __construct
public function __construct(&$driver_object)
{
parent::__construct($driver_object);
$this->stmt_id = $driver_object->stmt_id;
$this->curs_id = $driver_object->curs_id;
$this->limit_used = $driver_object->limit_used;
$driver_object->stmt_id = FALSE;
}
开发者ID:rittidate,项目名称:sbobet-dev,代码行数:8,代码来源:oci8_result.php
示例9: __construct
/**
* Class constructor.
*
* @param object &$driver_object
*
* @return void
*/
public function __construct(&$driver_object)
{
parent::__construct($driver_object);
$this->stmt_id = $driver_object->stmt_id;
$this->curs_id = $driver_object->curs_id;
$this->limit_used = $driver_object->limit_used;
$this->commit_mode =& $driver_object->commit_mode;
$driver_object->stmt_id = false;
}
开发者ID:recca0120,项目名称:laraigniter,代码行数:16,代码来源:oci8_result.php
注:本文中的CI_DB_result类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论