4 ms·
> If you write some code, then you have just written an ORM. What? No, I've written code to query a database. Not an Object-Relational Mapper. my $q = $db->
by PeCaN 10y ago
> If you write some code, then you have just written an ORM.
What? No, I've written code to query a database. Not an Object-Relational Mapper.
my $q = $db->prepare("get_my_stuff_by_name(?);");
$q->execute($name);
or with fancy metaprogramming:
use DBMagicStuff 'postgres://…';
get_my_stuff_by_name($name);
That's not really an ORM.
- intrasight 10y agoYou are both partially right. An ORM deals with the black magic of connections, parameters, transactions, etc. If you don't use an ORM, then you still have to deal with those semantics. But I do agree that you aren't writing an ORM.
- PeCaN 10y ago> connections, parameters The database driver takes care of that, not the ORM. (It's also not black magic.) > transactions Huh? That's a database feature. BEGIN/COMMIT/ROLLBACK are ANSI SQL. ORM is an _Object Relational Mapper_. You're confusing it with a database driver (or, in the case of transactions, just a database in general).