本文整理汇总了PHP中DBQuery::createTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::createTable方法的具体用法?PHP DBQuery::createTable怎么用?PHP DBQuery::createTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBQuery
的用法示例。
在下文中一共展示了DBQuery::createTable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install()
{
$ok = true;
$q = new DBQuery();
$sql = "(\n\t\t\tresource_id integer not null auto_increment,\n\t\t\tresource_name varchar(255) not null default '',\n\t\t\tresource_key varchar(64) not null default '',\n\t\t\tresource_type integer not null default 0,\n\t\t\tresource_note text not null default '',\n\t\t\tresource_max_allocation integer not null default 100,\n\t\t\tprimary key (resource_id),\n\t\t\tkey (resource_name),\n\t\t\tkey (resource_type)\n\t\t)";
$q->createTable('resources');
$q->createDefinition($sql);
$ok = $ok && $q->exec();
$q->clear();
$sql = "(\n\t\t\tresource_type_id integer not null auto_increment,\n\t\t\tresource_type_name varchar(255) not null default '',\n\t\t\tresource_type_note text,\n\t\t\tprimary key (resource_type_id)\n\t\t)";
$q->createTable('resource_types');
$q->createDefinition($sql);
$ok = $ok && $q->exec();
$q->clear();
$sql = "(\n\t\t\tresource_id integer not null default 0,\n\t\t\ttask_id integer not null default 0,\n\t\t\tpercent_allocated integer not null default 100,\n\t\t\tkey (resource_id),\n\t\t\tkey (task_id, resource_id)\n\t\t)";
$q->createTable('resource_tasks');
$q->createDefinition($sql);
$ok = $ok && $q->exec();
$q->clear();
$q->addTable('resource_types');
$q->addInsert('resource_type_name', 'Equipment');
$q->exec();
$q->addInsert('resource_type_name', 'Tool');
$q->exec();
$q->addInsert('resource_type_name', 'Venue');
$ok = $ok && $q->exec();
if (!$ok) {
return false;
}
return null;
}
示例2: install
function install()
{
$q = new DBQuery();
$q->createTable('risks');
$sql = '(
`risk_id` int(10) unsigned NOT NULL auto_increment,
`risk_name` varchar(50) default NULL,
`risk_description` text,
`risk_probability` tinyint(3) default 100,
`risk_status` text default NULL,
`risk_owner` int(10) default NULL,
`risk_project` int(10) default NULL,
`risk_task` int(10) default NULL,
`risk_impact` int(10) default NULL,
`risk_duration_type` tinyint(10) default 1,
`risk_notes` text,
PRIMARY KEY (`risk_id`),
UNIQUE KEY `risk_id` (`risk_id`),
KEY `risk_id_2` (`risk_id`))
TYPE=MyISAM';
$q->createDefinition($sql);
$q->exec();
$q->clear();
$q->createTable('risk_notes');
$sql = '(
`risk_note_id` int(11) NOT NULL auto_increment,
`risk_note_risk` int(11) NOT NULL default \'0\',
`risk_note_creator` int(11) NOT NULL default \'0\',
`risk_note_date` datetime NOT NULL default \'0000-00-00 00:00:00\',
`risk_note_description` text NOT NULL,
PRIMARY KEY (`risk_note_id`)
) TYPE=MyISAM';
$q->createDefinition($sql);
$q->exec();
$q->clear();
$q->addTable('sysvals');
$q->addInsert('sysval_key_id', 1);
$q->addInsert('sysval_title', 'RiskProbability');
$q->addInsert('sysval_value', "0|Not Specified\n1|Low\n2|Medium\n3|High");
$q->exec();
$q->clear();
$q->addTable('sysvals');
$q->addInsert('sysval_key_id', 1);
$q->addInsert('sysval_title', 'RiskStatus');
$q->addInsert('sysval_value', "0|Not Specified\n1|Open\n2|Closed\n3|Not Applicable");
$q->exec();
$q->clear();
$q->addTable('sysvals');
$q->addInsert('sysval_key_id', 1);
$q->addInsert('sysval_title', 'RiskImpact');
$q->addInsert('sysval_value', "0|Not Specified\n1|Low\n2|Medium\n3|High\n4|Super High");
$q->exec();
$q->clear();
return true;
}
示例3: install
public function install()
{
$ok = true;
$q = new DBQuery();
$sql = '(
resource_id integer not null auto_increment,
resource_name varchar(255) not null default "",
resource_key varchar(64) not null default "",
resource_type integer not null default 0,
resource_note text not null default "",
resource_max_allocation integer not null default 100,
primary key (resource_id),
key (resource_name),
key (resource_type)
)';
$q->createTable('resources', $sql);
$ok = $ok && $q->exec();
$q->clear();
$sql = '(
resource_type_id integer not null auto_increment,
resource_type_name varchar(255) not null default "",
resource_type_note text,
primary key (resource_type_id)
)';
$q->createTable('resource_types', $sql);
$ok = $ok && $q->exec();
$q->clear();
$sql = '(
resource_id integer not null default 0,
task_id integer not null default 0,
percent_allocated integer not null default 100,
key (resource_id),
key (task_id, resource_id)
)';
$q->createTable('resource_tasks', $sql);
$ok = $ok && $q->exec();
$q->clear();
$q->addTable('resource_types');
$q->addInsert('resource_type_name', 'Equipment');
$q->exec();
$q->addInsert('resource_type_name', 'Tool');
$q->exec();
$q->addInsert('resource_type_name', 'Venue');
$ok = $ok && $q->exec();
if (!$ok) {
return false;
}
return null;
}
示例4: install
function install()
{
$sql = " ( " . "history_id int(10) unsigned NOT NULL auto_increment," . "history_user int(10) NOT NULL default '0'," . "history_action varchar(10) NOT NULL default 'modify', " . "history_item int(10) NOT NULL," . "history_table varchar(15) NOT NULL default ''," . "history_project int(10) NOT NULL default '0'," . "history_date datetime NOT NULL default '0000-00-00 00:00:00'," . "history_description text," . "PRIMARY KEY (history_id)," . "UNIQUE KEY history_id (history_id)" . ") TYPE=MyISAM";
$q = new DBQuery();
$q->createTable('history');
$q->createDefinition($sql);
$q->exec();
$q->clear();
return db_error();
}
示例5: install
function install()
{
$sql = '(
timesheet_id INT(11) NOT NULL AUTO_INCREMENT,
user_id INT(11) ,
timeset DATE ,
PRIMARY KEY (`timesheet_id`)
)
ENGINE = MyISAM';
$sql2 = '(
activity_id INT(12) NOT NULL AUTO_INCREMENT,
user_id INT(11) ,
task_id INT(11) ,
date DATE ,
duration TINYINT(1) ,
activity_timesheet INT(11),
PRIMARY KEY (`activity_id`),
FOREIGN KEY (`activity_timesheet`) REFERENCES timesheet (`timesheet_id`)
)
ENGINE = MyISAM';
$sql3 = '(
task_id INT(11) NOT NULL,
timesheet_id INT(11) NOT NULL,
status TINYINT(1) ,
PRIMARY KEY (`task_id`, `timesheet_id`)
)
ENGINE = MyISAM';
$q = new DBQuery();
$q->createTable('timesheet');
$q->createDefinition($sql);
$q->exec();
$q->clear();
$q->createTable('activity');
$q->createDefinition($sql2);
$q->exec();
$q->clear();
$q->createTable('task_timesheet');
$q->createDefinition($sql3);
$q->exec();
$q->clear();
return db_error();
}
示例6: install
function install()
{
$q = new DBQuery();
$q->createTable('links');
$q->createDefinition("(\n`link_id` int(11) NOT NULL AUTO_INCREMENT ,\n`link_url` varchar(255) NOT NULL default '',\n`link_project` int(11) NOT NULL default '0',\n`link_task` int(11) NOT NULL default '0',\n`link_name` varchar(255) NOT NULL default '',\n`link_parent` int(11) default '0',\n`link_description` text,\n`link_owner` int(11) default '0',\n`link_date` datetime default NULL ,\n`link_icon` varchar(20) default 'obj/',\n`link_category` int(11) NOT NULL default '0',\nPRIMARY KEY (`link_id`) ,\nKEY `idx_link_task` (`link_task`) ,\nKEY `idx_link_project` (`link_project`) ,\nKEY `idx_link_parent` (`link_parent`) \n) DEFAULT CHARSET utf8");
$q->exec($sql);
$q->clear();
$q->addTable('sysvals');
$q->addInsert('sysval_key_id', 1);
$q->addInsert('sysval_title', 'LinkType');
$q->addInsert('sysval_value', "0|Unknown\n1|Document\n2|Application");
$q->exec();
return NULL;
}