Getting data from the most common queries is trivial using QueryableDatatypes (QDTs)
QueryableDatatypes are a central concept within DBvolution. All of the DBString, DBNumber, etc classes used in the DBRow examples are QueryableDatatypes
Using these types rather than the standard java types allows more natural query design and value manipulation
For instance to query for a particular item in the database use:
exampleMarque.uidMarque.permittedValues(uidValue);
desiredMarque = database.get(exampleMarque);
The "Permitted" and "Excluded" methods of the QDT object encapsulates the common SQL comparisons
marque.uidMarque.permittedValues(1,2,3,4,5);
marque.uidMarque.permittedRangeInclusive(1,5);
marque.uidMarque.permittedRange(0,6);
marque.uidMarque.permittedValues(listOfValues);
marque.name.permittedValueIgnoreCase("toyota");
marque.name.permittedPattern("toy%");
Every "Permitted" method has an equivalent "Excluded" method that functions as the inverse of the operator. So if you want to get everything EXCEPT the items above use:
marque.uidMarque.excludedValues(1,2,3,4,5);
marque.uidMarque.excludedRangeInclusive(1,5);
marque.uidMarque.excludedRange(0,6);
marque.uidMarque.excludedValues(listOfValues);
marque.name.excludedValueIgnoreCase("toyota");
marque.name.excludedPattern("toy%");
There is not an exact match between SQL operators and QDT methods because DBvolution switches to the appropriate SQL operator depending on the values you supply. This simplifies your query to looking for a set of values, a range, or a pattern
| DBvolution | SQL |
| permittedValues | =, IN |
| permittedValuesIgnoreCase | =, IN |
| permittedPattern | LIKE |
| permittedRange | >, <, BETWEEN |
| permittedRangeInclusive | >=, <= |
PermittedRange allows open-ended ranges by using a null. For example if you want to find all Marques with a UID greater than 1 use:
marque.uidMarque.permittedRangeInclusive(1,null);
QDTs are an integral part of the DBvolution system and make query construction trivial. They also support sorting operation, transforms, and creating new entries in the database