CodeIgniter Forums
MySQL copy table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: MySQL copy table (/showthread.php?tid=27978)



MySQL copy table - El Forum - 02-26-2010

[eluser]Unknown[/eluser]
I'm trying to execute a MySQL COPY TABLE command, and can't figure out how to do this through an Active Record class. It doesn't really fall under Selecting, Inserting, Updating, or Deleting.

Is this possible? I've been reading the Active Record Class page at http://ellislab.com/codeigniter/user-guide/database/active_record.html, and googling around, but nothing seems to pop up.

Anything along the lines of $this->db->do or $this->db->execute would be great; something that lets me execute an arbitrary SQL query. Anyone have ideas?

Thanks =)


MySQL copy table - El Forum - 02-26-2010

[eluser]Jamie Rumbelow[/eluser]
Hey garrett.reid,

Because COPY TABLE is a proprietary command, you will have to run custom SQL, but usually, stuff like this falls under the Database Forge library, which is really neat, so go and check it out. To run raw SQL, just use the $this->db->query() command, which has exactly the same response as $this->db->get() (which uses query underneath.)

Jamie