Problems Of String Based Query Languages

Let's look how a query can be expressed against the Car class in some of the object querying languages:

OQL

String oql = "select * from pilot in AllPilots where pilot.points < 100";

OQLQuery query = new OQLQuery(oql);

Object pilots = query.execute();

JDOQL

Query query = persistenceManager.newQuery(Pilot.class, "points < 100");

Collection pilots = (Collection)query.execute();

db4o SODA, using C#

Query query = database.Query();

query.Constrain(typeof(Pilot));

query.Descend("points").Constrain(100).Smaller();

IList pilots = query.Execute();

As you can see, query parameters ("points") and constraints ("<100") are expressed as strings, which results in the following problems: