 |
 | [resolved] Code completion issue with PEAR/MDB2 |  |
Joined: 08 Sep 2007 |
Posts: 5 |
|
|
 |
Posted: Fri Sep 07, 2007 12:50 pm |
|
 |
 |
 |
 |
Project setting has "C:\wamp\php\PEAR\pear" in the "Code insight includes" section.
code is:
require_once ("MDB2.php");
$dsn = array(
'phptype' => 'mysqli',
'username' => 'root',
'password' => '',
'hostspec' => 'localhost',
'database' => 'site',
);
$options = array(
'debug' => 2,
/*'result_buffering' => false,*/
);
// create MDB2 instance
MDB2::factory();
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
$table = 'users';
$query = "INSERT INTO $table (U_UserName, U_Password, U_FirstName, U_LastName) VALUES (:name, :pass, :firstName, :lastName)";
$stmt = $mdb2->prepare($query, array('name' => 'text', 'pass' => 'text', 'firstName' => 'text', 'lastName)' => 'text'), true);
$stmt->execute(array('name' => 'test1', 'pass' => 'polar', 'firstName' => 't1', 'lastName' => 't2'));
|
the $mdb2->prepare() and $stmt->execute() don't get AutoComplete/Tooltip. The errors are:
How do I get it to work properly?
Thanks
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Sun Sep 09, 2007 5:02 am |
|
 |
 |
 |
 |
btw, seems you forgot to assign $mdb2 variable with value returned from MDB2::factory();
but anyway, phpdoc for MDB2 is a bit broken and is not useful for PhpED's code completion engine. Indeed, MDB2::factory()'s phpdoc for returning value is:
* @return mixed a newly created MDB2 object, or false on error |
So it tells that the class name is "a", so it can't be found
if you change it to
* @return mixed MDB2_Driver_Common a newly created MDB2 object, or false on error |
it will start working for you.
The same goes for MDB2_Driver_Common::prepare where you may want to add MDB2_Statement_Common as a returning class type:

|
_________________ The PHP IDE team
|
 |
 | |  |
Joined: 21 Sep 2007 |
Posts: 9 |
|
|
 |
Posted: Thu Sep 20, 2007 1:31 am |
|
 |
 |
 |
 |
I got the same problem.
If I new the MDB2 class,the code completion is fine.
But If I use MDB2::connect,it will fail.
The $dsn-> can't show the code completion.
And sometimes,$dsn2-> will NOT appear code completion....why?
|
|
Joined: 21 Sep 2007 |
Posts: 9 |
|
|
 |
Posted: Tue Sep 25, 2007 6:39 am |
|
 |
 |
 |
 |
I had tried many times,but still failed.
I already set the code insight path,and I extract the PEAR class into phped/include_lib.
php.ini's include path:
include_path = ".;C:\Program Files\nusphere\phped\include_lib;C:\Program Files\nusphere\phped\include_lib\PEAR"
↑It's just no MDB2,but have smarty:shock:
Can you help me to figure out what's wrong with it?
Thanks a lot!
|
|
Joined: 21 Sep 2007 |
Posts: 9 |
|
|
 |
Posted: Tue Sep 25, 2007 9:40 pm |
|
 |
 |
 |
 |
Thanks a lot!
After I add the MDB2_Driver_Common in the phpdoc comment,the code completion is ok.
But it just can't appear all funcitons:
It should appear fetchOne,fetchAll...etc,but it's not.
Which comment should I add to?
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
|
|
|
|  |