File: n_svc_dw_in_database.sru
Size: 1169
Date: Mon, 07 Apr 2008 21:31:08 +0200
$PBExportHeader$n_svc_dw_in_database.sru
forward
global type n_svc_dw_in_database from n_svc_base
end type
end forward

global type n_svc_dw_in_database from n_svc_base
end type
global n_svc_dw_in_database n_svc_dw_in_database

forward prototypes
public function boolean of_createfromdatabase (readonly powerobject apo, readonly string as_dwname, readonly transaction atr)
end prototypes

public function boolean of_createfromdatabase (readonly powerobject apo, readonly string as_dwname, readonly transaction atr);//only datastores, dws allowed
CHOOSE CASE apo.TypeOf()
   CASE Datawindow!, Datastore!
   CASE ELSE
      RETURN FALSE
END CHOOSE

IF NOT ISVALID(atr) THEN RETURN FALSE

string ls_syntax, ls_err

SELECT DatawindowSyntax
INTO :ls_syntax
FROM BAXDatawindow
WHERE DatawindowName = :as_dwname
USING atr;

CHOOSE CASE atr.SQLCode
   CASE 100, -1
      RETURN FALSE
END CHOOSE

//try to create
IF apo.DYNAMIC Create(ls_syntax, ls_err) = CRet.FAILURE THEN
   RETURN FALSE
END IF

RETURN TRUE
end function

on n_svc_dw_in_database.create
call super::create
end on

on n_svc_dw_in_database.destroy
call super::destroy
end on