本文整理汇总了PHP中SQL::newInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::newInstance方法的具体用法?PHP SQL::newInstance怎么用?PHP SQL::newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($prefs_)
{
Logger::debug('main', 'SharedFolderDB::internal::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$SharedFolder_table_structure = array('id' => 'varchar(255)', 'name' => 'varchar(255)', 'server' => 'varchar(255)', 'status' => 'varchar(255)');
$ret = $SQL->buildTable($sql_conf['prefix'] . SharedFolderDB_internal::$table, $SharedFolder_table_structure, array('id'));
Logger::debug('main', "SharedFolderDB::internal::init SQL table '" . $sql_conf['prefix'] . SharedFolderDB_internal::$table . "' created");
return true;
}
示例2: init
public static function init($prefs_)
{
Logger::debug('main', 'ProfileDB::internal::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$Profile_table_structure = array('id' => 'varchar(255)');
$ret = $SQL->buildTable(self::$table, $Profile_table_structure, array('id'));
Logger::debug('main', "ProfileDB::internal::init SQL table '" . self::$table . "' created");
return true;
}
示例3: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_ReportServer::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$servers_history_table_structure = array('fqdn' => 'VARCHAR(255) NOT NULL', 'external_name' => 'VARCHAR(255) NOT NULL', 'timestamp' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', 'cpu' => 'FLOAT NOT NULL', 'ram' => 'FLOAT NOT NULL', 'data' => 'LONGTEXT NOT NULL');
$ret = $SQL->buildTable($sql_conf['prefix'] . 'servers_history', $servers_history_table_structure, array());
if (!$ret) {
Logger::error('main', 'Unable to create SQL table \'' . $sql_conf['prefix'] . 'servers_history\'');
return false;
}
return true;
}
示例4: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_ReportSession::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$sessions_history_table_structure = array('id' => 'VARCHAR(255) NOT NULL', 'start_stamp' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP', 'stop_stamp' => 'TIMESTAMP NULL default NULL', 'stop_why' => 'VARCHAR(16) default NULL', 'user' => 'VARCHAR(255) NOT NULL', 'server' => 'VARCHAR(255) NOT NULL', 'data' => 'LONGTEXT NOT NULL');
$ret = $SQL->buildTable(self::table, $sessions_history_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create SQL table \'' . self::table . '\'');
return false;
}
return true;
}
示例5: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_UserGroup_Rule::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$usergroup_rules_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'attribute' => 'varchar(255)', 'type' => 'varchar(255)', 'value' => 'varchar(255)', 'usergroup_id' => 'varchar(255)');
$ret = $SQL->buildTable(self::table, $usergroup_rules_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . self::table . '\' created');
return true;
}
示例6: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_AdminAction::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$tokens_table_structure = array('when' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', 'what' => 'varchar(255) NOT NULL', 'who' => 'varchar(255) NOT NULL', 'where' => 'varchar(255) NOT NULL', 'infos' => 'text');
$ret = $SQL->buildTable(self::table, $tokens_table_structure, array(), array(), 'ARCHIVE');
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . self::table . '\' created');
return true;
}
示例7: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_VDI::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$vdi_table_structure = array('id' => 'varchar(64)', 'type' => 'varchar(255)', 'name' => 'varchar(255)', 'server' => 'varchar(255)', 'master_id' => 'varchar(64)', 'used_by' => 'varchar(255)', 'cpu_model' => 'varchar(255)', 'cpu_nb_cores' => 'int(8)', 'ram_total' => 'int(8)', 'status' => 'varchar(32)', 'ip' => 'varchar(15)');
$ret = $SQL->buildTable(self::table, $vdi_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . self::table . '\' created');
return true;
}
示例8: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_Network_Folder::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$network_folders_table_structure = array('id' => 'varchar(255)', 'server' => 'varchar(255)', 'status' => 'int(2)');
$ret = $SQL->buildTable(self::$table, $network_folders_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . self::$table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . self::$table . '\' created');
return true;
}
示例9: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_Task::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$tasks_table_structure = array('id' => 'varchar(32)', 'type' => 'varchar(32)', 'job_id' => 'varchar(32)', 'server' => 'varchar(255)', 'status' => 'varchar(64)', 't_begin' => 'int(10)', 't_end' => 'int(10)', 'applications_line' => 'varchar(255)', 'applications' => 'text');
$ret = $SQL->buildTable($sql_conf['prefix'] . 'tasks', $tasks_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'tasks\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'tasks\' created');
return true;
}
示例10: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_Token::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$tokens_table_structure = array('id' => 'varchar(255) NOT NULL', 'type' => 'varchar(32) NOT NULL', 'link_to' => 'varchar(255) NOT NULL', 'valid_until' => 'int(10) NOT NULL');
$ret = $SQL->buildTable(self::table, $tokens_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . self::table . '\' created');
return true;
}
示例11: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_Script::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$script_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'name' => 'varchar(64)', 'type' => 'varchar(10)', 'os' => 'varchar(10)', 'data' => 'text');
$ret = $SQL->buildTable(self::$table, $script_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . self::$table . '\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . self::$table . '\' created');
return true;
}
示例12: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_Session::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$sessions_table_structure = array('id' => 'varchar(255)', 'server' => 'varchar(255)', 'mode' => 'varchar(32)', 'type' => 'varchar(32)', 'status' => 'varchar(32)', 'settings' => 'text', 'user_login' => 'varchar(255)', 'user_displayname' => 'varchar(255)', 'servers' => 'text', 'applications' => 'text', 'start_time' => 'varchar(255)', 'timestamp' => 'int(10)');
$ret = $SQL->buildTable($sql_conf['prefix'] . 'sessions', $sessions_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'sessions\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'sessions\' created');
return true;
}
示例13: init
public static function init($prefs_)
{
Logger::debug('main', 'Abstract_User_Preferences::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$user_preferences_table_structure = array('login' => 'varchar(1024)', 'key' => 'varchar(255)', 'container' => 'varchar(255)', 'element_id' => 'varchar(255)', 'value' => 'text');
$ret = $SQL->buildTable(self::$table, $user_preferences_table_structure, array());
if (!$ret) {
Logger::error('main', "Unable to create MySQL table '" . self::$table . "'");
return false;
}
Logger::debug('main', "MySQL table '" . self::$table . "' created");
return true;
}
示例14: init
public static function init($prefs_)
{
Logger::debug('main', 'Starting Abstract_News::init');
$sql_conf = $prefs_->get('general', 'sql');
$SQL = SQL::newInstance($sql_conf);
$news_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'title' => 'varchar(64)', 'content' => 'text', 'timestamp' => 'int(10)');
$ret = $SQL->buildTable($sql_conf['prefix'] . 'news', $news_table_structure, array('id'));
if (!$ret) {
Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'news\'');
return false;
}
Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'news\' created');
return true;
}
示例15: init
public static function init($prefs_)
{
$sql_conf = $prefs_->get('general', 'sql');
if (!is_array($sql_conf)) {
return false;
}
$table = $sql_conf['prefix'] . 'ha';
$sql2 = SQL::newInstance($sql_conf);
$ha_table_structure = array('id_host' => 'int(5) NOT NULL AUTO_INCREMENT', 'hostname' => 'VARCHAR(255) NOT NULL', 'address' => 'VARCHAR(255) NOT NULL', 'timestamp' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', 'register' => 'ENUM( "yes", "no" ) NOT NULL');
$ret = $sql2->buildTable($table, $ha_table_structure, array('id_host'));
if ($ret === false) {
return false;
} else {
return true;
}
return false;
}