pdo连接server 2005

class soubang_pdo extends PDO {
static $instance = false;
public function getInstance()
{
if( !soubang_pdo::$instance )
{
soubang_pdo::$instance = new soubang_pdo();
}
return soubang_pdo::$instance;
}
public function __construct()
{
try {
parent::__construct(
Configure::read('DB.soubang_dsn'),
Configure::read('DB.soubang_username'),
Configure::read('DB.soubang_password')
/*
                                 * 这里总是无法完成对MS SQL SERVER持久连接,不知原因
                                 * code: array(PDO::ATTR_PERSISTENT => Configure::read('DB.soubang_pconnect'))                           
                                */
            );
}catch ( PDOException $e){
die("单品数据库连接错误!
");
}
}
/**
     * xxxxxx
     *
     */
public function mostMoveUpPerToday($offset=0, $size=10)
{
$start = $offset+1;
$end = $offset + $size;
$q = $this->query("
            SELECT *
            FROM (
                select *,ROW_NUMBER() Over(order by RankChange DESC) as __rowNum from [XXXX].[dbo].[Board] Where BoardID=2
            ) as myTable
            where __rowNum between {$start} and {$end};
        ");
if( !$q )
throw new Exception("查询今日上升最快关键词失败!");
return $q->fetchAll(PDO::FETCH_ASSOC);
}
//.....   
}

你可能感兴趣的:(pdo连接server 2005)