A simple Person database:
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "litesql.dtd">
<database name="PersonDatabase">
<object name="Person">
<field name="name" type="string"/>
<field name="age" type="integer"/>
</object>
</database>
Following code demonstrates how to insert Persons to database:
PersonDatabase db("sqlite3", "database=person.db");
Person person(db);
person.name = "Bob";
person.age = 20;
person.update();
person.age = 21;
person.update();
person.id = 100;
person.update();
Note: if internal identifier (id-field) is changed, relations will not "follow" the object and will not be deleted either. If the object is not replaced with another object, relations should be manually dropped using delRelations-method.
Following code demonstrates how to delete Persons from database:
Person person = select<Person>(db).one();
person.del();