hk_delete.anubis 1 KB
/*
 * Created by PyramIDE.
 * User: フランスのトトロ aka (David RENÉ) 
 * Date: 19/03/2016
 * Time: 19:25
 * © Calexium 
 */

read calexium_lib/web/CXM_common.anubis
read calexium_lib/web/CXM_web_arg_utils.anubis
//TODO move to hayamiki lib as view part of MVC
read calexium_lib/database/vtm/view_table_manager.anubis 

public define Result(String, String)
  hk_delete_row
  (
    List(Web_arg)   lwa,
    TM_delete_list  d_list,  //list of all delete row function for database
    SQLite3DataBase db
  )=  
  if get_String(lwa, "table_name")      is  {failure then error("CANT_GET_ARGUMENT"), success(table_name)       then
  if get_Int(lwa,    "id")              is  {failure then error("CANT_GET_ARGUMENT"), success(id)               then
  if tm_get_delete(table_name, d_list)  is  {failure then error("DELETE_FUNC_DOESNT_EXIST"), success(hk_delete) then
  if hk_delete(db, [id])                is  {failure then error("DELETE_ROW_DB_ERROR"), success(_)              then
    ok("DELETE_ROW_OK")
  }}}}.