queensf
总版主
总版主
  • 注册日期2003-12-04
  • 发帖数735
  • QQ
  • 铜币3枚
  • 威望0点
  • 贡献值0点
  • 银元0个
10楼#
发布于:2004-02-21 16:17
function query_id() {
   return $this->Query_ID;
   }
  
   /* 连接处理 */
   function connect($Database = "", $Host = "", $User = "", $Password = "") {
   /* Handle defaults */
   if ("" == $Database)
   $Database = $this->Database;
   if ("" == $Host)
   $Host = $this->Host;
   if ("" == $User)
   $User = $this->User;
   if ("" == $Password)
   $Password = $this->Password;
  
   /* 建立连接,选择数据库 */
   if ( 0 == $this->Link_ID ) {
  
   $this->Link_ID=mysql_pconnect($Host, $User, $Password);
   if (!$this->Link_ID) {
   $this->halt("pconnect($Host, $User, \$Password) failed.");
   return 0;
   }
  
   if (!@mysql_select_db($Database,$this->Link_ID)) {
   $this->halt("cannot use database ".$this->Database);
   return 0;
   }
   }
  
   return $this->Link_ID;
   }
  
   /* 丢弃查询结果,释放占用的内存 */
   function free() {
   @mysql_free_result($this->Query_ID);
   $this->Query_ID = 0;
   }
  
   /* 完成一个查询操作 */
   function query($Query_String) {
   /* No empty queries, please, since PHP4 chokes on them. */
   if ($Query_String == "")
   /* The empty query string is passed on from the constructor,
   * when calling the class without a query, e.g. in situations
   * like these: '$db = new DB_Sql_Subclass;'
   */
   return 0;
  
   if (!$this->connect()) {
   return 0; /* we already complained in connect() about that. */
   };
  
   # New query, discard previous result.
   if ($this->Query_ID) {
   $this->free();
   }
[color=blue][size=4][i][b][u] 【 解决不了的事情,就不要想。世界不会因为我而改变。 】 [/size][/u][/b][/i][/color]
举报 回复(0) 喜欢(0)     评分
上一页 下一页
游客

返回顶部