Skip to content
This repository has been archived by the owner on Nov 12, 2017. It is now read-only.
jwachter edited this page Sep 14, 2010 · 1 revision

Code Sample

val db = Db4o.openFile(…)

// Run InitDB Application to create and fill the database.

// Use Native Queries

db filter((p:Person)=>p.firstName.equals(“Bart”))

// Use Native Queries with Comparators

db filter((p:Person)=>p.firstName.equals(“Bart”), (p1:Person, p2:Person)=> … ) // Needs to return Int [-1, 0, 1]

// Use SQL Style SODA Queries

db select Person.getClass where(’firstName := “Bart”) execute // Returns a ObjectSet[T]

Constraints

’fieldName := “value” // Equals
’fieldName !:= “value” // Not Equals
’fieldName | “value” // Starts With
’fieldName |
“value” // Ends With
’fieldName ~ “value” // Like

’fieldName := 2 // Is
’fieldName !:= 2 // Is not
’fieldName > 2 // Greater
’fieldName < 2 // Smaller
’fieldName >= 2 // Greater or Is
’fieldName <= 2 // Smaller or Is

Clone this wiki locally