[pLog-svn] r3301 - in plog/trunk: . install
Jon Daley
plogworld at jon.limedaley.com
Sat Apr 29 20:02:59 GMT 2006
Is there a better way to check to see if a column exists in a
table instead of this first SELECT query?
On Sat, 29 Apr 2006, jondaley at devel.lifetype.net wrote:
> Modified: plog/trunk/wizard.php
> + // check to see if we need to remove duplicates and the id index
> + $query = "SELECT id FROM ".$this->_dbPrefix."config LIMIT 1";
> + $result = $this->_db->Execute($query);
> + // if $result is false, id column has already been removed
> + if($result){
> + $result->Close();
> +
> + // remove all duplicates in plog_config table
> + $query = "DELETE a FROM ".$this->_dbPrefix."config a, ".$this->_dbPrefix."config b WHERE a.id > b.id " .
> + "AND a.config_key = b.config_key";
> + $result = $this->_db->Execute($query);
> + if(!$result){
> + $message .= "Error removing duplicates in config table: ".$this->_db->ErrorMsg()."<br/>";
> + $errors = true;
> + }
> + else{
> + $result->Close();
> +
> + // remove index id field, we don't need it any more!
> + $query = "ALTER TABLE ".$this->_dbPrefix."config DROP COLUMN id";
> + $result = $this->_db->Execute($query);
> + if(!$result){
> + $message .= "Error removing old id column from config table: ".$this->_db->ErrorMsg()."<br/>";
> + $errors = true;
> + }
> + $result->Close();
More information about the pLog-svn
mailing list