Beispiel #1
0
/**
 * 为用户获取指定的散列订单商品表名
 * @param unknown_type $user_id
 */
function get_user_order_item_table_name($user_id)
{
    if ($GLOBALS['distribution_cfg']['ORDER_DISTRIBUTE_COUNT'] > 0) {
        $order_end = hash_table($user_id, $GLOBALS['distribution_cfg']['ORDER_DISTRIBUTE_COUNT']);
        $order_table_name = DB_PREFIX . "deal_order_item_u_" . $order_end;
        //散列订单表
        return $order_table_name;
    } else {
        return DB_PREFIX . "deal_order_item";
    }
}
Beispiel #2
0
 function getReadDbPid($sql)
 {
     $c = count($GLOBALS['distribution_cfg']['DB_DISTRIBUTION']);
     if ($c == 0) {
         return -1;
     } else {
         //通过sql散列
         $pid = hash_table($sql, $c);
         return $pid;
     }
 }
Beispiel #3
0
Datei: db.php Projekt: macall/jsd
 function getReadDbPid($sql)
 {
     $c = count($GLOBALS['distribution_cfg']['DB_DISTRIBUTION']);
     if ($c == 0 || !$GLOBALS['distribution_cfg']['ALLOW_DB_DISTRIBUTE']) {
         return -1;
     } else {
         preg_match_all("/" . DB_PREFIX . "([\\S]+)/", $sql, $matches);
         if ($matches) {
             foreach ($matches[1] as $k => $table) {
                 if (!in_array($table, $GLOBALS['distribution_cfg']['DB_CACHE_TABLES'])) {
                     return -1;
                 }
             }
         }
         //通过sql散列
         $pid = hash_table($sql, $c);
         return $pid;
     }
 }