Development Information

May 6, 2012

Database Class v3.0.0

Filed under: Database Class Information,Updates — judda @ 2:45 pm

The first cut of the new database object has been completed.  From what I’ve found, it is a lot easier to use than the older versions of it.  Not only to configure, but some things have been moved around to make it much more intuitive.  I will be adding more posts on here walking through the basics on how to set up your object, as well as how to query in the new fashion.

April 21, 2012

Database Class v 3.0.0 in development

Filed under: Database Class Information,Updates — judda @ 6:44 pm

Hey All,

So I’ve finally decided to take on my overhaul of the database object that I made a few years ago now (my how time flies). I just noticed that I posted the original idea back in November 2010 (so much for doing it within the next few weeks).

Essentially this change will affect several things about the database object. The main one being the syntax used to bind the parameters to the query. You will be able to write queries as follows:

Code:

$query='SELECT `Username` FROM `Users` WHERE `Username` LIKE {0:s} OR `FullName` LIKE {0:s}';
$db->query($query, 'foo');
 
// OR
 
$query='SELECT `Username` FROM `Users` WHERE `UserId` = {u}';
$db->query($query, 'foo');

That said, I am also building into it a “classic” mode where you can use the %s and stuff as you did in the old versions.

While I am at it, I was thinking about renaming some of the type strings. The thing is with this renaming it would also affect the ‘classic’ mode. So I want to know what you guys think about it.

Below is a list of what it currently is, and what I’m thinking of changing it to, or if they are being removed.

Existing:
* %u – unsigned integer – ud
* %d – signed integer – d
* %p – decimal number – f
* %b – binary files – b
* %h – string (HTML permitted) – s
* %s – string (no HTML permitted) – es
* %l – list of values or an array – l

New:
* unsigned decimal number – f

Possible Expansion:
* list of values or an array – l – should there be type checking enabled on these? (i.e. lp would be a list of decimal numbers, ls would be a list of strings, etc.)

Removed:
* %i – IP Address – shouldn’t be storing IP addresses as strings, and it was very inflexible for IPv6
* %f – field

Another thing I could do, is make these keys also configurable so that you can get a ‘true classic’ mode by just switching the type codes back to what they originally were (except for the 2 which I was planning on removing). Would this make the upgrade easier?

While I am in here ripping out the guts of it and rebuilding it, was there anything in it that really annoyed you when using it? If yes, what was it, maybe I can improve it this time around?

There are a few simple things that I’ll be changing as well but I’ll still be leaving it so you can use it the same way as before (but with deprecation notices) so there won’t be much re-work there.

Please let me know what you think by either posting a comment on here, or sending me an email through the contact page.

May 16, 2011

MiniMVC – Small Fix

Filed under: Mini MVC Information,Updates — judda @ 12:46 am

I have pushed out a small fix for the configuration file (./app/config/config.php) out to all versions of MiniMVC.  There was an issue that if you put MiniMVC a few folders deep the URLs would start losing folders.  This has been fixed as well as I added a / at the end of the index.php so that it too can be used properly (i.e. not a special case to be handled differently than if __SHOWINDEX__ was disabled).

Sorry for any inconveniences these bugs may have caused.

May 8, 2011

MiniMVC Form Builder 1.0.10 → 1.0.11

Filed under: Mini MVC Information,Updates — judda @ 10:11 pm

Small update.  As mentioned on Wednesday, this weekend’s update fixes the issue where you could only select one value.

To select more than one value all you need to do is for the value specify an array of all keys which will be marked as selected if found.

February 17, 2011

MiniMVC 1.0.2

Filed under: Updates — Tags: — judda @ 7:29 pm

So I accidentally pushed 1.0.1 out under the 1.0.2 tag. So anyone who downloaded it yesterday, please re-download MiniMVC because it is not up to date. Sorry about the inconvenience.

MiniMVC FormBuilder 1.0.9 → 1.0.10

Filed under: Updates — judda @ 12:24 am

Fairly big update:

  • Fixed the multiselect drop down lists so that you are now able to select multiple items
  • Changed the handling of the INPUT_CHECKBOX and INPUT_RADIO, prior to this release it was one value per button however from now on, these are now able to accept an array of items (like the drop down lists) in order to build the actual list of items

MiniMVC 1.0.1 → 1.0.2

Filed under: Updates — judda @ 12:15 am

Thanks to Salathe, the .htaccess file may actually make sense.  A minor update was also made for the URI helper.

December 31, 2010

Mini MVC – Form Builder 1.0.8 → 1.0.9

Filed under: Updates — judda @ 10:14 pm

Updated the Form Builder for the following two input types:

  • Checkbox – the value will which is set will now enable and disable the checked value rather than set the ‘value’ attribute of the input element.  The value which should be passed in should be a boolean (TRUE/FALSE).  The posted value will also be returned as TRUE if the checkbox was posted checked.
  • File – the element in the value array will now contain information about the actual uploaded file rather than not be present

December 21, 2010

Mini MVC – Form Builder 1.0.7 → 1.0.8

Filed under: Updates — judda @ 7:20 pm

Tiny update but huge effect.  As was pointed out by Xylogeist, the setValue function for forms wasn’t working at all.  This has now been fixed.  Goal for next year will be to add Unit Tests so that slight of keys don’t show up any more and break the application :).

Thanks Xylogeist for pointing it out!

November 28, 2010

Potential Database Class Rewrite

Filed under: Updates — judda @ 4:51 pm

Hey guys,

Within the next few weeks I’m going to go into a complete recode for my database class. Because of this, I want to know if you guys can think of anything else which would make it even more powerful / that you would like to see implemented with it.

A few of the changes that I am thinking of are as follows:

i) Adding the ability to specify a location for a parameter to bind to – i.e. if I have a query where I am binding the same variable several times, i.e.

SELECT `username` FROM `trades` WHERE `ownerId` = %u OR `offerOwnerId` = %u

Where we are looking for everything from a single user (i.e. ownerId or offerOwnerId is one user’s user id). Currently you would have to bind it as:

$db -> query ( 'SELECT `username` FROM `trades` WHERE `ownerId` = %u OR `offerOwnerId` = %u', $userId, $userId );

I’m thinking of changing it so that you only need to provide the query function with $userId once. So now the structure of the query would be as follows:

SELECT `username` FROM `trades` WHERE `ownerId` = {0:u} OR `offerOwnerId` = {0:u}

Where the 0 is the element it will bind to the query (i.e. 0 is the first parameter, 1 would be the second and so on) then you could bind to the query like:

$db -> query ( 'SELECT `username` FROM `trades` WHERE `ownerId` =  {0:u} OR `offerOwnerId` = {0:u}', $userId );

ii) Change the parameter binding away from the use of the percent signs (i.e. %u) to using the curly braces (i.e. {u}). I could deprecate the use of the percent sign so anyone with the code written in the original format would receive deprecated warnings throughout their code when their queries are still running using the old syntax.

iii) Change all error messages to provide E_NOTICE when you have invalid parameters.

That is all I can think of for now. Anyone else have any suggestions on improvements?  If you do, please post them within the comments.

Thanks,
Andrew

Older Posts »

Powered by WordPress