DB 클래스 참조

DB*의 상위 클래스. 더 자세히 ...

DB에 대한 상속 다이어그램 :

Inheritance graph

모든 멤버 목록

Public 멤버 함수

getInstance ($db_type=NULL)
 DB를 상속받는 특정 db type의 instance를 생성 후 return.
 DB ()
 constructor
 getSupportedList ()
 지원 가능한 DB 목록을 return
 _getSupportedList ()
 지원 가능한 DB 목록을 return
 isSupported ($db_type)
 지원하는 DB인지에 대한 check
 isConnected ()
 접속되었는지 return
 actStart ($query)
 로그 남김
 actFinish ()
 setError ($errno=0, $errstr= 'success')
 에러발생시 에러 메세지를 남기고 debug 모드일때는 GLOBALS 변수에 에러 로깅
 isError ()
 오류가 발생하였는지 return
 getError ()
 에러결과를 Object 객체로 return
 executeQuery ($query_id, $args=NULL)
 query xml 파일을 실행하여 결과를 return
 checkQueryCacheFile ($query_id, $xml_file)
 캐쉬파일을 찾아 본다
 _executeQuery ($cache_file, $source_args, $query_id)
 쿼리문을 실행하고 결과를 return한다
 checkFilter ($key, $val, $filter_type)
 $val을 $filter_type으로 검사 XmlQueryParser에서 사용하도록 함
 getColumnType ($column_type_list, $name)
 컬럼의 타입을 구해옴 컬럼의 경우 a.b 와 같이 되어 있는 경우가 있어서 별도 함수가 필요
 getConditionValue ($name, $value, $operation, $type, $column_type)
 이름, 값, operation, type으로 값을 변경 like, like_prefix의 경우 value자체가 변경됨 type == number가 아니면 addQuotes()를 하고 ' ' 로 묶음
 getConditionPart ($name, $value, $operation)
 이름, 값, operation으로 조건절 작성 조건절을 완성하기 위해 세부 조건절 마다 정리를 해서 return
 getConditionList ($output)
 condition key를 return
 getCountCache ($tables, $condition)
 카운터 캐시 데이터 얻어오기
 putCountCache ($tables, $condition, $count=0)
 카운터 캐시 데이터 저장
 resetCountCache ($tables)
 카운터 캐시 리셋
 getSupportedDatabase ()

Public 속성

 $count_cache_path = 'files/cache/db'
 $cond_operation
 $fd = NULL
 connector resource or file description
 $result = NULL
 result
 $errno = 0
 에러 발생시 에러 코드 (0이면 에러가 없다고 정의)
 $errstr = ''
 에러 발생시 에러 메세지
 $query = ''
 가장 최근에 수행된 query string
 $elapsed_time = 0
 가장 최근에 수행된 query 의 실행시간
 $transaction_started = false
 트랙잭션 처리 flag
 $is_connected = false
 DB에 접속이 되었는지에 대한 flag.
 $supported_list = array()
 지원하는 DB의 종류, classes/DB/DB***.class.php 를 이용하여 동적으로 작성됨
 $cache_file = 'files/cache/queries/'
 query cache파일의 위치


상세한 설명

DB*의 상위 클래스.

작성자:
zero (zero@nzeo.com)
버전:
0.1
XE의 DB 사용은 xml을 이용하여 이루어짐을 원칙으로 한다. xml의 종류에는 query xml, schema xml이 있다. query xml의 경우 DB::executeQuery() method를 이용하여 xml파일을 php code로 compile한 후에 실행이 된다. query xml은 고유한 query id를 가지며 생성은 module에서 이루어진다.

queryid = 모듈.쿼리명

DB.class.php 파일의 16 번째 라인에서 정의되었습니다.


멤버 함수 문서화

DB::_executeQuery ( cache_file,
source_args,
query_id 
)

쿼리문을 실행하고 결과를 return한다

DB.class.php 파일의 271 번째 라인에서 정의되었습니다.

