php - Switch large website from MySQL to MySQLi -
i want switch mysql mysqli, have large website.
i read https://wikis.oracle.com/display/mysql/converting+to+mysqli me , read how change mysql mysqli?. says replace of functions adding 'i' function, , should start bughunting.
but website complex , large, , take long time check if works. so: best way switch mysql mysqli large website?
thanks!
there no easy answer question practically every simple way involved doing things differently when application written.
if have direct calls mysql_* functions throughout code , no database abstraction layer queries through helper class or function need edit every command.
you cannot away adding commands mysql_query procedurally mysqli_query() requires first parameter link db mysql_query() if connection given @ all, second parameter.
instead of changing mysql_query(...) mysqli_query($link,.....) recommend there no better time put db abstraction layer in place. use functions eg sql_query() process queries in future if need change db again can update db specific commands in 1 abstraction file. way if write function wraps mysqli_query able rename mysql_query() helper function , let helper function worry putting link in there.
whilst simplest way, not bind parameters or prepare statements major factor in preventing sql injection vulnerabilities
once have changed these commands need test.
if have no automated tests written time start writing them. though need check every change has worked, if automated test can avoid pain in future.
Comments
Post a Comment