Dynamic Creation MySQL Database (Not Table)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MLT
    Mini Mivite


    • Jul 2007
    • 97

    #1

    Dynamic Creation MySQL Database (Not Table)

    Is there a way using miva to create a mysql database? We have no issue creating tables dynamically but I'm stumped on creating the actual database.

    Thanks,
    -mike
  • Kent Multer
    Mega Mivite









    • Mar 2006
    • 3252

    #2
    Have you tried MvQUERY?
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment

    • wmgilligan
      Developer Partner




      • Feb 2006
      • 742

      #3
      There is!
      Code:
      <MvQuery name="newTables" QUERY="{ 'CREATE TABLE `history` ( `firstName` VARCHAR(200) NOT NULL, `lastName` VARCHAR(250) NOT NULL, `company` VARCHAR(100) NOT NULL, ``Cost` DECIMAL(7,2) NOT NULL, acct` INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT ) ENGINE = InnoDB;' }">
      
      And to alter one...
      <MvQuery name="newTables" QUERY="{ 'ALTER TABLE `history` ADD INDEX (`lastName`), ADD INDEX (`company`), ADD FULLTEXT `lastComp` (`lastName`, `company`);' }">
      William Gilligan - Orange Marmalade, Inc.
      www.OrangeMarmaladeinc.com

      Comment

      • ILoveHostasaurus
        Mega Mivite










        • Mar 2006
        • 4998

        #4
        It would be very unusual for database creation to be possible via an application, since the credentials used for the database connection would never have that grant. You can of course issue a database create query if you've got an application with a user that has that grant.
        David Hubbard
        CIO
        Miva
        [email protected]
        http://www.miva.com

        Comment

        Working...
        X