mdb2

MDB2 disconnects and forgets charset setting when reconnecting

We recently debugged a strange bug. A solution was found, but the solution is not entirely satisfactory. We use IntSmarty to localize our website, and store the localized strings in a database using our own wrapper. In its destructor, IntSmarty saves any new strings that it might have, resulting in a database call. We use a Singleton ...

Do MySQL prepared queries provide a performance benefit for once-per-session queries?

According to the documentation, a prepared query provides a significant performance benefit if you're running a query multiple times because the overhead of the MySQL server parsing the query only happens once. I'm wondering what exactly they mean by "multiple times" there. I.e., say you have a web page that runs a query one time. Now s...

Which should I use, pear MDB2 or pear DB_DataObject when I use MySQL when I can not use PDO?

Almost all of free web hosting server, you can not use PDO + MySQL. They lack PDO drivers. So I am considering to select pear MDB2, or DB_DataObject. Which do you reccomend to me? Give me your opinions! ...

How to make several tests using MDB2 with PHPUnit DataBase?

I use PHPUnit DataBase to test some class using MDB2. All is well, since I encounter the second test, which returns an error: Caught exception: Object of class MDB2_Error could not be converted to string When I place the second test in place of the first one, the new first test is OK, but the second one returns the same error!...

PEAR MDB2 executeStoredProc and returning a result set. Possible? Worth it?

Hi, I've been trying to make this work for the last couple of hours. I have a simple stored proc called get_log_entries: CREATE DEFINER=`root`@`localhost` PROCEDURE `get_log_entries`(p_min_id INT) BEGIN SET p_min_id = IFNULL(p_min_id, -1); SELECT * FROM db_log WHERE item_id > p_min_id; END It's dead simple and it returns results ...

PHP: Using quote() on strings in MDB2 with MYSQL

Hi I'm using Pear's MDB2 and really enjoying it, but there is something that is starting to annoy me. I build the SQL string in the following way, using the quote method of the mdb2 package: $sql = sprintf("INSERT INTO profiles(email, fullName) VALUES(%s,%s)", $mdb2->quote($email), $mdb2->quote($fullName)); (as explained in...

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 values. But somehow the result array always contains fields from the order_positions table only!,...

Pear Log MDB2 message length and errors

Hey all, I recently set up a SQL logging framework with PEAR, and everything was working fine. However, I thought that the default length of the message field (VARCHAR 200) was a little short, so I changed my database structure in phpmyadmin to increase this to 512. However, I quickly realized that this changed completely stopped loggi...

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 +-pear5.php +-mdb2.php +-/mdb2 The application works fine in my t...

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 PHP applications at the same time? Can anyone give me a good reason to use MDB2 over ...

How to prepare BLOB in PHP using MDB2 and SQL Server?

So our application supports both MySQL and SQL Server, and we store images in the database. Now the following code works for MySQL just fine, but not at all for SQL Server. I keep getting an "MDB2: Syntax Error". At first, I had the column as an IMAGE and then I changed it to VARBINARY(MAX) and I still can't figure out what's wrong. Any...

Complex SQL query... names of returned variables

Excuse me for what I'm sure is an elementary question for most of you, but I have an issue with table columns from separate tables having the same name as one another, and trying to select from both tables in the same query. Okay, so this is my code: $q_value = $mdb2->quote($_POST['query']); $field = $_POST['field']; $sql = "SELECT m.*...

MDB2: Using Dates / Times / Intervals

Hi all, We're slowly porting some code away from MySQL specifically to MDB2. Generally, it's going pretty well. Where we are really hitting snags, though, is with the date/time/interval 'mathematics'. For example, if I wanted to grab "an hour from now" from MySQL, I use: SELECT (NOW() + INTERVAL 1 HOUR); To do it in Postgres, I need t...

MDB2 With SQL Express 2008

Hi all, So basically here's my problem. I'm looking for a solution to allow us to connect with SQL Express 2008, while still using MDB2 as our database abstraction layer. I need something like this, mainly because we still need to be able to use MySQL and Postgres (and ORMs seem to be not an option at this point in time). Preferably, t...

MDB2, Pear, Mysql error

Hi Guys, I have PEAR, MDB2 and Mysql Driver installed however I keep getting: Fatal error: Call to undefined function: MDB2_Driver_mysql::_isNewLinkSet(). in /home/**/PEAR/MDB2.php on line 1937. The Server is CentOS I am stuck, any help would be appriciated. Thanks :) ...

Pear MDB2 class and raiserror exceptions in SQL Server

Hi, in SQL Server it's possible to raise an error with raiserror(). I want to use a severity, which doesn't interrupt the connection. This error is raised in a stored procedure. In SQL Management Studio all is fine and I get my error code when executing this SP. But when trying to execute this SP via MDB2 in PHP5 this doesn't work. All I...

Getting MDB2 to work with sqlite3 via pdo

I am using MDB2_Driver_pdoSqlite to access a sqlite3 database with PEAR. I am able to connect to the database and display a list of tables with listTables(), but when I try to run the mdb2 function tableInfo() I get an error. MDB2 Error: not found [Error message: primary is not an existing table constraint] I am running the following sys...

MDB2 pear windows instalation

I am looking for a guide for installing and using MDB2 pear on my system. i use iss7 and windows vista.... I read the manual but I didn't understand too much... ...