ezrpg-legacy / ezrpg-1.0.x

http://ezrpgproject.net
GNU General Public License v3.0
7 stars 5 forks source link

Automatically insert table prefix into insert queries #6

Closed JakeBooher closed 11 years ago

JakeBooher commented 11 years ago

Automatically insert the database prefix in the Db_mysql::insert() function

ferdis commented 11 years ago

I feel that prefixes needs to be optional. Prefixes in my mind are intended for those edge cases where one has limited databases, and combine them to avoid a "virtual" counter. This does not seem to be a problem with most hosting providers as of late.

We'd also be creating an extra dependency, which isn't really necessary. I've always disliked the use of constants in ezRPG, since there is already an efficient-enough single-dimensional array at the application's disposal. I'd raise my concerns of the security issue around using a constant for SECRET_KEY, but that's another thing all on it's own.

JakeBooher commented 11 years ago

Prefixes are optional, I should have clarified that a bit more. It will insert the prefix if is not specified in the table name. However, the prefix can be blank (ie. no prefix). I apologize for any confusion this has called

Thanks, Jake B.

ferdis commented 11 years ago

I appreciate your feedback. Mind sharing why this is only being done for insert statements? If it's indeed beneficial, then the initial assumption would be that it's implemented at a place where it's most applicable, i.e. the execute method.

JakeBooher commented 11 years ago

Because there are so many possible queries that can be run using the execute method there really isn't a good way to auto insert it so it works on every possible query that I could think of. We will be adding more methods to the db api such as select() update() and a few others by 1.0.3, along with support for MySQLi. Also, in response to your second point on your original reply, we will be making some security adjustments to the way ezRPG does things (such as removing the SECRET_KEY global)

Thanks, Jake B.

uaktags commented 11 years ago

So is the concept behind this is going to have our developers not need to include 'table' in their modules? If so, I still stand behind the idea still that a friendly message or check should be instituted to catch the redundant prefix that's included.