i use active android in project. trying learn more it, especial table items properties -smth foreignkeyaction.
i want model delete itself, if delete action occured, , not delete it's children. code found -
@column(name = "category", onupdate = foreignkeyaction.cascade, ondelete = foreignkeyaction.cascade) public category category; but not know flag answeirs property - there plenty of them - form docs
public enum foreignkeyaction { set_null, set_default, cascade, restrict, no_action } can post link detailed explanation, or explain stuff. ps explored lots of sites, inluding https://guides.codepath.com/android/activeandroid-guide , https://github.com/pardom/activeandroid/wiki/getting-started not refer me there, there no explanation on question.
also, other properties, ondelete can set model fields?
these aren't properties of active android, rather sql. i'm guessing active android utilizes sqlite database in android. if that's case, here meanings:
no action: configuring "no action" means that: when parent key modified or deleted database, no special action taken.
restrict: "restrict" action means application prohibited deleting (for on delete restrict) or modifying (for on update restrict) parent key when there exists 1 or more child keys mapped it. difference between effect of restrict action , normal foreign key constraint enforcement restrict action processing happens field updated - not @ end of current statement immediate constraint, or @ end of current transaction deferred constraint. if foreign key constraint attached deferred, configuring restrict action causes sqlite return error if parent key dependent child keys deleted or modified.
set null: if configured action "set null", when parent key deleted (for on delete set null) or modified (for on update set null), child key columns of rows in child table mapped parent key set contain sql null values.
set default: "set default" actions similar "set null", except each of child key columns set contain columns default value instead of null. refer create table documentation details on how default values assigned table columns.
cascade: "cascade" action propagates delete or update operation on parent key each dependent child key. "on delete cascade" action, means each row in child table associated deleted parent row deleted. "on update cascade" action, means values stored in each dependent child key modified match new parent key values.
in addition, here's link found information. can check out general sqlite documentation.
Comments
Post a Comment