1
Mamba
XOOPS 2.6.0 Conversion to "mysqli" (mysql improved) PHP extension
  • 2012/12/11 15:19

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


The PHP "mysql" extension is not developed anymore, and could be deprecated any time now. So it would be positive to start using the "mysqli" extension (mysql "improved").

I've run XOOPS 2.6.0 through a converter from Oracle:

https://wikis.oracle.com/display/mysql/Converting+to+MySQLi

and have created a test branch for it:

https://sourceforge.net/p/xoops/svn/10359/tree/XoopsCore/branches/2.6.x/2.6.0_mysqli/

The converted XOOPS 2.6.0 seems to be working fine on PHP 5.4.8 with "mysql" extension turned off, but I need some DB gurus to go through all the warnings and see what else should be changed/adjusted manually (see the readme_myqsli_conversion_warnings.txt file).

Once the conversion is properly done and finalized, we could think about converting all DB calls to OOP style using mysqli, and then to PDO

But the first thing is to make sure that XOOPS 2.6.0 works properly with "mysqli" extension.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

2
Mamba
Re: XOOPS 2.6.0 Conversion to "mysqli" (mysql improved) PHP extension
  • 2012/12/11 19:39

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


An issue that I've found right now is a problem on some occasions with escaping strings when XOOPS stores data in the database. I'll have to investigate it more....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
redheadedrod
Re: XOOPS 2.6.0 Conversion to "mysqli" (mysql improved) PHP extension

Mamba, the connector class I posted to SVN was a MySQLi conversion that I went through to make sure the code worked with 2.5.4 a few months ago.

The conversion programs don't do a 100% conversion so they need to be gone through.

The posting I made had no support for new features.

I will be working on a PHPunit test to test the database connector and go from there. My classes are done until Jan 14th so I am making this my top priority because I would like to get the PDO stuff running.

Attending College working towards Bachelors in Software Engineering and Network Security.

4
redheadedrod
Re: XOOPS 2.6.0 Conversion to "mysqli" (mysql improved) PHP extension

When I tested the above mentioned MySQLi connector I had NO issues as far as I could tell. But I only used it with the base install of xoops and no modules. I accessed every menu and every option and it worked perfect as you would expect.

Be aware that any modules that directly access the MySQL connector will break with use of any other connector. It is a very simple fix to use the MySQLi connector but it does need to be considered.

Also there is a count attribute that I can not think of off the top of my head. I think it is called "Affected records". With MySQL it will count all the records that were affected by an SQL statement such as Select, Insert, Delete and any others I am forgetting. With MySQL this works fine but in every other database BUT MySQL this attribute does not work with Select statements at all. (I believe this is the case but I have to look back at my code to know which it was.)

This loss of Affectedrows is not easily fixed and the code accessing it in the module or core has to be changed. The solutions I have seen involve doing the same select with a "count" which means another query or the code has to count the records as it accesses them. In my PDO connector I am intercepting the call and checking for a select and if it is a select statement I try to guess the select and do a "count" then do the normal select statement but it is a dirty solution and I don't feel comfortable with it.

Other things to be aware of with MySQLi and other connectors...
MySQL was implemented before OOP and thus is totally Procedurally based.
MySQLi was designed to be a direct drop in replacement for MySQL and as such has a Procedural mode that can directly replace MySQL but it also has an OOP mode that allows the programming to be totally OOP.
PDO is totally OOP and has no support for Procedural operation.

These differences will not be noticeable to the user but are worth noting.

The old MySQL connector was designed for MySQL 3 and does not support many of the new functions of MySQL4 or 5. With us moving to PDO as the choice I do not believe we should add any support for the new functions to the MySQLi connector. Assuming we "break all pre 2.6" modules as Trabis suggests I believe 2.6 should totally move to PDO and not support MySQL directly at all. However the MySQLi connector makes sense to help 2.5.x stay compatible when MySQL connector is removed.

There were two omissions from MySQLi to PDO that I am aware of. One had to do with the affectedrows I mentioned above but the other refers to a feature new to MySQLi as compared to MySQL. It has to do with stored procedures. I think it was something along the lines of with MySQL you could call multiple stored procedures simultaneously where as other databases available could only call them one at a time. I am typing this from memory so I might be a little inaccurate. But I am assuming that at this time MySQLi will be available to move to when MySQL connector support is removed from PHP. But should not be included in 2.6 if we break the modules.

Attending College working towards Bachelors in Software Engineering and Network Security.

Login

Who's Online

121 user(s) are online (88 user(s) are browsing Support Forums)


Members: 0


Guests: 121


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits