Questions tagged [mdb2]

A database abstraction layer for PHP.

At the time of this writing, the last stable version was released on 2007-05-03 and the last beta version on 2012-10-29.

A better alternative is –the native since PHP 5.1.0– PDO

PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers.

It provides a common API for all support RDBMS.

Among other things MDB2 features:

  • An OO-style query API
  • A DSN (data source name) or array format for specifying database servers
  • Datatype abstraction and on demand datatype conversion
  • Portable error codes
  • Sequential and non sequential row fetching as well as bulk fetching
  • Ability to make buffered and unbuffered queries
  • Ordered array and associative array for the fetched rows
  • Prepare/execute (bind) emulation
  • Sequence emulation
  • Replace emulation
  • Limited Subselect emulation
  • Row limit support
  • Transactions support
  • Large Object support
  • Index/Unique support
  • Module Framework to load advanced functionality on demand
  • Table information interface
  • RDBMS management methods (creating, dropping, altering)
  • Full integration into the PEAR Framework
  • PHPDoc API documentation

Currently supported RDBMS:

  • MySQL
  • MySQLi (PHP5 only)
  • PostgreSQL
  • Oracle
  • Frontbase (unmaintained)
  • Querysim
  • Interbase/Firebird (PHP5 only)
  • MSSQL
  • SQLite
93 questions
0
votes
1 answer

Best way update from Pear::db to PDO,or PEAR::MDB2?

In my current project we use old library PEAR:DB. We need replace this library on something better. But project in production,and very big,and many code from db layer use PEAR::DB. What is the best way replace old code ,without broken…
R11baka
  • 29
  • 6
0
votes
3 answers

PHP to Oracle using oci8/MDB2 - _doConnect: unable to establish a connection

I'm running a Linux Fedora 19 setup with Oracle 11g, PHP 5.5.4, Apache 2.4.6, and PEAR 1.9.4. In addition to this, I have the OCI8 plug-in for PHP downloaded and enabled, and have downloaded MDB2 and the MDB2_Driver_oci8. The goal is to connect my…
zack_falcon
  • 4,186
  • 20
  • 62
  • 108
0
votes
1 answer

Cant use already installed MDB2

I installed Pear with the following command: sudo apt-get install php-pear Now Pear list gives the following output: Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar …
Swaroop Nagendra
  • 609
  • 2
  • 15
  • 25
0
votes
2 answers

Using MDB2 and MySQLi together (Good or bad?)

I want to use the PEAR Mail_queue package which requires the PEAR MDB2 package for database abstraction. I currently use MySQLi for all my database queries and dont really desire using MDB2. Would it be bad practice to use both MDB2 and MySQLi in my…
Ben McRae
  • 1
  • 1
0
votes
1 answer

Connect to mdb without knowing the cols?

I have a mdb file with a lot of data. I don't know the names of the tables or the cols inside. I need to build a c# app that will show some details on this db. What is the options to view the starcture of the tables? I tried use some mdb viewers but…
Jordan
  • 570
  • 1
  • 6
  • 24
0
votes
1 answer

Cannot redeclare class mdb2_error in Pear MDB2 package

I haven't install pear in my PC,instead I download the packages and unzip them to "libs" dictionary in my web-app.the structure of dictionary of my web-app is roughly like this: web-app +-/backend +-/libs +-/peardb +-pear.php …
user76047
  • 53
  • 2
  • 7
0
votes
1 answer

PHP List based on Form Selection: MDB2 Error: syntax error

I'm creating a table that outputs a list of country details based on a form selection but I keep getting this error: MDB2 Error: syntax error. How can I fix this type of error? Here is my code:
Yobo The Great
  • 95
  • 1
  • 13
0
votes
3 answers

How can I get all field values from a query with JOINed tables?

I have this elementary query: SELECT d.description, o.code FROM order_positions AS o LEFT JOIN article_descriptions AS d ON (o.article_id = d.article_id) WHERE o.order_id = 1 and I'm using MDB2 from PEAR to execute it and read the return…
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
0
votes
1 answer

How can I detect MDB2 installed drivers in PHP?

I'm trying to detect which MDB2 drivers are installed. That way I can use whatever the user installed. I tried using class_exists("MDB2_Driver_$driver", FALSE) or (@include_once("MDB2/Driver/$driver.php")), it does not work. (first one returns FALSE…
0
votes
1 answer

Two prepared statements on one page - first works, second fails

I'm using MDB2 for prepared statements. I'm using the name-based example from the PEAR MDB2 site as a guide, and this is what I have so far: $q = ' UPDATE abc_news SET newstitle …
a coder
  • 7,530
  • 20
  • 84
  • 131
0
votes
1 answer

Database abstraction options for hosts that disallow installation of PEAR modules

A prospective host disallows PEAR modules except for VPS/dedicated accounts. Can't afford spending $2000-3000/yr on VPS on a hobby site, so that option is out. I'd like to add some database abstraction and recoded most of my site locally with MDB2…
a coder
  • 7,530
  • 20
  • 84
  • 131
0
votes
3 answers

fatal error call to undefined method MDB2_error::disconnect()

I am running a php script in command line that connects to a oracle and mssql to fetch some data and write to a file. Actually it was a cron on linux machine which needed to be transfered to windows 2008. The command is throwing the error: fatal…
orchidit
  • 17
  • 2
  • 8
0
votes
1 answer

Is there INSERT IGNORE equivalent for MDB2 batch queries autoPrepare & executeMultiple MDB2_AUTOQUERY_INSERT

I have an index on my MYSQL database table across two fields. I batch the INSERTS using autoPrepare & executeMultiple which PHP MDB2 MYSQL extension offers. If there is a duplicate hit on my index however it throws an error and stops the batch…
jozero
  • 1
  • 1
0
votes
1 answer

Difficulty echoing error message if mysql query returns nothing PEAR PHP

I am struggling to echo an error message stating 'No results' when my mysql query returns nothing. I am using PEAR. Here is what I have at the moment. while($rows =& $output->fetchRow()) { if (numRows($query)== 0){ echo 'No results'; } else { …
Daniel Mabinko
  • 1,351
  • 3
  • 11
  • 10
0
votes
2 answers

Fatal error: Call to undefined function: MDB2_Driver_MYSQL::getAll()

I am upgrading a site from Fedora 14, PHP4, and PEAR DB to Fedora 16, PHP 5.4 and PEAR MDB2 2.5.0b3, and I am getting the error Fatal error: Call to undefined function: MDB2_Driver_MYSQL::getAll(). in /usr/share/php/MDB2.php on line…
jakimfett
  • 381
  • 4
  • 5