Changeset 9412 for temp/trunk/data/lib


Ignore:
Timestamp:
2006/11/29 18:05:32 (20 years ago)
Author:
kakinaka
Message:

blank

File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/trunk/data/lib/slib.php

    r9325 r9412  
    9999    // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç 
    100100    if(!$objQuery->isError()) { 
     101        $arrRet = sfGetColumnList($table_name, $objQuery); 
     102        if(count($arrRet) > 0) { 
     103            if(!in_array($col_name, $arrRet)){ 
     104                return true; 
     105            } 
     106        } 
     107 
     108        /* 
    101109        list($db_type) = split(":", $dsn); 
    102110        // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë 
     
    118126            } 
    119127        }else if ($db_type == "mysql") { 
    120             $sql = "SHOW COLUMNS FROM $table_name"; 
    121             $arrRet = $objQuery->getAll($sql); 
     128            $arrRet = sfGetColumnList($table_name, $objQuery); 
    122129            if(count($arrRet) > 0) { 
    123130                if(!in_array($col_name, $arrRet)){ 
     
    126133            } 
    127134        } 
     135        */ 
    128136    } 
    129137     
     
    135143     
    136144    return false; 
     145} 
     146 
     147// ¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë 
     148function sfGetColumnList($table_name, $objQuery = ""){ 
     149    if($objQuery == "") $objQuery = new SC_Query(); 
     150    $arrRet = array(); 
     151     
     152    // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë 
     153    if (DB_TYPE == "pgsql") { 
     154        $sql = "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname=? AND c.oid=a.attrelid AND a.attnum > 0 ORDER BY a.attnum"; 
     155        $arrRet = $objQuery->getAll($sql, array($table_name)); 
     156    }else if (DB_TYPE == "mysql") { 
     157        $sql = "SHOW COLUMNS FROM $table_name"; 
     158        $arrRet = $objQuery->getAll($sql); 
     159    } 
     160     
     161    return $arrRet; 
    137162} 
    138163 
Note: See TracChangeset for help on using the changeset viewer.