blob: 83fc870d0c3347dc8e1de5925c9aa896b728b4a6 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001#####################
2Custom Function Calls
3#####################
4
5$this->db->call_function();
6============================
7
8This function enables you to call PHP database functions that are not
9natively included in CodeIgniter, in a platform independent manner. For
vlakoff35672462013-02-15 01:36:04 +010010example, let's say you want to call the mysql_get_client_info()
Derek Jones8ede1a22011-10-05 13:34:52 -050011function, which is **not** natively supported by CodeIgniter. You could
12do so like this::
13
14 $this->db->call_function('get_client_info');
15
16You must supply the name of the function, **without** the mysql\_
17prefix, in the first parameter. The prefix is added automatically based
18on which database driver is currently being used. This permits you to
19run the same function on different database platforms. Obviously not all
20function calls are identical between platforms, so there are limits to
21how useful this function can be in terms of portability.
22
23Any parameters needed by the function you are calling will be added to
24the second parameter.
25
26::
27
28 $this->db->call_function('some_function', $param1, $param2, etc..);
29
30Often, you will either need to supply a database connection ID or a
31database result ID. The connection ID can be accessed using::
32
33 $this->db->conn_id;
34
35The result ID can be accessed from within your result object, like this::
36
Joseph Wensleyf24f4042011-10-06 22:53:29 -040037 $query = $this->db->query("SOME QUERY");
38
39 $query->result_id;