Ticket #1376 (closed defect: fixed)

Opened 2 months ago

Last modified 2 months ago

not possible to add a MySQL DB

Reported by: gOOvER Assigned to:
Priority: blocker Milestone: ispCP ω 1.0.0 - RC6
Component: Frontend (GUI) Version: ispCP ω 1.0.0 - RC4
Severity: Don't know Keywords:
Cc:

Description

When you try to create a DB you get following error:

This command is not supported in the prepared statement protocol yet

Used Trunk: r1257

Attachments

patch.txt (489 bytes) - added by sci2tech on 07/02/08 21:16:40.
It seems to be a version related. With debian lenny I cant reproduce(mysql 5.0.51a-6, php 5.2.5). gOOvER can you test following patch? Its only for test to convince myself that I found the problem
patch_to_make_work.txt (2.7 kB) - added by sci2tech on 07/03/08 12:58:11.
This is the patch that supose to make it work. I tested admin operation and client sql operation and works. Test it please. Hope not to break lenny (ill test tonight when ill finish reinstalling my box)
patch_to_make_work2.txt (0.5 kB) - added by sci2tech on 07/05/08 12:04:48.
Symplifyed patch. Please ingnore the rest

Change History

07/02/08 17:53:46 changed by sci2tech

r1258 but I can`t reproduce

07/02/08 18:45:21 changed by gOOvER

switch from Admin to Customer. The enter MANAGE SQL and try to Add an DB. I'm not the only one with this Error. An other User has the same Error.

07/02/08 18:57:53 changed by gOOvER

Testet with r1258. The same Error.

Here is the Post (german!)

[http://www.isp-control.net/forum/this-command-is-not-supported-t-3664.html]

07/02/08 21:16:40 changed by sci2tech

  • attachment patch.txt added.

It seems to be a version related. With debian lenny I cant reproduce(mysql 5.0.51a-6, php 5.2.5). gOOvER can you test following patch? Its only for test to convince myself that I found the problem

07/02/08 23:38:53 changed by sci2tech

It is a version issue. Etch included version do support only select, include, update and delete as prepared statement. Patch provided won`t work. PDO statement can only be used with lenny so or is dropped or an alternative is created for old versions included in etch and sarge. Or everithing is rewritten to use prepared statement only with select, include, update and delete query in old versions.

(follow-up: ↓ 6 ) 07/03/08 07:12:55 changed by gOOvER

Patch don't work. When i add this line, i can't Login anymore

(in reply to: ↑ 5 ) 07/03/08 08:54:30 changed by anonymous

Replying to gOOvER:

Patch don't work. When i add this line, i can't Login anymore

Patch was not intended to make it work. It was only to establish if is a version issue. Problem is generated by PDO prepared query dont work if other then INSERT, UPDATE,SELECT or DELETE query is used. With version included in lenny this patch will turn on caching, while in etch will broke functionality (as happend to you). Patch to restablish functionality with etch ill post later after i`ll test. Now i do have a etch box so I can patch and test.

07/03/08 12:36:20 changed by gOOvER

Ah, OK, sorry for missunderstanding :)

07/03/08 12:58:11 changed by sci2tech

  • attachment patch_to_make_work.txt added.

This is the patch that supose to make it work. I tested admin operation and client sql operation and works. Test it please. Hope not to break lenny (ill test tonight when ill finish reinstalling my box)

07/04/08 11:45:27 changed by gOOvER

I can't test it at the Moment, because i have too many work.

07/05/08 12:04:48 changed by sci2tech

  • attachment patch_to_make_work2.txt added.

Symplifyed patch. Please ingnore the rest

(follow-up: ↓ 10 ) 07/06/08 21:01:08 changed by rats

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from Working to ispCP ω 1.0.0 - RC6.

I hope my solution will do the same:

if (version_compare(PHP_VERSION, '5.2.5', '<') && 
    preg_match("/(ALTER |CREATE |DROP |GRANT |REVOKE |FLUSH )/i", $sql, $matches) > 0) {
    $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, true);
} else {
    $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, false);
}

(in reply to: ↑ 9 ) 07/07/08 00:38:05 changed by sci2tech

  • status changed from closed to reopened.
  • resolution deleted.

Replying to rats:

I hope my solution will do the same: {{{ if (version_compare(PHP_VERSION, '5.2.5', '<') && preg_match("/(ALTER |CREATE |DROP |GRANT |REVOKE |FLUSH )/i", $sql, $matches) > 0) { $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, true); } else { $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, false); } }}}

Sorry to reopen but with your solution will be break with lenny (witch has MYSQL_ATTR_DIRECT_QUERY default true and will be forced to 0. This solution supose to work both with etch and lenny.

     if (version_compare(PHP_VERSION, '5.2.5', '<')){
          if(preg_match("/(ALTER |CREATE |DROP |GRANT |REVOKE |FLUSH )/i", $sql, $matches) > 0) {
               $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, true);
          } else {
               $this->_db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, false);
          }
     }

07/07/08 07:03:57 changed by rats

  • status changed from reopened to closed.
  • resolution set to fixed.

okay :)

07/07/08 18:24:45 changed by gOOvER

  • status changed from closed to reopened.
  • resolution deleted.

Testet with r1264. It didn't work. Now when i try to add a database, i only get a white side.

07/07/08 21:10:43 changed by sci2tech

It`s not the same bug. Change in ispcp/gui/client/sql_database_add.php line 26 from

$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/add_sql_database.tpl');

in

$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/sql_database_add.tpl');

07/09/08 14:17:36 changed by rats

  • status changed from reopened to closed.
  • resolution set to fixed.

thank you. Added in r1268


Add/Change #1376 (not possible to add a MySQL DB)




Action