- changed the function in order to use other ci's db driver. [as noted by: vstam_]
Added a function set_database($db_name) to handle situations where you establish multiple databases connections in your config/database file.
Update application/libraries/Datatables.php
Added the functions to generate DISTINCT and GROUP_BY optimizations.
Function descriptions added
Debug ECHO removed
Merge pull request #11 from jtrainaldi/master

Library Additions
using ->ci->db->escape() instead of mysql_real_escape_string, which doesn't work with other databases, and/or mysqli.
Merge pull request #14 from williamhrs/master

Changed from mysql_real_escape_string to $this->ci->db->escape()
Update application/libraries/Datatables.php

As the conditional is being placed with a LIKE comparison function, 
the codeigniter documentation recommends using escape_like_str() 
(http://codeigniter.com/user_guide//database/queries.html). 
I was getting ' placed within the statement '%'xxx'%'...
Merge pull request #19 from pestlett/patch-1

Update application/libraries/Datatables.php
- maintenance updates: code cleanup, refactoring
- fixed a bug resulting in "ERROR 1066 (42000): Not unique table/alias"
- updated discussion url
- minor bug fix
add group_by function in get_total_results function

the total result is not the same with the result rows when use group_by, so I added the group_by function and return $q->num_rows() instead of $this->ci->db->count_all_results($this->table)
Update Datatables.php

mysql_real_escape_string to $this->ci->db->escape_like_str
Merge pull request #25 from vachzar/patch-1

add group_by function in get_total_results function
Merge pull request #26 from ahmetkapikiran/patch-1

Update Datatables.php
added custom GROUP BY functionality

Usage: $this->datatables->group_by('table.id');