Welcome Guest, Not a member yet? Register   Sign In
Active Record and SQL Views
#1

[eluser]vickel[/eluser]
is there an active record function to create SQL views?

something short to substitute e.g.
Code:
$sql = "CREATE OR REPLACE VIEW my_new_view AS
    SELECT *
    FROM tableA
      ";

if not, is there a way to combine above $sql syntax with active record? lets say combine
Code:
$sql = "CREATE OR REPLACE VIEW my_new_view AS"

with

Code:
$this->db->select('*');
$this->db->from('tableA');

and then call it like below:

Code:
$query = $this->db->get();
return $query->result();
#2

[eluser]PhilTem[/eluser]
To my knowledge VIEWS as well as REPLACE INTO are not supported by CI's database driver. And as far as I know VIEWS are something MySQL specific so it won't be in the DB driver since this shall be a universal database driver and not tailored to meet one specific db engine Wink

But I may be wrong though (at least with the views are only available in MySQL part)
#3

[eluser]vickel[/eluser]
thanks, I thought so, as there were no hints in the user manual. I've done it by the traditional way:

Code:
$sql = "my query string";
$this->db->query($sql);




Theme © iAndrew 2016 - Forum software by © MyBB