2 ms·
I agree. Unfortunately each database has its own SQL dialect with small differences, so migrating to a different database becomes a problem when using plain SQL
by amedvednikov 7y ago
I agree. Unfortunately each database has its own SQL dialect with small differences, so migrating to a different database becomes a problem when using plain SQL.
You also lose compile-time checks.
I'm trying to combine the best of the two approaches in the V language. It has a built-in ORM that uses SQL-like syntax:
uk_customers := db.select from Customer where country == 'uk' && nr_orders > 0
println(uk_customers.len)
for customer in uk_customers {
println('id: $customer.id; name: $customer.name')
}
https://vlang.io/docs#orm https://vlang.io/docs#orm
- echelon 7y agoThe solution is to use something closer to a compile-time SQL or DSL, such as jOOQ or SqlAlchemy (sans the ORM pieces). These are terrific technologies that improve upon SQLs weaknesses and achieve some level of portability.