Database manipulation
We can manipulate data through database paths. The following piece of code declares a testdb
database and defines several paths:
type Student = {int id, string name, int age}
database testdb {
int /basic/i //Basic type int
float /basic/f //Basic type float
string /basic/s //Basic type string
Student /stu //Record
list(string) /lst //List
intmap(Student) /stumap //Map
Student /stuset[{id}] //Set
}
Type student that we defined ourselves. In addition to this type, our example covers the datatypes that are most frequently used in databases.
Each database path has a default value. Whenever we attempt to read a value that does not exist (either because it was never initialized or it has been removed), the default value is returned. The following list shows the default values for different types:
The default value for an integer (int) is 0
The default...