00271                                                                      {
00272             global $lang;
00273 
00274             if(!file_exists($cache_file)) return new Object(-1, 'msg_invalid_queryid');
00275 
00276             if($source_args) $args = @clone($source_args);
00277 
00278             $output = @include($cache_file);
00279 
00280             if( (is_a($output, 'Object')||is_subclass_of($output,'Object'))&&!$output->toBool()) return $output;
00281             $output->_tables = ($output->_tables && is_array($output->_tables)) ? $output->_tables : array();
00282 
00283             // action값에 따라서 쿼리 생성으로 돌입
00284             switch($output->action) {
00285                 case 'insert' :
00286                         $this->resetCountCache($output->tables);
00287                         $output = $this->_executeInsertAct($output);
00288                     break;
00289                 case 'update' :
00290                         $this->resetCountCache($output->tables);
00291                         $output = $this->_executeUpdateAct($output);
00292                     break;
00293                 case 'delete' :
00294                         $this->resetCountCache($output->tables);
00295                         $output = $this->_executeDeleteAct($output);
00296                     break;
00297                 case 'select' :
00298                         $output = $this->_executeSelectAct($output);
00299                     break;
00300             }
00301 
00302             if($this->errno != 0 ) $output = new Object($this->errno, $this->errstr);
00303             else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) $output = new Object();
00304             $output->add('_query', $this->query);
00305             $output->add('_elapsed_time', sprintf("%0.5f",$this->elapsed_time));
00306 
00307             return $output;
00308         }

DB::_getSupportedList (  ) 

지원 가능한 DB 목록을 return

DB.class.php 파일의 87 번째 라인에서 정의되었습니다.

00087                                      {
00088             $db_classes_path = _XE_PATH_."classes/db/";
00089             $filter = "/^DB([^\.]+)\.class\.php/i";
00090             $supported_list = FileHandler::readDir($db_classes_path, $filter, true);
00091             sort($supported_list);
00092 
00093             // 구해진 클래스의 객체 생성후 isSupported method를 통해 지원 여부를 판단
00094             for($i=0;$i<count($supported_list);$i++) {
00095                 $db_type = $supported_list[$i];
00096 
00097                 if(version_compare(phpversion(), '5.0') < 0 && preg_match('/pdo/i',$db_type)) continue;
00098 
00099                 $class_name = sprintf("DB%s%s", strtoupper(substr($db_type,0,1)), strtolower(substr($db_type,1)));
00100                 $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name);
00101                 if(!file_exists($class_file)) continue;
00102 
00103                 unset($oDB);
00104                 require_once($class_file);
00105                 $eval_str = sprintf('$oDB = new %s();', $class_name);
00106                 eval($eval_str);
00107 
00108                 if(!$oDB) continue;
00109 
00110                 $obj = null;
00111                 $obj->db_type = $db_type;
00112                 $obj->enable = $oDB->isSupported()?true:false;
00113 
00114                 $this->supported_list[] = $obj;
00115             }
00116 
00117             return $this->supported_list;
00118         }

DB::actFinish (  ) 

DB.class.php 파일의 145 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBSqlite3_pdo::_prepare(), DBSqlite2::_query(), DBPostgresql::_query(), DBMysql_innodb::_query(), DBMysql::_query(), DBFireBird::_query(), DBCubrid::_query().

