コード例 #1
0
ファイル: mysql.class.php プロジェクト: bluecat/iiwork-php
<?php

iiWork::import('db.db');
class iiDBMysql extends iiDB
{
    public $init_query;
    public function connect($host = "localhost", $id, $pass, $db = '')
    {
        $this->host = $host;
        $this->id = $id;
        $this->pass = $pass;
        $this->db = $db;
        echo $this->host;
        $this->sql = mysql_connect($host, $id, $pass, $this->no != 0 ? true : false);
        if (!$this->sql) {
            throw new Exception('DB 연결에 실패했습니다 ' . mysql_error());
        }
        // 초기 쿼리
        if ($this->init_query) {
            $this->query($this->init_query);
        }
        // db 선택
        $this->select_db($db);
    }
    public function select_db($name)
    {
        if (!mysql_select_db($name, $this->sql)) {
            throw new Exception('DB 선택에 실패했습니다 ' . mysql_error());
        }
    }
    public function close()
コード例 #2
0
ファイル: test.php プロジェクト: bluecat/iiwork-php
<?php

// iiwork framwork test unit
include "ii.php";
$ii = iiWork::getInstance(true);
$ii->import("db.mysql");
$sql = iiDBMysql::getInstance();
//$sql->connect("localhost", "onbam", "onbam1", "onbam");
//iiDebug::trace($sql->getColumns("ob_art_list"));
function test($str)
{
    global $a;
    $a .= $str;
}
function calluser($name, $args)
{
    $name($args);
}
$array = array('a' => 1, 'b' => 2);
$object = (object) $array;
$a = '';
iiDebug::check('array');
for ($i = 0; $i <= 10000; $i++) {
    $a .= $array['a'];
}
iiDebug::check('array');
$a = '';
iiDebug::check('object');
for ($i = 0; $i <= 10000; $i++) {
    $a .= $object->a;
}
コード例 #3
0
ファイル: ii.php プロジェクト: bluecat/iiwork-php
 /**
  * 
  * @param string $type DOCTYPE_* 상수 참조
  * @param string $lang 언어
  */
 public static function setHTML($type = DOCTYPE_XHTML_1_0_TR, $lang = null)
 {
     $ii = iiWork::getInstance();
     if ($lang != null) {
         $ii->lang = $lang;
     }
     switch ($type) {
         case DOCTYPE_XHTML_1_0_TR:
             self::$html .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
             break;
     }
     // language 설정
     $html .= "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='{$ii->lang}' lang='{$ii->lang}'>\n";
 }