Welcome Guest, Not a member yet? Register   Sign In
How to Specify InnoDB table type
#1

[eluser]CW[/eluser]
I'm using Database Forge to create MySQL tables by defining fields in an array and creating tables as specified in the documentation. In this process is there a way to specify the table type as InnoDB?
Thanks,
CW
#2

[eluser]Randy Casburn[/eluser]
After a quick check of the code the answer is NO. There is no Engine='' option put into the SQL that creates the DB.

Randy
#3

[eluser]CW[/eluser]
That's what I suspected so I used:

$this->db->query("CREATE TABLE `hello` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=InnoDB AUTO_INCREMENT=1 ");

To get around this.
#4

[eluser]Randy Casburn[/eluser]
[quote author="CW" date="1219267323"]That's what I suspected so I used:

$this->db->query("CREATE TABLE `hello` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=InnoDB AUTO_INCREMENT=1 ");

To get around this.[/quote]

Just to be a nerd, TYPE= is deprecated, ENGINE= is now preferred.

But it won't matter for some time.

Randy
#5

[eluser]CW[/eluser]
Thanks for the comment. :exclaim: I've been taking my cues from phpMyAdmin which outputs Type when you generate sql export. :red:

For what it's worth, CI might consider adding an Engine=’’ option since transactions are promoted in the documentation and InnoDB is needed for that.
CW
#6

[eluser]Randy Casburn[/eluser]
I'm betting very very few of us use transaction, store procs, triggers, views or any of the really cool things MySQL will do :coolsmile:




Theme © iAndrew 2016 - Forum software by © MyBB