saguaroib / saguaro

saguaro imgboard software
14 stars 5 forks source link

Convert saguaro ql #161

Closed Apogate closed 8 years ago

RePod commented 8 years ago

Are you finished with those errands? Or are you waiting on review? If you need certain things implemented, I also need to know.

I got another large-scale change that needs to be done after this. Starts with every ends with thing.

RePod commented 8 years ago

If anything does not work, instead of reverting check the code and fix it.

We'll focus on MySQL first, and once everything is converted over properly we can swap to MySQLi.

RePod commented 8 years ago

These files are the only ones left using mysql_*, specifically mysql_result() with 3 arguments:

So far I haven't noticed anything broken.

RePod commented 8 years ago

MySQLi has no complement(...) for the already shaky mysql_result().

Basically, the MySQLi instance of SaguaroQL cannot accurately replicate it and is currently using backwards-compatible code returning the expected result.

As such, after this pull is cleared usage of mysql_result() should be removed in favor of something better.

RePod commented 8 years ago

For the purpose of this PR, everything is done. All instances of MySQL interfacing have been replaced to use the SaguaroQL class.

I didn't test it thoroughly for bugs, but I honestly can't expect any (that didn't already exist).

After this is confirmed working we can start working towards MySQLi.

imgboard.php is now less than 90 lines.

Yushe commented 8 years ago

You know I'll test it loads and report all the bugs I have found when it is done.

RePod commented 8 years ago
RePod commented 8 years ago

SaguaroQL's MySQL and MySQLi now have better type handling.

Before, some of the functions, such as the fetch_* ones, were being passed a resource which was being piped directly into a query to be ran as normal which is not correct.

The classes now detect and support both resources and query strings. Using query strings is preferred however as it skips a step by automatically running the query and processing that resource as intended.

For example, these two blocks do the same thing:

$result = $mysql->query("something");
$blah = $mysql->fetch_row($result);
$blah = $mysql->fetch_row("something");

Legacy code will now function as normal again, but in the future converting things (such as the Admin/validate fix above) to the latter example would greatly improve readability.

I think with THESE fixes, this is more suitable for bug testing and 99% accurate.

RePod commented 8 years ago

Ur 2 slo