本文整理汇总了PHP中UniqueIDGenerator类的典型用法代码示例。如果您正苦于以下问题:PHP UniqueIDGenerator类的具体用法?PHP UniqueIDGenerator怎么用?PHP UniqueIDGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UniqueIDGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Get the singleton instance of this class
*/
public static function getInstance()
{
if (!is_object(self::$instance)) {
self::$instance = new UniqueIDGenerator();
}
return self::$instance;
}
示例2: tearDown
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_employee_workshift`", $this->connection));
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_workshift`", $this->connection));
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_employee`", $this->connection));
UniqueIDGenerator::getInstance()->resetIDs();
}
示例3: tearDown
/**
* Tears down the fixture, removed database entries created during test.
*
* @access protected
*/
protected function tearDown()
{
$this->_deleteTables();
// Insert default geninfo, and compstructtree values
$this->_runQuery("INSERT INTO `hs_hr_geninfo` VALUES ('001','','')");
$this->_runQuery("INSERT INTO `hs_hr_compstructtree`(`title`, `description`, `loc_code`, `lft`, `rgt`, `id`, `parnt`, `dept_id`) VALUES ('', 'Parent Company', null , 1, 2, 1, 0, null)");
UniqueIDGenerator::getInstance()->resetIDs();
}
示例4: tearDown
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
$this->assertTrue(mysql_query("TRUNCATE `hs_hr_config`;", $this->connection), mysql_error());
foreach ($this->oldValues as $row) {
$query = "INSERT INTO `hs_hr_config` VALUES ('" . implode("', '", $row) . "')";
$this->assertTrue(mysql_query($query));
}
UniqueIDGenerator::getInstance()->resetIDs();
}
示例5: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classHoliday = new Holidays();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_holidays`", $this->connection);
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (10, 'Independence', '" . date('Y') . "-07-04', " . Holidays::HOLIDAYS_RECURRING . ", 8)");
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (11, 'Poya', '" . date('Y') . "-01-04', " . Holidays::HOLIDAYS_NOT_RECURRING . ", 4)");
UniqueIDGenerator::getInstance()->initTable();
}
示例6: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classLeaveType = new LeaveType();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_leavetype`");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY011', 'Medical', 1)");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY012', 'Medicals', 1)");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY013', 'Medicalx', 1)");
UniqueIDGenerator::getInstance()->initTable();
}
示例7: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classHoliday = new Holidays();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_holidays`", $this->connection);
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (10, 'Independence', '" . date('Y') . "-07-04', " . Holidays::HOLIDAYS_RECURRING . ", 8)");
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (11, 'Poya', '" . date('Y') . "-01-04', " . Holidays::HOLIDAYS_NOT_RECURRING . ", 4)");
UniqueIDGenerator::getInstance()->initTable();
mysql_query("INSERT INTO `hs_hr_employee`(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, emp_nick_name) " . "VALUES (18, NULL, 'Nadeeth', 'H', 'Lansakara', 'rc')");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY010', 'Medical', 1)");
mysql_query("INSERT INTO `hs_hr_leave_requests` (`leave_request_id`, `leave_type_id`, `leave_type_name`, `date_applied`, `employee_id`) VALUES (11, 'LTY010', 'Medical', '" . date('Y-m-d', time() + 3600 * 24) . "', '18')");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (10, '18', 'LTY010', '" . date('Y-m-d', time() - 3600 * 24 * 2) . "', 4, 0.5, 3, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (11, '18', 'LTY010', '" . date('Y-m-d', time() - 3600 * 24 * 1) . "', 8, 1, 5, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (12, '18', 'LTY010', '" . date('Y-m-d', time() + 3600 * 24 * 2) . "', 8, 1, 2, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (13, '18', 'LTY010', '" . date('Y-m-d', time() + 3600 * 24 * 3) . "', 8, 1, 5, '', 11)");
}
示例8: initUniqueIDs
/**
* Initialize unique ID's
*/
public static function initUniqueIDs()
{
self::connectDB();
if (!mysql_select_db($_SESSION['dbInfo']['dbName'])) {
$_SESSION['error'] = 'Unable to connect to Database!';
error_log(date("r") . " Initializing unique id's. Error - Unable to connect to Database\n", 3, "installer/log.txt");
return false;
}
/* Initialize the hs_hr_unique_id table */
try {
UniqueIDGenerator::getInstance()->initTable();
} catch (IDGeneratorException $e) {
$errMsg = $e->getMessage() . ". Trace = " . $e->getTraceAsString();
$_SESSION['error'] = $errMsg;
error_log(date("r") . " Initializing hs_hr_unique_id table failed with: {$errMsg}\n", 3, "log.txt");
return false;
}
return true;
}
示例9: _createJobSpecs
/**
* Saves the given JobSpec objects in the databas
*
* @param array $specs Array of JobSpec objects to save.
*/
private function _createJobSpecs($specs)
{
foreach ($specs as $spec) {
$sql = sprintf("INSERT INTO hs_hr_job_spec(jobspec_id, jobspec_name, jobspec_desc, jobspec_duties) " . "VALUES(%d, '%s', '%s', '%s')", $spec->getId(), $spec->getName(), $spec->getDesc(), $spec->getDuties());
$this->assertTrue(mysql_query($sql), mysql_error());
}
UniqueIDGenerator::getInstance()->initTable();
}
示例10: _insert
/**
* Add new CustomExport object to database
*/
private function _insert()
{
$fields[0] = self::DB_FIELDS_ID;
$fields[1] = self::DB_FIELDS_NAME;
$fields[2] = self::DB_FIELDS_FIELDS;
$fields[3] = self::DB_FIELDS_HEADINGS;
$this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELDS_ID);
$values[0] = $this->id;
$values[1] = "'{$this->name}'";
$values[2] = "'" . implode(",", $this->assignedFields) . "'";
$values[3] = empty($this->headings) ? "''" : "'" . implode(",", $this->headings) . "'";
$sqlBuilder = new SQLQBuilder();
$sqlBuilder->table_name = self::TABLE_NAME;
$sqlBuilder->flg_insert = 'true';
$sqlBuilder->arr_insert = $values;
$sqlBuilder->arr_insertfield = $fields;
$sql = $sqlBuilder->addNewRecordFeature2();
$conn = new DMLFunctions();
$result = $conn->executeQuery($sql);
if (!$result || mysql_affected_rows() != 1) {
throw new CustomExportException("Insert failed. {$sql}", CustomExportException::DB_EXCEPTION);
}
}
示例11: addLeaveType
/**
* Add the Leave Type
*
*/
public function addLeaveType()
{
$this->leaveTypeId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leavetype', 'leave_type_id', 'LTY');
$arrRecordsList[0] = "'" . $this->getLeaveTypeId() . "'";
$arrRecordsList[1] = "'" . $this->getLeaveTypeName() . "'";
$arrRecordsList[2] = $this->availableStatusFlag;
$sqlBuilder = new SQLQBuilder();
$arrTable = "`hs_hr_leavetype`";
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例12: define
<?php
define('ROOT_PATH', dirname(__FILE__) . '/..');
require_once ROOT_PATH . '/installer/utils/DMLFunctions.php';
require_once ROOT_PATH . '/installer/utils/UniqueIDGenerator.php';
echo "Running UniqueIDGenerator\n";
$conn = new DMLFunctions();
UniqueIDGenerator::getInstance()->initTable();
echo "Finished fixing ID's\n";
示例13: _createEvent
/**
* Create job application event with the passed parameters
*
* @param int $id
* @param int $applicationId
* @param String $createdTime
* @param String $createdBy
* @param int $ownerId
* @param String $eventTime
* @param int $eventType
* @param int $eventStatus
* @param String $notes
*/
private function _createEvent($id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime, $eventType, $eventStatus, $notes)
{
$sql = sprintf("INSERT INTO `hs_hr_job_application_events`(`id`,`application_id`,`created_time`," . "`created_by`, `owner`, `event_time`, `event_type`, `status`, `notes`) " . "VALUES (%d, %d, '%s', '%s', %d, '%s', %d, %d, '%s')", $id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime, $eventType, $eventStatus, $notes);
$this->assertTrue(mysql_query($sql), mysql_error());
UniqueIDGenerator::getInstance()->initTable();
}
示例14: addJobTitles
function addJobTitles()
{
$tableName = 'HS_HR_JOB_TITLE';
$this->jobId = UniqueIDGenerator::getInstance()->getNextID($tableName, 'JOBTIT_CODE', 'JOB');
$arrRecordsList[0] = "'" . $this->getJobId() . "'";
$arrRecordsList[1] = "'" . $this->getJobName() . "'";
$arrRecordsList[2] = "'" . $this->getJobDesc() . "'";
$arrRecordsList[3] = "'" . $this->getJobComm() . "'";
$arrRecordsList[4] = "'" . $this->getJobSalGrd() . "'";
$arrRecordsList[5] = isset($this->jobSpecId) ? $this->jobSpecId : 'null';
$arrFieldList[0] = 'JOBTIT_CODE';
$arrFieldList[1] = 'JOBTIT_NAME';
$arrFieldList[2] = 'JOBTIT_DESC';
$arrFieldList[3] = 'JOBTIT_COMM';
$arrFieldList[4] = 'SAL_GRD_CODE';
$arrFieldList[5] = self::DB_FIELD_JOBSPEC_ID;
$sql_builder = new SQLQBuilder();
$sql_builder->table_name = $tableName;
$sql_builder->flg_insert = 'true';
$sql_builder->arr_insert = $arrRecordsList;
$sql_builder->arr_insertfield = $arrFieldList;
$sqlQString = $sql_builder->addNewRecordFeature2();
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString);
$jobTitleEmpStat = new JobTitEmpStat();
$jobTitleEmpStat->setEmpStatId(EmploymentStatus::EMPLOYMENT_STATUS_ID_TERMINATED);
$jobTitleEmpStat->setJobTitId($this->getJobId());
$jobTitleEmpStat->addJobTitEmpStat();
return $message2;
}
示例15: addUserGroups
function addUserGroups()
{
$this->userGroupID = UniqueIDGenerator::getInstance()->getNextID($this->tableName, 'userg_id', 'USG');
$arrFieldList[0] = "'" . $this->getUserGroupID() . "'";
$arrFieldList[1] = "'" . $this->getUserGroupName() . "'";
$arrFieldList[2] = "'" . $this->getUserGroupRepDef() . "'";
$arrRecordsList[0] = 'userg_id';
$arrRecordsList[1] = 'userg_name';
$arrRecordsList[2] = 'userg_repdef';
$this->sql_builder->table_name = $this->tableName;
$this->sql_builder->flg_insert = 'true';
$this->sql_builder->arr_insertfield = $arrRecordsList;
$this->sql_builder->arr_insert = $arrFieldList;
$sqlQString = $this->sql_builder->addNewRecordFeature2();
$message2 = $this->dbConnection->executeQuery($sqlQString);
//Calling the addData() function
return $message2;
}