Welcome Guest, Not a member yet? Register   Sign In
Ability to specify index for query build from
#3

(05-28-2016, 02:53 AM)InsiteFX Wrote: You can always do anything almost using a standard query with ci even create tables etc;

PHP Code:
$sql "CREATE INDEX index_name ON table_name (column_name)";
$sql "CREATE UNIQUE INDEX index_name ON table_name (column_name)";

$query $this->db->query($sql); 

Using this method you can do almost anything with the database.

True, but for sake of getting proper syntax and avoid injection etc, etc we prefer the Query Builder functions.
I ended up patching DB_query_builder with a new function public function from_index($from, $index)
Simply inserting "USE INDEX($index)" after the table name.
Ugly but gets the job done - will probably bite us when we upgrade CI to next version....

Thanks,
/Mattias
Reply


Messages In This Thread
RE: Ability to specify index for query build from - by tgix - 05-28-2016, 02:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB