2011-09-04 13:54

CI_DB_mysql_driver NetBeans中的CodeIgniter类自动完成


I'm developing project by CodeIgniter in NetBeans IDE.

first of each of my file (Model and Controller) I add

* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
* @property CI_Email $email
* @property CI_Encrypt $encrypt
* @property CI_Exceptions $exceptions
* @property CI_Form_validation $form_validation
* @property CI_Ftp $ftp
* @property CI_Hooks $hooks
* @property CI_Image_lib $image_lib
* @property CI_Input $input
* @property CI_Language $language
* @property CI_Loader $load
* @property CI_Log $log
* @property CI_Model $model
* @property CI_Output $output
* @property CI_Pagination $pagination
* @property CI_Parser $parser
* @property CI_Profiler $profiler
* @property CI_Router $router
* @property CI_Session $session
* @property CI_Security $security
* @property CI_Sha1 $sha1
* @property CI_Table $table
* @property CI_Trackback $trackback
* @property CI_Typography $typography
* @property CI_Unit_test $unit_test
* @property CI_Upload $upload
* @property CI_URI $uri
* @property CI_User_agent $agent
* @property CI_Validation $validation
* @property CI_Xmlrpc $xmlrpc
* @property CI_Xmlrpcs $xmlrpcs
* @property CI_Zip $zip
* @property Image_Upload $image_upload
* @property Lang_Detect $lang_detect

 * * * * * * * * Model * * * * * *

* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
* @property Address_Model $address_model
* @property Admin_Model $admin_model
* @property Buyer_Model $buyer_model
* @property Email_Model $email_model
* @property Product_Model $product_model
* @property Store_Model $store_model
* @property Tailor_Model $tailor_model

to add auto complete to it.

but when I wanna to use query like $query = $this->db->query("YOUR QUERY");

$query don't support auto complete,when I used var_dump($query) I found this is CI_DB_mysql_driver object.

now how can I add CI_DB_mysql_driver to auto complete list by $query name?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • duanhongxian6982 duanhongxian6982 10年前

    I found a bit of a hack.

    1) add:

    @property CI_DB_result $query

    To your model.

    Then rather than $query = $this->db->query(), Use $this->query = $this->db->query().

    Then, as you type $this->query, the autocompleter will come up as expected.

    This will be troublesome though if you need to have 2 queries active, or a query within a loop from another query. In such cases, you would have to have 2 variables for each query.

    点赞 评论 复制链接分享
  • dqhbuwrwq692118284 dqhbuwrwq692118284 8年前

    in system/database/DB_driver.php

    change function query @return of class CI_DB_driver

    @return mixed


    @return boolean|CI_DB_result

    点赞 评论 复制链接分享
  • doucandiao9180 doucandiao9180 10年前

    You're using Active record library, so go to \system\database\DB_active_rec.php and then find their respective class properties and then write them to your IDE(netbeans) autocomplete library.

    点赞 评论 复制链接分享