Posted in July 10, 2009 ¬ 9:13 amh.Chris Richards
The keyPath I talked about last time is just to useful to wait on. So I added it. This lets you easly get values from DBObjects within other DBObjects. So on the death date example from last time.
return (DateTime)((DBObject)valueForKey(“user_info”)).valueForKey(“column_death_date”);
is replaced with
return (DateTime)valueForKeyPath(“user_info.column_death_date”);
Read the rest of this entry »
Posted in July 9, 2009 ¬ 2:10 pmh.Chris Richards
I think it’s time for a demonstration. In this example I show two ways you can use joined tables within the object. I also so why the KeyPath would be a useful addition to the object.
In User.BirthDate I’m joining two columns from the table users_info directly into the User object. There are problems with this. [...]
Read the rest of this entry »
Posted in July 9, 2009 ¬ 8:34 amh.Chris Richards
Note: I really shouldn’t call this refactoring because it’s an api change.
My SetProperty() and GetProperty() methods are really just my weak attempt to add KVC (Key Value Coding) to the DBObject. This is something built in to objective-c. So I want to rename these methods to reflect their true nature. (The word Property was confusing [...]
Read the rest of this entry »
Posted in July 9, 2009 ¬ 7:00 amh.Chris Richards
DBObject has come a long way recently and there is a lot of duplicated code. So I think now is a good time to refactor.
Let’s start with the most obvious items. There are only 11 methods in the DBObject, 7 of them take string connection, 4 take string index_column, and another 4 take string table. [...]
Read the rest of this entry »
Posted in July 8, 2009 ¬ 9:18 amh.Chris Richards
Last time I said it would be nice to know if the record already exists in the database. When you want a one-to-many relationship, you don’t want to accidentally add the same record more than once. If an object is made that has the exact same values as another record, we shouldn’t add it, but [...]
Read the rest of this entry »
Posted in July 7, 2009 ¬ 9:04 amh.Chris Richards
I’ve added self updating and Insert to the DBObject. I’ve also changed the naming of the columns it pulls from the database. Each column property now starts with “column_”.
Read the rest of this entry »
Posted in June 19, 2009 ¬ 4:36 pmh.Chris Richards
Recently someone found my blog by searching google asking how to get the column name from a MySqlDataReader. I doubt they found the answer on my blog, so I figured I’d write about, just in case anyone else needs to know.
Read the rest of this entry »
Posted in June 11, 2009 ¬ 10:19 amh.Chris Richards
Looking into other ORMs and Linq I came across subsonic. I watched the video and build a quick little sample application with it. I had a slight problem at first because it kept giving me an error with my MySql.Data reference. I upgraded my DLL and played around with it some more, still no luck. [...]
Read the rest of this entry »
Posted in May 29, 2009 ¬ 8:32 amh.Chris Richards
I created the GetProperty() and SetProperty() methods to allow the base object to manage holding the variables needed for the object. I’ve implemented these methods on my old object classes just to test them out in some real world examples. I’ve found two problems, the first is that sometimes I only want to set a [...]
Read the rest of this entry »
Posted in April 22, 2009 ¬ 4:10 pmh.Chris Richards
I’ve worked on the Joining with attributes a little bit but I’ve run into a problem. Maybe it’s not really a problem but I just think it is.
I can easily get the Join string from the attribute, and the new .WhereJoin uses it. The method gets all the tags for the user as expected.
So whats [...]
Read the rest of this entry »