Skip to content

SQL logging

xcesco edited this page Nov 30, 2017 · 1 revision

For default Kripton allows to monitor SQL operation simply reading logcat. An example of logcat during SQL execution.

AbstractDataSource, openWritableDatabase (line 442): database OPEN READ_AND_WRITE_OPENED (connections: 0)
CityDaoImpl, insert (line 139): INSERT INTO city (name) VALUES (:name)
CityDaoImpl, insert (line 148): ==> :name = 'Venezia' (java.lang.String)
PersonDaoImpl, insert (line 161): INSERT INTO person (city_id, name, surname) VALUES (:city_id, :name, :surname)
PersonDaoImpl, insert (line 170): ==> :city_id = '15' (java.lang.Long)
PersonDaoImpl, insert (line 170): ==> :name = 'Tony' (java.lang.String)
PersonDaoImpl, insert (line 170): ==> :surname = 'Manero' (java.lang.String)
PersonDaoImpl, listForCity (line 69): select person.* from person inner join city on city.id=person.city_id where person.city_id=?
PersonDaoImpl, listForCity (line 74): ==> param0: '15'
PersonDaoImpl, listForCity (line 82): Rows found: 1
AbstractDataSource, close (line 221): database CLOSED (READ_AND_WRITE_OPENED) (connections: 0)

Usually you can see on logcat:

  • database open and close
  • SQL operation
  • SQL arguments
  • DDL execution

How to enable/disable log generation

Log boilerplate-code is generate by Kripton. Generation is controlled by @BindDataSource#log attribute (true for log generation, false to avoid code generation).

Table of Contents

Query definition

Features

Relations

Multithread supports

Modularization

Annotations for data convertion

Annotations for SQLite ORM

Annotations for shared preferences

Clone this wiki locally