virtual class slanRecord::Context

sys::Obj
  slanRecord::Context

session and manager

checkTable

Bool checkTable(Type table)

check the object table is fit to database table

checkTableT

Bool checkTableT(TableDef table)

check the object table is fit to database table

close

Void close()

conn

SqlConn? conn

Get the connection to this database for the current thread.

count

virtual Int count(Obj obj)

count by example

createTable

Void createTable(Type table)

createTableT

Void createTableT(TableDef table)

deleteByExample

virtual Void deleteByExample(Obj obj)

delete by example

deleteById

virtual Void deleteById(Type table, Obj id)

delete by id

deleteByIdT

virtual Void deleteByIdT(TableDef table, Obj id)

dropTable

Void dropTable(Type table)

dropTableT

Void dropTableT(TableDef table)

execute

Int execute(Str sql, List<Obj>? params)

execute raw sql

exist

Bool exist(Obj obj)

exist by example, this operate noCache

findById

virtual Obj? findById(Type type, Obj id)

findByIdT

virtual Obj? findByIdT(TableDef table, Obj id)

getTable

TableDef getTable(Obj obj)

insert

virtual Void insert(Obj obj)

insert this obj to database

list

List<Obj> list(Obj obj, Str orderby := "", Int offset := 0, Int limit := 50)

select by example

make

new make(SqlConn conn)

constructor

one

Obj? one(Obj obj, Str orderby := "", Int offset := 0)

select by example and get the first one

query

List<Obj> query(Str sql, List<Obj>? params, Type? type := null, Int offset := 0, Int limit := 50)

query by raw sql

queryT

List<Obj> queryT(Str sql, List<Obj>? params, TableDef? table := null, Int offset := 0, Int limit := 50)

save

Void save(Obj obj)

update or insert

select

List<Obj> select(Type type, Str where, Int offset := 0, Int limit := 50)

query by condition

selectT

List<Obj> selectT(TableDef table, Str where, Int offset := 0, Int limit := 50)

tableExists

Bool tableExists(Type table)

tableExistsT

Bool tableExistsT(TableDef table)

toTable

TableDef toTable(Type t)

trans

virtual Void trans(Func<Void,This> f)

transaction , if error will auto roolback

updateByCondition

virtual Void updateByCondition(Obj obj, Str condition)

updateByExample

virtual Void updateByExample(Obj obj, Obj where)

updateById

virtual Void updateById(Obj obj)

update by id