4 ms·
I agree 100%. I tried to use and write a nice ORM but they usually get overly complex quickly, or are too simple. Now, I don't mind writing a simple boilerplate
by leftnode 15y ago
I agree 100%. I tried to use and write a nice ORM but they usually get overly complex quickly, or are too simple. Now, I don't mind writing a simple boilerplate parameterized SQL query if it means my database access is lightening quick and I have the option to write as simple or as complex queries as I need.
- dools 15y agoWait'll you see the project I'm about to open source ;)
- rjbond3rd 15y agoGive us a hint.
- dools 15y agoI'll go you one better! I figured I may as well chuck this on github now - I've been stalling for weeks until I got the time to update it to use PDO/parametrized queries by default but I've just put a large warning at the top of the README that it's pre-release: https://github.com/iaindooley/Anorm https://github.com/iaindooley/Anorm The ORM for SQL lovers! That's only half the story: I've done the "query reader". Hopefully we can all come up with the ultimate "query builder" together - but the basic principle is that the query reader and query builder should be kept completely separate with SQL as their interface. I also need to come up with a neat way using closures to "mix-in" functionality to the "query row" objects (that take the place of the normal "boiler plate" DbObject type classes (usually "one per table" kind of deal). What do y'all reckon? Email iain@workingsoftware.com.au or fork the project - would love to hear everyone's opinions.
- eropple 15y agoI hate to be that guy, but Anorm is already the name of the Play! Scala ORM. Might want to consider a rename. =)
- dools 15y agoHaha no shit! That's hilarious. Anorm was a typo last year in November when I was first talking to my friend about it on IRC. I meant to type "an orm" - maybe someone else made the same mistake ;) Thanks for the heads up! (name suggestions welcome :)
- alnayyir 15y agoWell, if it were Python and not PHP, you'd have a customer. :) Any excuse to get away from SQLAlchemy is a good one in my book.
- dools 15y agoIn reply to alnayyir: "Well, if it were Python and not PHP, you'd have a customer. :)" This from the README: Anorm is implemented here using PHP, however it was so easy to build (only took me an hour to write the actual code) that I would encourage others to use a similar pattern and implement it in other languages. Fork and enjoy! I'd love to see this same pattern implemented in a bunch of different languages
- wvenable 15y agoI like this. I looked at the code but I couldn't find how it gets the table name corresponding to the columns in order to populate the correct objects. The mysql interface has mysql_field_table() but that doesn't exist in mysqli or PDO.
- dools 15y agoHi there, I'm not 100% sure what you mean here but I would love to continue the discussion - feel free to email me: iain@workingsoftware.com.au