By mpapet on
Hi,
I need to use a SQL view for a custom module. I have successfully created a table using the module.install file and database API, but I'm having trouble figuring out how to send a sql script that generates the view straight to the database (no Drupal database API) from the 7.x install file.
It's probably obvious, but I'm not that experienced. The terms 'drupal' and 'views' obviously don't return relevant search results. Can someone point me in the right direction?
Thanks in advance.
Mpapet
Comments
Are you talking about the
Are you talking about the "views" module?
Not Views Module
A different way to ask the question: How can I execute a sql script from the .install file?
Not the Views module, SQL views. http://dev.mysql.com/doc/refman/5.0/en/create-view.html Views in SQL are, roughly speaking a way to create what looks and acts like a table, yet is data from other tables.
You can put additional code
You can put additional code into hook_install() in your .install file if you want it executed on installation of the module.
Contact me to contract me for D7 -> D10/11 migrations.
hook_install is 6.x
Hi again,
Hook_install is in drupal 6.x, I'm on 7.x. Reading through the database API docs, it doesn't look like it can be done.
The install hook does exist
The install hook does exist in Drupal 7:
http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...
As far as I know, the Schema module does not handle database views so you will probably have to fall back to writing your 'CREATE VIEW...' statement and executing it directly.
--
Read more at iRolo.net