00145                              {
00146             if(!$this->query ) return;
00147             $this->act_finish = getMicroTime();
00148             $elapsed_time = $this->act_finish - $this->act_start;
00149             $this->elapsed_time = $elapsed_time;
00150             $GLOBALS['__db_elapsed_time__'] += $elapsed_time;
00151 
00152             $log['query'] = $this->query;
00153             $log['elapsed_time'] = $elapsed_time;
00154 
00155             // 에러 발생시 에러 로그를 남김 (__DEBUG_DB_OUTPUT__이 지정되어 있을경우)
00156             if($this->isError()) {
00157                 $log['result'] = 'Failed';
00158                 $log['errno'] = $this->errno;
00159                 $log['errstr'] = $this->errstr;
00160 
00161                 if(__DEBUG_DB_OUTPUT__ == 1)  {
00162                     $debug_file = _XE_PATH_."files/_debug_db_query.php";
00163                     $buff = sprintf("%s\n",print_r($log,true));
00164 
00165                     if($display_line) $buff = "\n<?php\n/*\n====================================\n".$buff."------------------------------------\n*/\n?>\n";
00166 
00167                     if(@!$fp = fopen($debug_file,"a")) return;
00168                     fwrite($fp, $buff);
00169                     fclose($fp);
00170                 }
00171             } else {
00172                 $log['result'] = 'Success';
00173             }
00174             $GLOBALS['__db_queries__'][] = $log;
00175 
00176             // __LOG_SLOW_QUERY__ 가 정해져 있다면 시간 체크후 쿼리 로그 남김
00177             if(__LOG_SLOW_QUERY__>0 && $elapsed_time > __LOG_SLOW_QUERY__) {
00178                 $buff = '';
00179                 $log_file = _XE_PATH_.'files/_db_slow_query.php';
00180                 if(!file_exists($log_file)) {
00181                     $buff = '<?php exit();?>'."\n";
00182                 }
00183                 $buff .= sprintf("%s\t%s\n\t%0.6f sec\n\n", date("Y-m-h H:i"), $this->query, $elapsed_time);
00184                 if($fp = fopen($log_file,'a')) {
00185                     fwrite($fp, $buff);
00186                     fclose($fp);
00187                 }
00188 
00189             }
00190         }

DB::actStart ( query  ) 

로그 남김

DB.class.php 파일의 138 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBSqlite3_pdo::_prepare(), DBSqlite2::_query(), DBPostgresql::_query(), DBMysql_innodb::_query(), DBMysql::_query(), DBFireBird::_query(), DBCubrid::_query().

00138                                   {
00139             $this->setError(0,'success');
00140             $this->query = $query;
00141             $this->act_start = getMicroTime();
00142             $this->elapsed_time = 0;
00143         }

DB::checkFilter ( key,
val,
filter_type 
)

$val을 $filter_type으로 검사 XmlQueryParser에서 사용하도록 함

DB.class.php 파일의 314 번째 라인에서 정의되었습니다.

