smellyrat / drydock

Automatically exported from code.google.com/p/drydock
0 stars 0 forks source link

Move ALL database queries into DBIs #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To make future changes to individual DBIs easier, move all queries into the
DBI files, abstracting them behind DBI function calls

An example of this is changing
$boardselect = $db->myassoc("select * from ".THboards_table." where
folder='".$db->escape_string($_GET['boardselect'])."'");
to instead be:
$boardselect = $db->getboard(0, $_GET['boardselect']);
where the first parameter in getboard is an optional board ID and the
second parameter is an optional board folder.

This can be more readily accomplished by searching for all instances of
myassoc, myarray, myquery, myresult, and mymultiassoc in files not in the
/dbi/ folder and figuring out what changes are needed.

Original issue reported on code.google.com by all.sta...@gmail.com on 9 Dec 2008 at 6:32

GoogleCodeExporter commented 9 years ago
Some progress has already been made on this front- now there are no SQL queries
performed in common.php.

Files that still need modification:
admin.php (some)
drydock.php
editpost.php (a lot)
post-common.php
recentpics.php
recentposts.php
thread.php (just a few places)
??? (We'll have to check some of the subfolders as well)

It's okay to have stuff in this version of upgrade_install.php, obviously. 
rebuilds.php has already been taken care of, as well as profiles.php.

Original comment by all.sta...@gmail.com on 9 Dec 2008 at 6:38

GoogleCodeExporter commented 9 years ago
recentposts.php no longer has DB logic in it.  recentpics.php will have its DB 
logic
moved into the new ThornToolsDBI, once we figure out what else to do with that.

Original comment by all.sta...@gmail.com on 10 Dec 2008 at 7:59

GoogleCodeExporter commented 9 years ago
We need to have some sort of formal definition of what a DBI is supposed to 
have, and
standardize it between the two.

I'm going to start writing some abstract interfaces for all of the DBI classes.

Original comment by all.sta...@gmail.com on 10 Dec 2008 at 8:13

GoogleCodeExporter commented 9 years ago
Abstract interfaces are done.  Still not sure what to do about fetching 
pictures. 
From now on, all specifications for a particular function will go in the 
abstract
interface, instead of copying and pasting the function information comment 
header
across DBIs, which could lead to future problems.

Original comment by all.sta...@gmail.com on 11 Dec 2008 at 7:52

GoogleCodeExporter commented 9 years ago
Now only two files have database queries in them:
recentpics.php (because we haven't figured out how to structure the new kind of
queries to that board filtering is possible)
editpost.php (This might be a pain.  We'll see I suppose.)

We're going to rework these anyway to a templated version, which is also 
convenient.

Original comment by all.sta...@gmail.com on 12 Dec 2008 at 8:16

GoogleCodeExporter commented 9 years ago
These two are taken care of.  We might need to change one or two Smarty filters
though (but with the change to getimgs, I do not think that we will need the
extra_info plugin any more- we can just use the new column exif_text and bypass 
the
middleman)

Original comment by all.sta...@gmail.com on 14 Dec 2008 at 12:00

GoogleCodeExporter commented 9 years ago
I removed the extra_info plugin, changed the required templates, and changed
quotereply (do we need to include a DBI for this?)

Original comment by all.sta...@gmail.com on 14 Dec 2008 at 9:02

GoogleCodeExporter commented 9 years ago
Well I don't know why this wasnt marked as fixed because it's pretty clear that 
all
the db stuff is moved now

Original comment by TaQS...@gmail.com on 23 Aug 2009 at 9:06