'php'에 해당되는 글 3건

  1. 2010/02/04 PHP array to object
  2. 2010/01/29 [Codeigniter] Oracle + mysql 동시사용
  3. 2009/12/21 이클립스 SVN 설치
분류없음2010/02/04 13:52
개인적으로.. 작업을 하다보면... array 보다는 object가 좋을때가 있다..

그래서 쿼리값을 array 와 object로 선택적으로 받아서 사용하도록 구성을 한다...

array를 object로 변환하는 함수..

function bindArrayToObject($array) {
    $return = new stdClass();
    foreach ($array as $k => $v) {
        if (is_array($v)) {
            $return->$k = bindArrayToObject($v);
        }
        else {
            $return->$k = $v;
        }
    }

    return $return;
}


원글) http://snipplr.com/view.php?codeview&id=8770

저작자 표시 비영리 변경 금지
Posted by Tommy Lymm
분류없음2010/01/29 13:32
- 용도 : codeigniter에서 oracle과 mysql을 동시에 사용하는 방법입니다.

- 환경 : apmsetup 6, oracle 10g

###### 오라클 설치 ############
http://codeigniter-kr.org/tip/view/341/page/1

###### apmsetup 에 오라클 연동 #######
php.ini에서 다음 2개 주석해제후 apm 재시작
extension=php_oci8.dll
extension=php_oracle.dll

##### codeigniter > database.php 설정 ########
 
01.$active_group = "mysql";
02.$active_record = TRUE;
03. 
04.$db['mysql']['hostname'] = "localhost";
05.$db['mysql']['username'] = "root";
06.$db['mysql']['password'] = "apmsetup";
07.$db['mysql']['database'] = "cidb";
08.$db['mysql']['dbdriver'] = "mysql";
09.$db['mysql']['dbprefix'] = "";
10.$db['mysql']['pconnect'] = TRUE;
11.$db['mysql']['db_debug'] = TRUE;
12.$db['mysql']['cache_on'] = FALSE;
13.$db['mysql']['cachedir'] = "";
14.$db['mysql']['char_set'] = "utf8";
15.$db['mysql']['dbcollat'] = "utf8_general_ci";
16. 
17. 
18.$dbhost = "localhost";    //IP of my host database
19.$dbport = "1521";    //Oracle port
20.$dbname= "ORCL";    //My database Name
21. 
22.$dbConnString = "
23. (DESCRIPTION =
24. (ADDRESS_LIST =
25.   (ADDRESS = (PROTOCOL = TCP)(HOST = ".$dbhost.")(PORT = ".$dbport."))
26. 
27. (CONNECT_DATA =
28.     (SID = ORCL)
29.  (SERVICE_NAME = ".$dbname.")
30. ))";
31. 
32.$db['oracle']['hostname'] = $dbConnString;
33.$db['oracle']['username'] = "combort";   
34.$db['oracle']['password'] = "1234";  
35.$db['oracle']['database'] = "";
36.$db['oracle']['dbdriver'] = "oci8";  
37.$db['oracle']['dbprefix'] = "";
38.$db['oracle']['pconnect'] = TRUE;
39.$db['oracle']['db_debug'] = TRUE;
40.$db['oracle']['cache_on'] = FALSE;
41.$db['oracle']['cachedir'] = "";
42.$db['oracle']['char_set'] = "utf8";
43.$db['oracle']['dbcollat'] = "utf8_general_ci";

##### codeigniter > 컨트롤 사용예제 ########

 

01.<?php
02. 
03.class Welcome extends Controller {
04. 
05.    function Welcome()
06.    {
07.        parent::Controller();  
08.        $this->load->dbforge();
09. 
10.        $this->DB1 = $this->load->database('mysql', TRUE);
11.        $this->DB2 = $this->load->database('oracle', TRUE);
12.    }
13.     
14.    function index()
15.    {
16.          echo "mysql or oracle Test";
17.    }
18. 
19.    function mysql_select()
20.    {
21.        $query = $this->DB1->query("select * from board");
22.        foreach ($query->result_array() as $row) {
23. 
24.            echo $row['title'];
25. 
26.        }
27. 
28.        echo "출력";
29.    }
30. 
31. 
32.    function mysql_insert()
33.    {
34.          $this->DB1->query("insert into board(title, memo) values('3','test')");
35.    }
36. 
37. 
38.    function oracle_select()
39.    {
40.        $query = $this->DB2->query("select C_NAME from customer");
41.        foreach ($query->result_array() as $row) {
42. 
43.            echo $row['C_NAME'];
44. 
45.        }
46. 
47.        echo "출력";
48.    }
49. 
50. 
51.    function oracle_insert()
52.    {
53.          $this->DB2->query("insert into customer(C_NO, C_NAME, C_ADDR, C_PHONE, C_DIST) values('3','test','test','1234','11')");
54.    }
55. 
56.}

※ 참고 : ci에서 제공하는 데이터베이스 forge, util은 100% 구현테스트를 못해보았습니다.


첨부파일에 : 1.7.2 기준으로 테스트한 전체 소스 예제 참조하시면 됩니다.

위내용은 Codeigniter 한국사요자포럼의 내용입니다.
원글) http://codeigniter-kr.org/source/view/332/page/1/q/oracle%20+%20mysql


저작자 표시 비영리 변경 금지
Posted by Tommy Lymm
OLD_DATA/PHP tips2009/12/21 09:04

Subversive installation instructions

Subversive can be simply installed from within Eclipse using update manager. All what the user should do is just point update manager to the remote or local update site. To install Subversive:

  1. Start Eclipse and select menu item 'Help > Software Updates...'

    Software Updates

  2. Select the 'Available Software' tab group and click the 'Add Site...' button.

    Update manager

  3. On the 'Add Site' dialog enter the URL to SVN Connectors update site. The proper URL can be found on http://www.eclipse.org/subversive/downloads.php. Also the update-site for Subversive integration plug-ins can be added in the same way.
    • Please note that the use of the software you are about to access may be subject to third party terms and conditions and you are responsible for abiding by such terms and conditions.

    Click on the 'OK' button to store update site information.

    New update site

  4. The Subversive update site provides following features list.
      Required feature, which should be installed unconditionally:
    • SVN Team Provider - The Eclipse Team Provider for the Subversion version control system.


    • Optional integrations with other plug-ins, which can be installed if you use these plugins and want to have them integrated with Subversive:
    • Subversive Integration for the Mylyn Project - Integration with Mylyn (http://www.eclipse.org/mylyn/).


    • Other optional features:
    • JDT Ignore Extensions - The feature is useful for Java development because it allows to interpret output folders as ignored resources automatically.
    • SVN Team Provider Sources - The sources of the Eclipse Team Provider for Subversion.

    Select SVN Team Provider, Subversive SVN Connectors and other features if required and click the 'Install' button.

    Feature Search Result

  5. The update manager calculates dependencies and offers you a list of features to install. Select the needed ones and click the 'Next >' button.

    Features to Install

  6. Accept terms of license agreement and click the 'Finish' button in order to start the download of selected features.

    Feature License

  7. To apply installation changes and restart Eclipse click on the 'Yes' button.

    Restart dialog

  8. After Eclipse restart you are able to start using Subversive.
  9. You can find Subversive perspective and views in correspondent dialogs, activated by menu items 'Window > Open Perspective > Other...' and 'Window > Show View > Other...'.

    Open Perspective Show View


아래 사이트에서 스크랩하였습니다.
http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php
저작자 표시 비영리 변경 금지

'OLD_DATA > PHP tips' 카테고리의 다른 글

이클립스 SVN 설치  (0) 2009/12/21
Posted by Tommy Lymm