summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli/mysqli_result.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-24 20:05:17 +0200
committeradmin <devnull@localhost>2006-09-24 20:05:17 +0200
commit7b613c7000a496fe0e4f9152ee8937d06eba2301 (patch)
treea99e2d55c859367324cec7d0f5739d7bf9a096df /system/database/drivers/mysqli/mysqli_result.php
parentb2ab51b432e4de4aeb551ca17cba323ad729f406 (diff)
Adding database folder
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_result.php')
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php129
1 files changed, 129 insertions, 0 deletions
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
new file mode 100644
index 000000000..b0db6c106
--- /dev/null
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -0,0 +1,129 @@
+<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Code Igniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author Rick Ellis
+ * @copyright Copyright (c) 2006, pMachine, Inc.
+ * @license http://www.codeignitor.com/user_guide/license.html
+ * @link http://www.codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQLi Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category Database
+ * @author Rick Ellis
+ * @link http://www.codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysqli_result extends CI_DB_result {
+
+ /**
+ * Number of rows in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_rows()
+ {
+ return @mysqli_num_rows($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Number of fields in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_fields()
+ {
+ return @mysqli_num_fields($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data
+ *
+ * Generates an array of objects containing field meta-data
+ *
+ * @access public
+ * @return array
+ */
+ function field_data()
+ {
+ $retval = array();
+ while ($field = mysqli_fetch_field($this->result_id))
+ {
+ $F = new stdClass();
+ $F->name = $field->name;
+ $F->type = $field->type;
+ $F->default = $field->def;
+ $F->max_length = $field->max_length;
+ $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0;
+
+ $retval[] = $F;
+ }
+
+ return $retval;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Free the result
+ *
+ * @return null
+ */
+ function free_result()
+ {
+ if (is_resource($this->result_id))
+ {
+ mysqli_free_result($this->result_id);
+ $this->result_id = FALSE;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - associative array
+ *
+ * Returns the result set as an array
+ *
+ * @access private
+ * @return array
+ */
+ function _fetch_assoc()
+ {
+ return mysqli_fetch_assoc($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - object
+ *
+ * Returns the result set as an object
+ *
+ * @access private
+ * @return object
+ */
+ function _fetch_object()
+ {
+ return mysqli_fetch_object($this->result_id);
+ }
+
+}
+
+?> \ No newline at end of file