[#7542] MDB2 error on changing share permissions with SQL Driver
Summary MDB2 error on changing share permissions with SQL Driver
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners chuck (at) horde (dot) org
Requester michael.menge (at) zdv (dot) uni-tuebingen (dot) de
Created 2008-10-23 (4470 days ago)
Updated 2009-01-29 (4372 days ago)
Assigned 2009-01-29 (4372 days ago)
Resolved 2009-01-29 (4372 days ago)
Patch No

2009-01-29 15:53:44 Chuck Hagenbuch Comment #9
State ⇒ Resolved
Reply to this comment
executeMultiple is just doing the same thing we do, maybe *slightly* 
more efficiently depending on the actual db handling of prepared 
statements, etc. Anyways this code will be ported to Horde_Db for 
horde 4, so I don't see a need to mess with it if it's working.
2009-01-29 10:53:36 Jan Schneider State ⇒ Assigned
2009-01-27 15:45:46 michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #8 Reply to this comment
The changes done for http://bugs.horde.org/ticket/?id=7825 obsolate 
the changes for this Bug

so executeMultiple can be used again.

2008-11-07 17:02:37 Chuck Hagenbuch Comment #7 Reply to this comment
This is only on updates; of course it's not ideal, but if there are 
enough updates going on for load to be an issue, you'll run into 
bottlenecks in other places far sooner.

It's not an issue for groups; the debug handler isn't used there (so 
hopefully isn't necessary).
2008-11-07 08:06:17 michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #6 Reply to this comment
This seems inefficent to me as the connection is resetted and the 

is executed for every user and group that has permissions on a share. 
I think it would be better

to reset the databaseconnection only if there is a need to do so.

We don't use Groups, but grep -R -F executeMultiple *

showed that there is also lib/Horde/Group/sql.php which uses executeMultiple.

Is there the same problem?

2008-11-07 04:32:09 Chuck Hagenbuch Comment #5
Assigned to Chuck Hagenbuch
State ⇒ Resolved
Reply to this comment
The difference isn't in connected_database_name, it's that the 
postgres driver uses real prepared statements while the mysql driver 
emulates them. I think the fix is to just not use executeMultiple. 
Done for 3.3.1.
2008-10-24 10:29:00 Jan Schneider Comment #3 Reply to this comment
I updated bug #6997 with the irc discussion that led to the current solution.
2008-10-24 10:20:37 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Even though this patch was a workaround only, it works fine for MySQL. 
Someone who has better knowledge of PostgreSQL's connection handling 
and the details of MDB2 has take a look at it.

My first guess is, that the pgsql driver handles unsetting of 
connected_database_name differently than the mysql driver.
2008-10-23 07:44:12 michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ MDB2 error on changing share permissions with SQL Driver
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
Horde                      3.3 with (sql shares driver)

MDB2                       2.4.1

MDB2_Driver_pgsql          1.4.1

MDB2_Driver_querysim       0.6.0

MDB2_Schema                0.8.2

PostgreSQL                 8.1.11

Changing permissions for shares ersults in an MDB2 error

prepared statement 
"mdb2_statement_pgsql_0e0c6cd9ec2d2223511d9bc21134714a" does not exist

The executeMultiple() tries to execute the prepared statement for each user,

which has permissions on the share. The databese log shows that the execute

inserts the permissions for the first user (normaly the owner of the share).

Than the databaseconnection is reset. After a reconnect the

next execute fails as the prepared statement does not exist anymore.

The reset of the databaseconnection is caused by the function _selectDB

in lib/Horde/Share/sql.php

The function was introduced with the patch


which was done to solve the BUG http://bugs.horde.org/ticket/6997

Saved Queries