<?php

function loopfusewebform_install() {
  $success = FALSE;

  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $success = db_query("CREATE TABLE if not exists {loopfusewebform} (
        vid int(10) unsigned NOT NULL,
				lf_form_id varchar(40) NOT NULL,
        PRIMARY KEY  (vid)
        ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */"
      );
      break;

  case 'pgsql':
 	 $success = db_query("CREATE TABLE {loopfusewebform} (
	    vid int_unsigned NOT NULL,
   		lf_form_id varchar(40) NOT NULL,
	    PRIMARY KEY  (vid)
    	)"
  	 );
     break;
  }

  if ($success) {
    drupal_set_message(t('LoopFuse Webform module installed module tables successfully.'));
  }
  else {
    drupal_set_message(t('The installation of LoopFuse webform module was unsuccessful.'), 'error');
  }
}

/**
 * Remove tables on uninstall.
 */
function loopfusewebform_uninstall() {
  db_query("DROP TABLE {loopfusewebform}");
}