MySQLi Support/Compatibility

A place to discuss development of the Xataface core.

MySQLi Support/Compatibility

Postby cyberws » Sun Jan 20, 2013 2:45 pm

Hello,

I was wondering if Xataface supports the MySQLi interface. The old MySQL connection protocols are considered outdated and support has been dropped. I did find old MySQL functions in the lib/mysql_functions.php file. Now is the time to start migrating over to the new connection protocols.

Thanks.

Respectfully,

Jeremy
cyberws
 
Posts: 19
Joined: Wed Jul 01, 2009 10:32 am

Re: MySQLi Support/Compatibility

Postby shannah » Mon Jan 21, 2013 12:17 pm

Xataface still uses the mysql library. Since it is being deprecated, I will have to port everything over to mysqli. This shouldn't be hard, just incovenient.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: MySQLi Support/Compatibility

Postby cyberws » Mon Jan 21, 2013 1:13 pm

Thanks for the update. I hear you there. I have slowly begun moving my programmed applications to MySQLi.

As you state it isn't hard just a small hassle, however that is programming. I know even many major applications like Wordpress still run the old MySQL connector. However in the not to distant future the standard MySQL connector will disappear. So it is time to start getting programs off MySQL and on to MySQLi before the disappearance of the old connector.

We still have time but better get move on this for all apps that use the old connection method.
cyberws
 
Posts: 19
Joined: Wed Jul 01, 2009 10:32 am

Re: MySQLi Support/Compatibility

Postby shannah » Mon Jan 21, 2013 2:04 pm

This ant task can be used to crudely change all of the mysql_xxx calls to mysqli.
Code: Select all
<target name="convert-mysqli">
         <replace token="mysql_query" value="mysqli_query">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_fetch_row" value="mysqli_fetch_row">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_fetch_assoc" value="mysqli_fetch_assoc">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_fetch_object" value="mysqli_fetch_object">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_affected_rows" value="mysqli_affected_rows">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_connect" value="mysqli_connect">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_free_result" value="mysqli_free_result">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_escape_string" value="mysqli_real_escape_string">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_real_escape_string" value="mysqli_real_escape_string">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_error" value="mysqli_error">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_errno" value="mysqli_errno">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_fetch_array" value="mysqli_fetch_array">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_fetch_lengths" value="mysqli_fetch_lengths">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_num_rows" value="mysqli_num_rows">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_pconnect" value="mysqli_pconnect">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_insert_id" value="mysqli_insert_id">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_select_db" value="mysqli_select_db">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_data_seek" value="mysqli_data_seek">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_client_encoding" value="mysqli_character_set_name">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         <replace token="mysql_close" value="mysqli_close">
            <fileset dir="." includes="**/*.php"/>
         </replace>
         
         
   </target>


Of course, this (or something similar) would need to be run on all modules and application logic as well to remove all mysql_xxx references from the code.

For the actual solution, I will probably factor the calls out into a wrapper library to make it easier to, possibly, have to change the library again in the future.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Developers

Who is online

Users browsing this forum: No registered users and 3 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved