Monday, February 1, 2010

Re: checking whether a table exists

You can try this, then see if your table exists within the array.

http://www.milesj.me/blog/read/75/Retrieving-Tables-Within-Your-Cake-Database

On Feb 1, 8:27 am, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> Hi
>
> is this a correct way of checking whether a table exists?
>
>         function check_table_exists($table) {
>                 $dbo = $this->getDataSource();
>                 $result = $dbo->_execute('DESCRIBE '.$table);
>                 return !empty($result);
>         }
>
> thanks in advance
>         Lorenzo
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: