Re: test a table existence
I'm interested in this too. I just spent an hour and a half looking for how to automatically create tables if they'er not present. I couldn't find anything about the CakePHP method of doing this. Automatic table creation seems like something that should be built into the bake script?? http://book.cakephp.org/view/456/query should help - it looks like you can take the MySQL dump, add "IF NOT EXIST" and put it in a query. It looks like the simplest thing to do would be to put the query in the constructor - instead of checking if the table exists, try to create it. I'm wondering if there's a way to get the affected rows in a table creation, if there's 0 affected rows, you know the table exists and can skip any other table creation queries (assuming that all the tables are created at once). Also, I was looking for applications written in Cake so I could see how they handled it. I can't seem to find ANY applications except http://www.fileshifter.se/en/index.html (1,399 Euros!) Is there a good list of cake applications somewhere? Thanks! On Sep 25, 3:10 am, "Gotzon Astondoa" <[EMAIL PROTECTED]> wrote: > I´m also interested in this, but have no idea. I´m new to Cake. > Nobody has a suggestion? > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: test a table existence
I´m also interested in this, but have no idea. I´m new to Cake. Nobody has a suggestion? 2008/9/25 forrestgump <[EMAIL PROTECTED]> > > nobody to give a suggestion ? > > On Sep 24, 2:47 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > Hello, > > Iam trying to figure out a way for a model to : > > 1)testtheexistenceof atable. > > 2)if thetabledoesnt exist i wish the model to create thetable. > > > > can someone help? > > > > Forrestgump > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: test a table existence
There's many ways to check if table ex. http://forums.mysql.com/read.php?101,33936,40320#msg-40320 If You want to *create* table, without any structure, you can play with CREATE TABLE IF NOT EXISTS in model's constructor. (there's model property $useTable too) //snipp public function __construct($id = null, $table = null, $ds = null) { parent::__construct($id, $table, $ds); } On Sep 25, 7:22 am, forrestgump <[EMAIL PROTECTED]> wrote: > nobody to give a suggestion ? > > On Sep 24, 2:47 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > Hello, > > Iam trying to figure out a way for a model to : > > 1)testtheexistenceof atable. > > 2)if thetabledoesnt exist i wish the model to create thetable. > > > can someone help? > > > Forrestgump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: test a table existence
nobody to give a suggestion ? On Sep 24, 2:47 pm, forrestgump <[EMAIL PROTECTED]> wrote: > Hello, > Iam trying to figure out a way for a model to : > 1)testtheexistenceof atable. > 2)if thetabledoesnt exist i wish the model to create thetable. > > can someone help? > > Forrestgump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
test a table existence
Hello, Iam trying to figure out a way for a model to : 1)test the existence of a table. 2)if the table doesnt exist i wish the model to create the table. can someone help? Forrestgump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---