static function querySelect($table_name, $field, $tablefields) { $db_factory = new db_factory(); $fori = 0; $forlimit = 500; $sqlCount = $db_factory->get_count("select count(*) from " . $table_name); if (!$sqlCount) { return false; } $tabledump = ''; $numfields = count($tablefields); while ($fori <= $sqlCount) { $sql = $db_factory->query("select * from " . $table_name . " limit " . $fori . "," . $forlimit); foreach ($sql as $r) { $row = array_values($r); $sqlmsg = $comma = ''; for ($i = 0; $i < $numfields; $i++) { $sqlmsg .= $comma . (!empty($row[$i]) && (self::strexists($tablefields[$i]['Type'], 'char') || self::strexists($tablefields[$i]['Type'], 'text')) ? '0x' . bin2hex($row[$i]) : '\'' . mysql_escape_string($row[$i]) . '\''); $comma = ','; } $tabledump .= " INSERT INTO " . $table_name . " VALUES(" . $sqlmsg . ") ;\n"; } $fori += $forlimit; } return $tabledump; }
function setUp() { $this->db =& db_factory::instance(); $this->_clean_up(); $this->_init_site_object(); $this->object->set_attribute('controller_name', 'site_object_controller'); $controller_id = site_object_controller::get_id('site_object_controller'); $this->object->set_attribute('controller_id', $controller_id); debug_mock::init($this); $user =& user::instance(); $user->_set_id(10); $tree =& tree::instance(); $values['identifier'] = 'root'; $values['object_id'] = 100; $this->root_node_id = $tree->create_root_node($values, false, true); $class_id = $this->object->get_class_id(); $this->db->sql_insert('sys_site_object', array('id' => 100, 'class_id' => $class_id, 'current_version' => 1)); $values['identifier'] = 'ru'; $values['object_id'] = 1; $this->parent_node_id = $tree->create_sub_node($this->root_node_id, $values); $this->db->sql_insert('sys_site_object', array('id' => 1, 'class_id' => $class_id, 'current_version' => 1)); $values['identifier'] = 'document'; $values['object_id'] = 10; $this->sub_node_id = $tree->create_sub_node($this->parent_node_id, $values); $this->db->sql_insert('sys_site_object', array('id' => 10, 'class_id' => $class_id, 'current_version' => 1)); }
function setUp() { $this->db =& db_factory :: instance(); $this->links_manager =& new links_manager(); $this->_clean_up(); }
function pub_mode_init($std_cache_name, $data = array()) { global $kekezu; global $_lang; $release_info = $this->_std_obj->_release_info; switch ($this->_pub_mode) { case "professional": break; case "guide": break; case "onekey": if (!$release_info) { $sql = " select model_id,task_title,task_desc,indus_id,indus_pid,\n\t\t\t\t\t\ttask_cash_coverage,start_time,end_time,contact from %switkey_task where task_id='%d' and model_id='%d'"; $task_info = db_factory::get_one(sprintf($sql, TABLEPRE, $data['t_id'], $this->_model_id)); $task_info or kekezu::show_msg($_lang['operate_notice'], $_SERVER['HTTP_REFERER'], 3, $_lang['not_exsist_relation_task_and_not_user_onekey'], "warning"); $release_info = $this->onekey_mode_format($task_info); $allow_time = $task_info['end_time'] - $task_info['start_time']; $task_day = date('Y-m-d', $allow_time + time()); $release_info['txt_task_day'] = $task_day; $release_info['task_cash_cove'] = $task_info['task_cash_coverage']; $this->save_task_obj($release_info, $std_cache_name); } break; } }
function setUp() { $this->db = db_factory::instance(); debug_mock::init($this); $this->driver = new materialized_path_driver_test_version(); $this->_clean_up(); }
function setUp() { parent :: setUp(); $this->db =& db_factory :: instance(); $tree =& tree :: instance(); $values['identifier'] = 'root'; $this->node_id_root = $tree->create_root_node($values, false, true); $values['identifier'] = 'ru'; $values['object_id'] = 1; $this->node_id_ru = $tree->create_sub_node($this->node_id_root, $values); $values['identifier'] = 'document'; $values['object_id'] = 10; $this->node_id_document = $tree->create_sub_node($this->node_id_ru, $values); $values['identifier'] = 'doc1'; $values['object_id'] = 20; $this->node_id_doc1 = $tree->create_sub_node($this->node_id_ru, $values); $values['identifier'] = 'doc2'; $values['object_id'] = 30; $this->node_id_doc2 = $tree->create_sub_node($this->node_id_ru, $values); }
function full_text_search() { $this->db =& db_factory :: instance(); $this->indexer =& new full_text_indexer(); $this->use_boolean_mode = $this->_check_boolean_mode(); }
public function process_report($op_result, $type) { global $_lang; $trans_name = $this->get_transrights_name($this->_report_type); $op_result = $this->op_result_format($op_result); if ($op_result['action']) { if ($op_result['product_remove'] == 1) { $res = db_factory::execute(sprintf(" update %switkey_service set service_status='3' where service_id='%d'", TABLEPRE, $this->_obj_info['origin_id'])); $this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']); $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']); $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=report&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); } if ($op_result['product_remove'] == 2) { $this->process_notify('nopass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']); $res = $this->change_status($this->_report_id, '3', $op_result, $op_result, $op_result['reply']); $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); } if ($op_result['product_remove'] == 3) { $this->disablePeople(); $this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']); $res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']); $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); } } }
function setUp() { $this->db =& db_factory::instance(); $this->stats_uri = new stats_uri_self_test_version($this); $this->stats_uri->stats_uri(); $this->_clean_up(); }
function setUp() { $this->db =& db_factory :: instance(); $this->db_table_test =& db_table_factory :: instance('test1'); $this->_clean_up(); }
function db_table() { $this->_db_table_name = $this->_define_db_table_name(); $this->_columns = $this->_define_columns(); $this->_constraints = $this->_define_constraints(); $this->_db =& db_factory::instance(); }
function setUp() { $this->db = db_factory::instance(); debug_mock::init($this); $this->driver = new nested_sets_driver_test_version(); $this->_clean_up(); }
function setUp() { $this->report = new stats_referers_report(); $this->db =& db_factory :: instance(); $this->_clean_up(); }
function setUp() { $this->db =& db_factory::instance(); $this->stats_referer = new stats_referer_self_test_version($this); $this->stats_referer->stats_referer(); $this->_clean_up(); }
public function getwithdata() { $connection = db_factory::factory(DB_TYPE); $sql = "select * from userdao order by username"; $results = $connection->getArray($sql); $this->populate($results, 'user'); }
function pub_mode_init($std_cache_name, $data = array()) { global $kekezu; global $_lang; $release_info = $this->_std_obj->_release_info; switch ($this->_pub_mode) { case "professional": break; case "guide": break; case "onekey": if (!$release_info) { $sql = " select model_id,task_title,task_desc,indus_id,indus_pid,\n\t\t\t\t\t\ttask_cash,contact from %switkey_task where task_id='%d' and model_id='%d'"; $task_info = db_factory::get_one(sprintf($sql, TABLEPRE, $data['t_id'], $this->_model_id)); $task_info or kekezu::show_msg($_lang['operate_notice'], $_SERVER['HTTP_REFERER'], 3, $_lang['not_exsist_relation_task_and_not_user_onekey'], "warning"); $release_info = $this->onekey_mode_format($task_info); $allow_time = $kekezu->get_show_day($task_info['task_cash'], $this->_model_id); $task_day = date('Y-m-d', $allow_time * 24 * 3600 + time()); $release_info['txt_task_day'] = $task_day; $release_info['txt_task_cash'] = intval($task_info['task_cash']); $prize_info = db_factory::query(sprintf("select * from %switkey_task_prize where task_id='%d'", TABLEPRE, $data['t_id'])); foreach ($prize_info as $v) { $release_info['txt_prize' . $v['prize'] . '_num'] = $v['prize_count']; $release_info['txt_prize' . $v['prize'] . '_cash'] = intval($v['prize_cash']); } $this->save_task_obj($release_info, $std_cache_name); } break; } }
public function getpaginateddata($position) { $connection = db_factory::factory(DB_TYPE); $sql = "SELECT id,name,message FROM PaginateDao ORDER BY id DESC LIMIT {$position} ," . ITEM_PER_PAGE; $results = $connection->getArray($sql); $this->populate($results, 'paginate'); }
function _valid_perform() { $object_data =& fetch_mapped_by_url(); $data = $this->_export(); $phpbb_user_data['user_rank'] = $data['rank']; $db =& db_factory::instance(); return $db->sql_update('phpbb_users', $phpbb_user_data, array('user_id' => $object_data['id'])); }
public function index() { $connection = db_factory::factory(DB_TYPE); $sql = "SELECT COUNT(*) as num FROM PaginateDao"; $result = $connection->getArray($sql); $pages = ceil((int) $result[0]['num'] / ITEM_PER_PAGE); return $pages; }
function site_object_controller_tester($class_name) { $this->db =& db_factory :: instance(); $this->class_name = $class_name; parent :: LimbTestCase(); }
public function __construct() { if (!isset($this->db_config[$this->db_setting])) { $this->db_setting = 'default'; } //$this->table_name = $this->table_name; $this->db = db_factory::get_instance($this->db_config)->get_database($this->db_setting); }
public function isFieldsExsits() { $col_info = db_factory::query("show COLUMNS FROM " . $this->_tbname . " WHERE Field='" . $this->_tbfield . "' "); if ($col_info) { return true; } return false; }
function site_object_tester($class_name) { $this->db =& db_factory :: instance(); $this->class_name = $class_name; parent :: UnitTestCase(); }
function setUp() { $this->db = db_factory::instance(); $this->stats_counter = new stats_counter_test_version($this); $this->stats_counter->stats_counter(); $this->stats_counter->setReturnValue('_is_home_hit', false); $this->stats_counter->setReturnValue('_is_new_audience', false); $this->_clean_up(); }
function setUp() { $this->db =& db_factory::instance(); $this->_clean_up(); $this->object = new mocked_site_object_test_version($this); $this->object->site_object(); $user =& user::instance(); $user->_set_id(10); }
function checkFieldName($name, $model_id) { $result = db_factory::get_one("SELECT f_name FROM `" . TABLEPRE . "witkey_custom_fields` where f_name = '" . kekezu::escape($name) . "' and model_id=" . intval($model_id)); if ($result['f_name']) { return true; } else { return false; } }
function __construct() { //$this->update_log_db = bpBase::loadModel('update_log_model'); parent::__construct(); $checkAccess = $this->exitWithoutAccess('system', 'manage'); $this->dbConfig = array('default' => array('hostname' => DB_HOSTNAME, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'tablepre' => TABLE_PREFIX, 'charset' => DB_CHARSET, 'type' => 'mysql', 'debug' => DEBUG, 'pconnect' => 0, 'autoconnect' => 0)); bpBase::loadSysClass('db_factory'); $this->db = db_factory::get_instance($this->dbConfig)->get_database('default'); }
function setUp() { $this->db =& db_factory::instance(); $this->cart_handler =& new special_db_cart_handler($this); $this->cart_handler->db_cart_handler(10); $this->user = new Mockuser($this); $this->cart_handler->setReturnReference('_get_user', $this->user); $this->_clean_up(); }
public function goods_top_end() { $goods_list = db_factory::query(sprintf(" select a.service_id ,b.end_time from %switkey_service a left join %switkey_payitem_record b on a.service_id=b.obj_id\n\t\t\t\t where a.model_id=6 and a.goodstop=1 and b.obj_type='goods' and b.end_time<%d order by service_id desc ", TABLEPRE, TABLEPRE, time())); if (is_array($goods_list)) { foreach ($goods_list as $k => $v) { keke_shop_class::updateGoodsTop($v['service_id']); } } }
function &fetch_version($version, $sql_params = array()) { $db_table =& $this->_get_db_table(); $table_name = $db_table->get_table_name(); $id = $this->get_id(); $sql = sprintf("SELECT\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\tssot.id as node_id, \r\n\t\t\t\t\t\t\t\tssot.parent_id as parent_node_id, \n\t\t\t\t\t\t\t\tssot.level as level,\n\t\t\t\t\t\t\t\ttn.*,\n\t\t\t\t\t\t\t\ttn.id as record_id,\n\t\t\t\t\t\t\t\ttn.object_id as id\n\t\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\tsys_site_object_tree as ssot,\n\t\t\t\t\t\t\t\t{$table_name} as tn\r\n\t\t\t\t\t\t\t\t%s\r\n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\tssot.object_id = {$id} AND \n\t\t\t\t\t\t\t\ttn.object_id = {$id} AND\n\t\t\t\t\t\t\t\ttn.version = {$version}\n\t\t\t\t\t\t\t\t%s", $this->_add_sql($sql_params, 'columns'), $this->_add_sql($sql_params, 'tables'), $this->_add_sql($sql_params, 'conditions')); $db =& db_factory::instance(); $db->sql_exec($sql); return $db->fetch_row(); }