00314                                                        {
00315             global $lang;
00316 
00317             switch($filter_type) {
00318                 case 'email' :
00319                 case 'email_address' :
00320                         if(!preg_match('/^[_0-9a-z-]+(\.[_0-9a-z-]+)*@[0-9a-z-]+(\.[0-9a-z-]+)*$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_email, $lang->{$key}?$lang->{$key}:$key));
00321                     break;
00322                 case 'homepage' :
00323                         if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key}?$lang->{$key}:$key));
00324                     break;
00325                 case 'userid' :
00326                 case 'user_id' :
00327                         if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_userid, $lang->{$key}?$lang->{$key}:$key));
00328                     break;
00329                 case 'number' :
00330                 case 'numbers' :
00331                         if(!preg_match('/^(-?)[0-9,]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key}?$lang->{$key}:$key));
00332                     break;
00333                 case 'alpha' :
00334                         if(!preg_match('/^[a-z]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key}?$lang->{$key}:$key));
00335                     break;
00336                 case 'alpha_number' :
00337                         if(!preg_match('/^[0-9a-z]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key}?$lang->{$key}:$key));
00338                     break;
00339             }
00340 
00341             return new Object();
00342         }

DB::checkQueryCacheFile ( query_id,
xml_file 
)

캐쉬파일을 찾아 본다

DB.class.php 파일의 251 번째 라인에서 정의되었습니다.

00251                                                          {
00252 
00253             // 일단 cache 파일을 찾아본다
00254             $cache_file = sprintf('%s%s%s.cache.php', _XE_PATH_, $this->cache_file, $query_id);
00255             if(file_exists($cache_file)) $cache_time = filemtime($cache_file);
00256             else $cache_time = -1;
00257 
00258             // 캐시 파일이 없거나 시간 비교하여 최근것이 아니면 원본 쿼리 xml파일을 찾아서 파싱을 한다
00259             if($cache_time<filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php')) {
00260                 require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');
00261                 $oParser = new XmlQueryParser();
00262                 $oParser->parse($query_id, $xml_file, $cache_file);
00263             }
00264             return $cache_file;
00265         }

DB::DB (  ) 

constructor

DB.class.php 파일의 71 번째 라인에서 정의되었습니다.

00071                       {
00072             $this->count_cache_path = _XE_PATH_.$this->count_cache_path;
00073             $this->cache_file = _XE_PATH_.$this->cache_file;
00074         }

DB::executeQuery ( query_id,
args = NULL 
)

query xml 파일을 실행하여 결과를 return

query_id = module.queryname query_id에 해당하는 xml문(or 캐싱파일)을 찾아서 컴파일 후 실행

DB.class.php 파일의 220 번째 라인에서 정의되었습니다.

00220                                                        {
00221             if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
00222 
00223             $id_args = explode('.', $query_id);
00224             if(count($id_args)==2) {
00225                 $target = 'modules';
00226                 $module = $id_args[0];
00227                 $id = $id_args[1];
00228             } elseif(count($id_args)==3) {
00229                 $target = $id_args[0];
00230                 if(!in_array($target, array('addons','widgets'))) return;
00231                 $module = $id_args[1];
00232                 $id = $id_args[2];
00233             }
00234             if(!$target || !$module || !$id) return new Object(-1, 'msg_invalid_queryid');
00235 
00236             $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
00237             if(!file_exists($xml_file)) return new Object(-1, 'msg_invalid_queryid');
00238 
00239             // 캐쉬파일을 찾아 본다
00240             $cache_file = $this->checkQueryCacheFile($query_id,$xml_file);
00241 
00242             // 쿼리를 실행한다
00243             return $this->_executeQuery($cache_file, $args, $query_id);
00244         }

DB::getColumnType ( column_type_list,
name 
)

컬럼의 타입을 구해옴 컬럼의 경우 a.b 와 같이 되어 있는 경우가 있어서 별도 함수가 필요

DB.class.php 파일의 348 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBCubrid::_executeInsertAct(), DBPostgresql::_getCondition(), DBMysql_innodb::_getCondition(), DBMysql::_getCondition(), DBCubrid::_getCondition().

00348                                                          {
00349             if(strpos($name,'.')===false) return $column_type_list[$name];
00350             list($prefix, $name) = explode('.',$name);
00351             return $column_type_list[$name];
00352         }

DB::getConditionList ( output  ) 

condition key를 return

DB.class.php 파일의 458 번째 라인에서 정의되었습니다.

다음을 참조함 : $output.

다음에 의해서 참조됨 : DBPostgresql::_executeSelectAct(), DBMysql_innodb::_executeSelectAct(), DBMysql::_executeSelectAct(), DBPostgresql::_getNavigationData(), DBMysql_innodb::_getNavigationData(), DBMysql::_getNavigationData().

00458                                            {
00459             $conditions = array();
00460             if(count($output->conditions)) {
00461                 foreach($output->conditions as $key => $val) {
00462                     if($val['condition']) {
00463                         foreach($val['condition'] as $k => $v) {
00464                             $conditions[] = $v['column'];
00465                         }
00466                     }
00467                 }
00468             }
00469 
00470             return $conditions;
00471         }

DB::getConditionPart ( name,
value,
operation 
)

이름, 값, operation으로 조건절 작성 조건절을 완성하기 위해 세부 조건절 마다 정리를 해서 return

DB.class.php 파일의 397 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBPostgresql::_getCondition(), DBMysql_innodb::_getCondition(), DBMysql::_getCondition(), DBCubrid::_getCondition().

00397                                                              {
00398             switch($operation) {
00399                 case 'equal' :
00400                 case 'more' :
00401                 case 'excess' :
00402                 case 'less' :
00403                 case 'below' :
00404                 case 'like_tail' :
00405                 case 'like_prefix' :
00406                 case 'like' :
00407                 case 'in' :
00408                 case 'notin' :
00409                 case 'notequal' :
00410                         // 변수가 세팅되지 않고, 문자열이나 숫자형이 아니면 리턴
00411                         if(!isset($value)) return;
00412                         if($value === '') return;
00413                         if(!in_array(gettype($value), array('string', 'integer'))) return;
00414             }
00415 
00416             switch($operation) {
00417                 case 'equal' :
00418                         return $name.' = '.$value;
00419                     break;
00420                 case 'more' :
00421                         return $name.' >= '.$value;
00422                     break;
00423                 case 'excess' :
00424                         return $name.' > '.$value;
00425                     break;
00426                 case 'less' :
00427                         return $name.' <= '.$value;
00428                     break;
00429                 case 'below' :
00430                         return $name.' < '.$value;
00431                     break;
00432                 case 'like_tail' :
00433                 case 'like_prefix' :
00434                 case 'like' :
00435                         return $name.' like '.$value;
00436                     break;
00437                 case 'in' :
00438                         return $name.' in ('.$value.')';
00439                     break;
00440                 case 'notin' :
00441                         return $name.' not in ('.$value.')';
00442                     break;
00443                 case 'notequal' :
00444                         return $name.' <> '.$value;
00445                     break;
00446                 case 'notnull' :
00447                         return $name.' is not null';
00448                     break;
00449                 case 'null' :
00450                         return $name.' is null';
00451                     break;
00452             }
00453         }

DB::getConditionValue ( name,
value,
operation,
type,
column_type 
)

이름, 값, operation, type으로 값을 변경 like, like_prefix의 경우 value자체가 변경됨 type == number가 아니면 addQuotes()를 하고 ' ' 로 묶음

DB.class.php 파일의 359 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBPostgresql::_getCondition(), DBMysql_innodb::_getCondition(), DBMysql::_getCondition(), DBCubrid::_getCondition().

00359                                                                                    {
00360             if($type == 'number') {
00361                 if(strpos($value,',')===false && strpos($value,'(')===false) return (int)$value;
00362                 return $value;
00363             }
00364 
00365             if(strpos($name,'.')!==false&&strpos($value,'.')!==false) {
00366                 list($table_name, $column_name) = explode('.',$value);
00367                 if($column_type[$column_name]) return $value;
00368             }
00369 
00370             $value = preg_replace('/(^\'|\'$){1}/','',$value);
00371 
00372             switch($operation) {
00373                 case 'like_prefix' :
00374                         $value = $value.'%';
00375                     break;
00376                 case 'like_tail' :
00377                         $value = '%'.$value;
00378                     break;
00379                 case 'like' :
00380                         $value = '%'.$value.'%';
00381                     break;
00382                 case 'notin' :
00383                         return "'".$value."'";
00384                     break;
00385                 case 'in' :
00386                         return "'".$value."'";
00387                     break;
00388             }
00389 
00390             return "'".$this->addQuotes($value)."'";
00391         }

DB::getCountCache ( tables,
condition 
)

카운터 캐시 데이터 얻어오기

DB.class.php 파일의 476 번째 라인에서 정의되었습니다.

다음을 참조함 : FileHandler::makeDir(), FileHandler::readFile().

다음에 의해서 참조됨 : DBPostgresql::_getNavigationData(), DBMysql_innodb::_getNavigationData(), DBMysql::_getNavigationData(), DBCubrid::_getNavigationData().

00476                                                     {
00477             return false;
00478             if(!$tables) return false;
00479             if(!is_dir($this->count_cache_path)) return FileHandler::makeDir($this->count_cache_path);
00480 
00481             $condition = md5($condition);
00482 
00483             if(!is_array($tables)) $tables_str = $tables;
00484             else $tables_str = implode('.',$tables);
00485 
00486             $cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
00487             if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
00488 
00489             $cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
00490             if(!file_exists($cache_filename)) return false;
00491 
00492             $cache_mtime = filemtime($cache_filename);
00493 
00494             if(!is_array($tables)) $tables = array($tables);
00495             foreach($tables as $alias => $table) {
00496                 $table_filename = sprintf('%s/cache.%s%s', $this->count_cache_path, $this->prefix, $table) ;
00497                 if(!file_exists($table_filename) || filemtime($table_filename) > $cache_mtime) return false;
00498             }
00499 
00500             $count = (int)FileHandler::readFile($cache_filename);
00501             return $count;
00502         }

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

DB::getError (  ) 

에러결과를 Object 객체로 return

DB.class.php 파일의 210 번째 라인에서 정의되었습니다.

00210                             {
00211             return new Object($this->errno, $this->errstr);
00212         }

& DB::getInstance ( db_type = NULL  ) 

DB를 상속받는 특정 db type의 instance를 생성 후 return.

DB.class.php 파일의 51 번째 라인에서 정의되었습니다.

다음을 참조함 : $GLOBALS, Context::getDBType(), Context::isInstalled().

다음에 의해서 참조됨 : tag::checkUpdate(), spamfilter::checkUpdate(), session::checkUpdate(), module::checkUpdate(), menu::checkUpdate(), member::checkUpdate(), layout::checkUpdate(), homepage::checkUpdate(), file::checkUpdate(), document::checkUpdate(), counter::checkUpdate(), comment::checkUpdate(), documentAdminController::copyDocumentModule(), commentController::deleteComment(), documentController::deleteDocument(), memberController::deleteMember(), moduleController::deleteModule(), pollAdminController::deletePoll(), pollAdminController::deletePollTitle(), executeQuery(), executeQueryArray(), moduleModel::getDefaultMid(), moduleModel::getModuleList(), getNextSequence(), commentController::insertComment(), documentController::insertDocument(), memberController::insertMember(), moduleController::insertModule(), installController::installModule(), memberModel::isValidPassword(), tag::moduleInstall(), session::moduleInstall(), module::moduleInstall(), member::moduleInstall(), issuetracker::moduleInstall(), document::moduleInstall(), tag::moduleUpdate(), spamfilter::moduleUpdate(), session::moduleUpdate(), module::moduleUpdate(), menu::moduleUpdate(), member::moduleUpdate(), layout::moduleUpdate(), homepage::moduleUpdate(), file::moduleUpdate(), document::moduleUpdate(), counter::moduleUpdate(), comment::moduleUpdate(), documentAdminController::moveDocumentModule(), documentController::moveDocumentToTrash(), counterController::procCounterExecute(), pollController::procInsert(), installController::procInstall(), issuetrackerController::procIssuetrackerInsertIssue(), memberAdminController::procMemberAdminUpdateMembersGroup(), tccommentnotifyController::procNotifyReceived(), pollController::procPoll(), refererController::procRefererExecute(), sessionModel::read(), documentAdminController::restoreTrash(), communicationController::sendMessage(), commentController::updateComment(), documentController::updateDocument(), memberController::updateMember(), moduleController::updateModule().

00051                                                {
00052             if(!$db_type) $db_type = Context::getDBType();
00053             if(!$db_type && Context::isInstalled()) return new Object(-1, 'msg_db_not_setted');
00054 
00055             if(!$GLOBALS['__DB__']) {
00056                 $class_name = sprintf("DB%s%s", strtoupper(substr($db_type,0,1)), strtolower(substr($db_type,1)));
00057                 $class_file = sprintf("%sclasses/db/%s.class.php", _XE_PATH_, $class_name);
00058                 if(!file_exists($class_file)) new Object(-1, 'msg_db_not_setted');
00059 
00060                 require_once($class_file);
00061                 $eval_str = sprintf('$GLOBALS[\'__DB__\'][\''.$db_type.'\'] = new %s();', $class_name);
00062                 eval($eval_str);
00063             }
00064 
00065             return $GLOBALS['__DB__'][$db_type];
00066         }

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

DB::getSupportedDatabase (  ) 

DB.class.php 파일의 543 번째 라인에서 정의되었습니다.

다음을 참조함 : $result.

00543                                        {
00544             $result = array();
00545             if(function_exists('mysql_connect')) $result[] = 'MySQL';
00546             if(function_exists('cubrid_connect')) $result[] = 'Cubrid';
00547             if(function_exists('ibase_connect')) $result[] = 'FireBird';
00548             if(function_exists('pg_connect')) $result[] = 'Postgre';
00549             if(function_exists('sqlite_open')) $result[] = 'sqlite2';
00550             if(function_exists('PDO')) $result[] = 'sqlite3(PDO)';
00551             return $result;
00552         }

DB::getSupportedList (  ) 

지원 가능한 DB 목록을 return

DB.class.php 파일의 79 번째 라인에서 정의되었습니다.

00079                                     {
00080             $oDB = new DB();
00081             return $oDB->_getSupportedList();
00082         }

DB::isConnected (  ) 

DB::isError (  ) 

DB::isSupported ( db_type  ) 

지원하는 DB인지에 대한 check

DB.class.php 파일의 123 번째 라인에서 정의되었습니다.

00123                                        {
00124             $supported_list = DB::getSupportedList();
00125             return in_array($db_type, $supported_list);
00126         }

DB::putCountCache ( tables,
condition,
count = 0 
)

카운터 캐시 데이터 저장

DB.class.php 파일의 507 번째 라인에서 정의되었습니다.

다음을 참조함 : FileHandler::makeDir(), FileHandler::writeFile().

00507                                                                 {
00508             return false;
00509             if(!$tables) return false;
00510             if(!is_dir($this->count_cache_path)) return FileHandler::makeDir($this->count_cache_path);
00511 
00512             $condition = md5($condition);
00513 
00514             if(!is_array($tables)) $tables_str = $tables;
00515             else $tables_str = implode('.',$tables);
00516 
00517             $cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
00518             if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
00519 
00520             $cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
00521 
00522             FileHandler::writeFile($cache_filename, $count);
00523         }

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

DB::resetCountCache ( tables  ) 

카운터 캐시 리셋

DB.class.php 파일의 528 번째 라인에서 정의되었습니다.

다음을 참조함 : FileHandler::makeDir(), FileHandler::removeFile(), FileHandler::writeFile().

00528                                           {
00529             return false;
00530             if(!$tables) return false;
00531             if(!is_dir($this->count_cache_path)) return FileHandler::makeDir($this->count_cache_path);
00532 
00533             if(!is_array($tables)) $tables = array($tables);
00534             foreach($tables as $alias => $table) {
00535                 $filename = sprintf('%s/cache.%s%s', $this->count_cache_path, $this->prefix, $table);
00536                 FileHandler::removeFile($filename);
00537                 FileHandler::writeFile( $filename, '' );
00538             }
00539 
00540             return true;
00541         }

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

DB::setError ( errno = 0,
errstr = 'success' 
)

에러발생시 에러 메세지를 남기고 debug 모드일때는 GLOBALS 변수에 에러 로깅

DB.class.php 파일의 195 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBSqlite3_pdo::_connect(), DBSqlite2::_connect(), DBPostgresql::_connect(), DBMysql_innodb::_connect(), DBMysql::_connect(), DBFireBird::_connect(), DBCubrid::_connect(), DBSqlite3_pdo::_prepare(), DBSqlite2::_query(), DBPostgresql::_query(), DBMysql_innodb::_query(), DBMysql::_query(), DBFireBird::_query(), DBCubrid::_query().

00195                                                            {
00196             $this->errno = $errno;
00197             $this->errstr = $errstr;
00198         }


멤버 데이타 문서화

DB::$cache_file = 'files/cache/queries/'

query cache파일의 위치

DB.class.php 파일의 46 번째 라인에서 정의되었습니다.

DB::$cond_operation

초기값:

 array( 
            'equal' => '=',
            'more' => '>=',
            'excess' => '>',
            'less' => '<=',
            'below' => '<',
            'notequal' => '<>',
            'notnull' => 'is not null',
            'null' => 'is null',
        )

DB.class.php 파일의 20 번째 라인에서 정의되었습니다.

DB::$count_cache_path = 'files/cache/db'

DB.class.php 파일의 18 번째 라인에서 정의되었습니다.

DB::$elapsed_time = 0

가장 최근에 수행된 query 의 실행시간

DB.class.php 파일의 38 번째 라인에서 정의되었습니다.

DB::$errno = 0

에러 발생시 에러 코드 (0이면 에러가 없다고 정의)

DB.class.php 파일의 35 번째 라인에서 정의되었습니다.

DB::$errstr = ''

에러 발생시 에러 메세지

DB.class.php 파일의 36 번째 라인에서 정의되었습니다.

DB::$fd = NULL

connector resource or file description

DB.class.php 파일의 31 번째 라인에서 정의되었습니다.

DB::$is_connected = false

DB에 접속이 되었는지에 대한 flag.

DB.class.php 파일의 42 번째 라인에서 정의되었습니다.

DB::$query = ''

가장 최근에 수행된 query string

DB.class.php 파일의 37 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DBPostgresql::_createTable(), DBCubrid::_createTable(), DBPostgresql::_executeDeleteAct(), DBMysql_innodb::_executeDeleteAct(), DBMysql::_executeDeleteAct(), DBCubrid::_executeDeleteAct(), DBPostgresql::_executeInsertAct(), DBMysql_innodb::_executeInsertAct(), DBMysql::_executeInsertAct(), DBCubrid::_executeInsertAct(), DBPostgresql::_executeSelectAct(), DBMysql_innodb::_executeSelectAct(), DBMysql::_executeSelectAct(), DBCubrid::_executeSelectAct(), DBPostgresql::_executeUpdateAct(), DBMysql_innodb::_executeUpdateAct(), DBMysql::_executeUpdateAct(), DBCubrid::_executeUpdateAct(), DBPostgresql::_getNavigationData(), DBMysql_innodb::_getNavigationData(), DBMysql::_getNavigationData(), DBCubrid::_getNavigationData(), DBSqlite3_pdo::_prepare(), DBSqlite2::_query(), DBPostgresql::_query(), DBMysql_innodb::_query(), DBMysql::_query(), DBFireBird::_query(), DBCubrid::_query(), DBPostgresql::addColumn(), DBMysql_innodb::addColumn(), DBMysql::addColumn(), DBCubrid::addColumn(), DBPostgresql::addIndex(), DBMysql_innodb::addIndex(), DBMysql::addIndex(), DBCubrid::addIndex(), DBPostgresql::dropColumn(), DBMysql_innodb::dropColumn(), DBMysql::dropColumn(), DBCubrid::dropColumn(), DBPostgresql::dropIndex(), DBMysql_innodb::dropIndex(), DBMysql::dropIndex(), DBCubrid::dropIndex(), DBPostgresql::getNextSequence(), DBMysql_innodb::getNextSequence(), DBMysql::getNextSequence(), DBCubrid::getNextSequence(), DBPostgresql::isColumnExists(), DBMysql_innodb::isColumnExists(), DBMysql::isColumnExists(), DBCubrid::isColumnExists(), DBPostgresql::isIndexExists(), DBMysql_innodb::isIndexExists(), DBMysql::isIndexExists(), DBCubrid::isIndexExists(), DBPostgresql::isTableExists(), DBMysql_innodb::isTableExists(), DBMysql::isTableExists(), DBCubrid::isTableExists(), DBMysql_innodb::isValidOldPassword(), DBMysql::isValidOldPassword().

DB::$result = NULL

DB::$supported_list = array()

지원하는 DB의 종류, classes/DB/DB***.class.php 를 이용하여 동적으로 작성됨

DB.class.php 파일의 44 번째 라인에서 정의되었습니다.

DB::$transaction_started = false

트랙잭션 처리 flag

DB.class.php 파일의 40 번째 라인에서 정의되었습니다.


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.:

생성시간 : Wed Jun 3 15:12:36 2009, 프로젝트명 : XpressEngine, 생성자 :   doxygen 1.5.8