2170 lines
101 KiB
Plaintext
2170 lines
101 KiB
Plaintext
#+ DB schema - Constraints Management (mydatabase)
|
|
|
|
--------------------------------------------------------------------------------
|
|
--This code is generated with the template dbapp5.0
|
|
--Warning: Enter your changes within a <BLOCK> or <POINT> section, otherwise they will be lost.
|
|
{<POINT Name="user.comments">} {</POINT>}
|
|
|
|
--------------------------------------------------------------------------------
|
|
--Importing modules
|
|
IMPORT FGL libdbappCore
|
|
|
|
IMPORT FGL mydatabase
|
|
IMPORT FGL mydatabase_events
|
|
{<POINT Name="import">} {</POINT>}
|
|
|
|
--------------------------------------------------------------------------------
|
|
--Database schema
|
|
SCHEMA mydatabase
|
|
|
|
--------------------------------------------------------------------------------
|
|
--Functions
|
|
|
|
{<BLOCK Name="fct.transportistas_checkTableConstraints">}
|
|
#+ Check constraints on the "transportistas" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE transportistas.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transportistas_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE transportistas.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.transportistas_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transportistas_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_transportistas_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_transportistas_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.transportistas_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transportistas_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_checkTableConstraints">}
|
|
#+ Check constraints on the "transacciones_master" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE transacciones_master.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE transacciones_master.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.transacciones_master_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_transacciones_master_num_doc_checkColumnConstraints(p_data.num_doc) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_cod_mov_checkColumnConstraints(p_data.cod_mov) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_num_oc_checkColumnConstraints(p_data.num_oc) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_orden_compra_checkColumnConstraints(p_data.orden_compra) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_conduce_no_checkColumnConstraints(p_data.conduce_no) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_cod_sp_checkColumnConstraints(p_data.cod_sp) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_cod_sp_Sec_checkColumnConstraints(p_data.cod_sp_Sec) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_num_req_checkColumnConstraints(p_data.num_req) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_sec_vend_checkColumnConstraints(p_data.sec_vend) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_bodega_checkColumnConstraints(p_data.bodega) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_transacciones_master_bodega_d_checkColumnConstraints(p_data.bodega_d) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_transacciones_master_PK_transacciones_master_1_checkUniqueConstraint(p_forUpdate, p_data.num_doc, p_data.cod_mov, p_data.bodega) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_transacciones_master_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.transacciones_master_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "transacciones_master"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_PK_transacciones_master_1_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
transacciones_master_num_doc LIKE transacciones_master.num_doc,
|
|
transacciones_master_cod_mov LIKE transacciones_master.cod_mov,
|
|
transacciones_master_bodega LIKE transacciones_master.bodega
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
transacciones_master_num_doc LIKE transacciones_master.num_doc,
|
|
transacciones_master_cod_mov LIKE transacciones_master.cod_mov,
|
|
transacciones_master_bodega LIKE transacciones_master.bodega
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_where_num_doc STRING
|
|
DEFINE l_where_cod_mov STRING
|
|
DEFINE l_where_bodega STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where_num_doc = IIF(p_key.transacciones_master_num_doc IS NULL, " OR transacciones_master.num_doc IS NULL", "")
|
|
LET l_where_cod_mov = IIF(p_key.transacciones_master_cod_mov IS NULL, " OR transacciones_master.cod_mov IS NULL", "")
|
|
LET l_where_bodega = IIF(p_key.transacciones_master_bodega IS NULL, " OR transacciones_master.bodega IS NULL", "")
|
|
LET l_where = "WHERE ( transacciones_master.num_doc = ?", l_where_num_doc, " )",
|
|
" AND ( transacciones_master.cod_mov = ?", l_where_cod_mov, " )",
|
|
" AND ( transacciones_master.bodega = ?", l_where_bodega, " ) "
|
|
LET l_sqlQuery = "SELECT COUNT(*), num_doc, cod_mov, bodega FROM transacciones_master ", l_where, " GROUP BY num_doc, cod_mov, bodega"
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_transacciones_master_PK_transacciones_master_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_transacciones_master_PK_transacciones_master_1_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_transacciones_master_PK_transacciones_master_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- num_doc + cod_mov + bodega: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.transacciones_master_num_doc_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.num_doc" column
|
|
#+
|
|
#+ @param p_num_doc - INTEGER - num_doc
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_num_doc_checkColumnConstraints(p_num_doc)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_num_doc LIKE transacciones_master.num_doc
|
|
{<POINT Name="fct.transacciones_master_num_doc_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_num_doc_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_num_doc IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- num_doc: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_num_doc_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_num_doc_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_cod_mov_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.cod_mov" column
|
|
#+
|
|
#+ @param p_cod_mov - SMALLINT - cod_mov
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_cod_mov_checkColumnConstraints(p_cod_mov)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_mov LIKE transacciones_master.cod_mov
|
|
{<POINT Name="fct.transacciones_master_cod_mov_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_cod_mov_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_mov IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_mov: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_cod_mov_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_cod_mov_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_num_oc_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.num_oc" column
|
|
#+
|
|
#+ @param p_num_oc - INTEGER - num_oc
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_num_oc_checkColumnConstraints(p_num_oc)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_num_oc LIKE transacciones_master.num_oc
|
|
{<POINT Name="fct.transacciones_master_num_oc_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_num_oc_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_num_oc IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- num_oc: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_num_oc_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_num_oc_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_orden_compra_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.orden_compra" column
|
|
#+
|
|
#+ @param p_orden_compra - INTEGER - orden_compra
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_orden_compra_checkColumnConstraints(p_orden_compra)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_orden_compra LIKE transacciones_master.orden_compra
|
|
{<POINT Name="fct.transacciones_master_orden_compra_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_orden_compra_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_orden_compra IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- orden_compra: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_orden_compra_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_orden_compra_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_conduce_no_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.conduce_no" column
|
|
#+
|
|
#+ @param p_conduce_no - CHAR(25) - conduce_no
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_conduce_no_checkColumnConstraints(p_conduce_no)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_conduce_no LIKE transacciones_master.conduce_no
|
|
{<POINT Name="fct.transacciones_master_conduce_no_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_conduce_no_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_conduce_no IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- conduce_no: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_conduce_no_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_conduce_no_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_cod_sp_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.cod_sp" column
|
|
#+
|
|
#+ @param p_cod_sp - SMALLINT - cod_sp
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_cod_sp_checkColumnConstraints(p_cod_sp)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_sp LIKE transacciones_master.cod_sp
|
|
{<POINT Name="fct.transacciones_master_cod_sp_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_cod_sp_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_sp IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_sp: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_cod_sp_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_cod_sp_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_cod_sp_Sec_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.cod_sp_Sec" column
|
|
#+
|
|
#+ @param p_cod_sp_Sec - INTEGER - cod_sp_Sec
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_cod_sp_Sec_checkColumnConstraints(p_cod_sp_Sec)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_sp_Sec LIKE transacciones_master.cod_sp_Sec
|
|
{<POINT Name="fct.transacciones_master_cod_sp_Sec_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_cod_sp_Sec_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_sp_Sec IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_sp_Sec: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_cod_sp_Sec_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_cod_sp_Sec_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_num_req_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.num_req" column
|
|
#+
|
|
#+ @param p_num_req - INTEGER - num_req
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_num_req_checkColumnConstraints(p_num_req)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_num_req LIKE transacciones_master.num_req
|
|
{<POINT Name="fct.transacciones_master_num_req_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_num_req_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_num_req IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- num_req: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_num_req_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_num_req_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_sec_vend_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.sec_vend" column
|
|
#+
|
|
#+ @param p_sec_vend - SMALLINT - sec_vend
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_sec_vend_checkColumnConstraints(p_sec_vend)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_sec_vend LIKE transacciones_master.sec_vend
|
|
{<POINT Name="fct.transacciones_master_sec_vend_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_sec_vend_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_sec_vend IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sec_vend: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_sec_vend_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_sec_vend_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_bodega_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.bodega" column
|
|
#+
|
|
#+ @param p_bodega - SMALLINT - bodega
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_bodega_checkColumnConstraints(p_bodega)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_bodega LIKE transacciones_master.bodega
|
|
{<POINT Name="fct.transacciones_master_bodega_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_bodega_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_bodega IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- bodega: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_bodega_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_bodega_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_bodega_d_checkColumnConstraints">}
|
|
#+ Check constraints on the "transacciones_master.bodega_d" column
|
|
#+
|
|
#+ @param p_bodega_d - SMALLINT - bodega_d
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_bodega_d_checkColumnConstraints(p_bodega_d)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_bodega_d LIKE transacciones_master.bodega_d
|
|
{<POINT Name="fct.transacciones_master_bodega_d_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.transacciones_master_bodega_d_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_bodega_d IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- bodega_d: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_bodega_d_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_bodega_d_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "transacciones_master"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_transacciones_master_PK_transacciones_master_1_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
transacciones_master_num_doc LIKE transacciones_master.num_doc,
|
|
transacciones_master_cod_mov LIKE transacciones_master.cod_mov,
|
|
transacciones_master_bodega LIKE transacciones_master.bodega
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_where_num_doc STRING
|
|
DEFINE l_where_cod_mov STRING
|
|
DEFINE l_where_bodega STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.transacciones_master_num_doc IS NULL AND p_data.transacciones_master_cod_mov IS NULL AND p_data.transacciones_master_bodega IS NULL) THEN
|
|
LET l_where_num_doc = IIF(p_data.transacciones_master_num_doc IS NULL, " OR transacciones_master.num_doc IS NULL", "")
|
|
LET l_where_cod_mov = IIF(p_data.transacciones_master_cod_mov IS NULL, " OR transacciones_master.cod_mov IS NULL", "")
|
|
LET l_where_bodega = IIF(p_data.transacciones_master_bodega IS NULL, " OR transacciones_master.bodega IS NULL", "")
|
|
LET l_where = "WHERE ( transacciones_master.num_doc = ?", l_where_num_doc, " )",
|
|
" AND ( transacciones_master.cod_mov = ?", l_where_cod_mov, " )",
|
|
" AND ( transacciones_master.bodega = ?", l_where_bodega, " ) "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM transacciones_master ", l_where
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_transacciones_master_PK_transacciones_master_1_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_transacciones_master_PK_transacciones_master_1_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_transacciones_master_PK_transacciones_master_1_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- num_doc + cod_mov + bodega: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.tramo_checkTableConstraints">}
|
|
#+ Check constraints on the "tramo" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE tramo.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_tramo_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE tramo.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.tramo_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.tramo_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_tramo_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_tramo_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.tramo_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.tramo_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.seqreg_checkTableConstraints">}
|
|
#+ Check constraints on the "seqreg" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE seqreg.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE seqreg.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.seqreg_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seqreg_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_seqreg_sr_name_checkColumnConstraints(p_data.sr_name) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_seqreg_sr_last_checkColumnConstraints(p_data.sr_last) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_seqreg_pk_seqreg_checkUniqueConstraint(p_forUpdate, p_data.sr_name) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_seqreg_IDX_seqreg_1_checkUniqueConstraint(p_forUpdate, p_data.sr_last, p_data.sr_name) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_seqreg_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_seqreg_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.seqreg_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.seqreg_pk_seqreg_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "seqreg"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_pk_seqreg_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
seqreg_sr_name LIKE seqreg.sr_name
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
seqreg_sr_name LIKE seqreg.sr_name
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE seqreg.sr_name = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), sr_name FROM seqreg ", l_where, " GROUP BY sr_name"
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_seqreg_pk_seqreg_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_seqreg_pk_seqreg_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_seqreg_pk_seqreg_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sr_name: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_pk_seqreg_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.seqreg_IDX_seqreg_1_checkUniqueConstraint">}
|
|
#+ Check the index uniqueness constraint on the "seqreg"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - Unique Index
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_IDX_seqreg_1_checkUniqueConstraint(p_forUpdate, p_data, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data
|
|
RECORD
|
|
seqreg_sr_last LIKE seqreg.sr_last
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
seqreg_sr_name LIKE seqreg.sr_name
|
|
END RECORD
|
|
DEFINE p_key
|
|
RECORD
|
|
seqreg_sr_name LIKE seqreg.sr_name
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.seqreg_IDX_seqreg_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE seqreg.sr_last = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), sr_name FROM seqreg ", l_where, " GROUP BY sr_name"
|
|
{<POINT Name="fct.seqreg_IDX_seqreg_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_seqreg_IDX_seqreg_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_seqreg_IDX_seqreg_1_checkUniqueConstraint USING p_data.* INTO l_count, l_key.*
|
|
FREE cur_seqreg_IDX_seqreg_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sr_last: " || ERROR_BAM_00003) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.seqreg_IDX_seqreg_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_IDX_seqreg_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.seqreg_sr_name_checkColumnConstraints">}
|
|
#+ Check constraints on the "seqreg.sr_name" column
|
|
#+
|
|
#+ @param p_sr_name - VARCHAR(30) - sr_name
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_sr_name_checkColumnConstraints(p_sr_name)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_sr_name LIKE seqreg.sr_name
|
|
{<POINT Name="fct.seqreg_sr_name_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seqreg_sr_name_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_sr_name IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sr_name: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.seqreg_sr_name_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_sr_name_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.seqreg_sr_last_checkColumnConstraints">}
|
|
#+ Check constraints on the "seqreg.sr_last" column
|
|
#+
|
|
#+ @param p_sr_last - INTEGER - sr_last
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_sr_last_checkColumnConstraints(p_sr_last)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_sr_last LIKE seqreg.sr_last
|
|
{<POINT Name="fct.seqreg_sr_last_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seqreg_sr_last_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_sr_last IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sr_last: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.seqreg_sr_last_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_sr_last_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.seqreg_pk_seqreg_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "seqreg"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seqreg_pk_seqreg_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
seqreg_sr_name LIKE seqreg.sr_name
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.seqreg_sr_name IS NULL) THEN
|
|
LET l_where = "WHERE seqreg.sr_name = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM seqreg ", l_where
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_seqreg_pk_seqreg_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_seqreg_pk_seqreg_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_seqreg_pk_seqreg_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- sr_name: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.seqreg_pk_seqreg_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seqreg_pk_seqreg_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.seg000_checkTableConstraints">}
|
|
#+ Check constraints on the "seg000" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE seg000.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seg000_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE seg000.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.seg000_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seg000_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_seg000_usuario_checkColumnConstraints(p_data.usuario) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_seg000_IDX_seg000_1_checkUniqueConstraint(p_forUpdate, p_data.usuario) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_seg000_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_seg000_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.seg000_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seg000_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.seg000_IDX_seg000_1_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "seg000"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seg000_IDX_seg000_1_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
seg000_usuario LIKE seg000.usuario
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
seg000_usuario LIKE seg000.usuario
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE seg000.usuario = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), usuario FROM seg000 ", l_where, " GROUP BY usuario"
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_seg000_IDX_seg000_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_seg000_IDX_seg000_1_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_seg000_IDX_seg000_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- usuario: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seg000_IDX_seg000_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.seg000_usuario_checkColumnConstraints">}
|
|
#+ Check constraints on the "seg000.usuario" column
|
|
#+
|
|
#+ @param p_usuario - CHAR(50) - usuario
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seg000_usuario_checkColumnConstraints(p_usuario)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_usuario LIKE seg000.usuario
|
|
{<POINT Name="fct.seg000_usuario_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seg000_usuario_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_usuario IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- usuario: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.seg000_usuario_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seg000_usuario_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.seg000_IDX_seg000_1_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "seg000"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seg000_IDX_seg000_1_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
seg000_usuario LIKE seg000.usuario
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.seg000_usuario IS NULL) THEN
|
|
LET l_where = "WHERE seg000.usuario = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM seg000 ", l_where
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_seg000_IDX_seg000_1_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_seg000_IDX_seg000_1_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_seg000_IDX_seg000_1_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- usuario: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.seg000_IDX_seg000_1_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seg000_IDX_seg000_1_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.seccion_checkTableConstraints">}
|
|
#+ Check constraints on the "seccion" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE seccion.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_seccion_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE seccion.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.seccion_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.seccion_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_seccion_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_seccion_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.seccion_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.seccion_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.productos_checkTableConstraints">}
|
|
#+ Check constraints on the "productos" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE productos.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE productos.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.productos_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_productos_cod_n_checkColumnConstraints(p_data.cod_n) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_productos_cod_grupo_checkColumnConstraints(p_data.cod_grupo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_productos_cod_tipo_checkColumnConstraints(p_data.cod_tipo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_productos_cod_sec_checkColumnConstraints(p_data.cod_sec) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_productos_descrip_esp_checkColumnConstraints(p_data.descrip_esp) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_productos_unidad_med_checkColumnConstraints(p_data.unidad_med) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_productos_IDX_productos_1_checkUniqueConstraint(p_forUpdate, p_data.cod_grupo, p_data.cod_n, p_data.cod_sec, p_data.cod_tipo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_productos_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_productos_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.productos_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.productos_IDX_productos_1_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "productos"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_IDX_productos_1_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
productos_cod_grupo LIKE productos.cod_grupo,
|
|
productos_cod_n LIKE productos.cod_n,
|
|
productos_cod_sec LIKE productos.cod_sec,
|
|
productos_cod_tipo LIKE productos.cod_tipo
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
productos_cod_grupo LIKE productos.cod_grupo,
|
|
productos_cod_n LIKE productos.cod_n,
|
|
productos_cod_sec LIKE productos.cod_sec,
|
|
productos_cod_tipo LIKE productos.cod_tipo
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE productos.cod_grupo = ?",
|
|
" AND productos.cod_n = ?",
|
|
" AND productos.cod_sec = ?",
|
|
" AND productos.cod_tipo = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), cod_grupo, cod_n, cod_sec, cod_tipo FROM productos ", l_where, " GROUP BY cod_grupo, cod_n, cod_sec, cod_tipo"
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_productos_IDX_productos_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_productos_IDX_productos_1_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_productos_IDX_productos_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo + cod_n + cod_sec + cod_tipo: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_IDX_productos_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.productos_cod_n_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.cod_n" column
|
|
#+
|
|
#+ @param p_cod_n - SMALLINT - cod_n
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_cod_n_checkColumnConstraints(p_cod_n)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_n LIKE productos.cod_n
|
|
{<POINT Name="fct.productos_cod_n_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_cod_n_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_n IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_n: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_cod_n_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_cod_n_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_cod_grupo_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.cod_grupo" column
|
|
#+
|
|
#+ @param p_cod_grupo - SMALLINT - cod_grupo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_cod_grupo_checkColumnConstraints(p_cod_grupo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_grupo LIKE productos.cod_grupo
|
|
{<POINT Name="fct.productos_cod_grupo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_cod_grupo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_grupo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_cod_grupo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_cod_grupo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_cod_tipo_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.cod_tipo" column
|
|
#+
|
|
#+ @param p_cod_tipo - SMALLINT - cod_tipo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_cod_tipo_checkColumnConstraints(p_cod_tipo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_tipo LIKE productos.cod_tipo
|
|
{<POINT Name="fct.productos_cod_tipo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_cod_tipo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_tipo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_tipo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_cod_tipo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_cod_tipo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_cod_sec_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.cod_sec" column
|
|
#+
|
|
#+ @param p_cod_sec - SMALLINT - cod_sec
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_cod_sec_checkColumnConstraints(p_cod_sec)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_sec LIKE productos.cod_sec
|
|
{<POINT Name="fct.productos_cod_sec_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_cod_sec_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_sec IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_sec: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_cod_sec_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_cod_sec_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_descrip_esp_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.descrip_esp" column
|
|
#+
|
|
#+ @param p_descrip_esp - CHAR(100) - descrip_esp
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_descrip_esp_checkColumnConstraints(p_descrip_esp)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_descrip_esp LIKE productos.descrip_esp
|
|
{<POINT Name="fct.productos_descrip_esp_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_descrip_esp_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_descrip_esp IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- descrip_esp: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_descrip_esp_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_descrip_esp_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_unidad_med_checkColumnConstraints">}
|
|
#+ Check constraints on the "productos.unidad_med" column
|
|
#+
|
|
#+ @param p_unidad_med - CHAR(4) - unidad_med
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_unidad_med_checkColumnConstraints(p_unidad_med)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_unidad_med LIKE productos.unidad_med
|
|
{<POINT Name="fct.productos_unidad_med_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.productos_unidad_med_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_unidad_med IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- unidad_med: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.productos_unidad_med_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_unidad_med_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.productos_IDX_productos_1_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "productos"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_productos_IDX_productos_1_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
productos_cod_grupo LIKE productos.cod_grupo,
|
|
productos_cod_n LIKE productos.cod_n,
|
|
productos_cod_sec LIKE productos.cod_sec,
|
|
productos_cod_tipo LIKE productos.cod_tipo
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.productos_cod_grupo IS NULL AND p_data.productos_cod_n IS NULL AND p_data.productos_cod_sec IS NULL AND p_data.productos_cod_tipo IS NULL) THEN
|
|
LET l_where = "WHERE productos.cod_grupo = ?",
|
|
" AND productos.cod_n = ?",
|
|
" AND productos.cod_sec = ?",
|
|
" AND productos.cod_tipo = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM productos ", l_where
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_productos_IDX_productos_1_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_productos_IDX_productos_1_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_productos_IDX_productos_1_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo + cod_n + cod_sec + cod_tipo: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.productos_IDX_productos_1_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.productos_IDX_productos_1_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.irtb00012_checkTableConstraints">}
|
|
#+ Check constraints on the "irtb00012" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE irtb00012.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_irtb00012_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE irtb00012.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.irtb00012_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.irtb00012_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_irtb00012_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_irtb00012_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.irtb00012_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.irtb00012_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00012_checkTableConstraints">}
|
|
#+ Check constraints on the "iptb00012" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE iptb00012.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00012_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE iptb00012.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.iptb00012_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00012_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_iptb00012_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_iptb00012_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.iptb00012_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00012_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_checkTableConstraints">}
|
|
#+ Check constraints on the "iptb00011" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE iptb00011.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE iptb00011.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.iptb00011_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_iptb00011_fecha_checkColumnConstraints(p_data.fecha) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_bodega_checkColumnConstraints(p_data.bodega) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_seccion_checkColumnConstraints(p_data.cod_seccion) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_tramo_checkColumnConstraints(p_data.cod_tramo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_n_checkColumnConstraints(p_data.cod_n) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_grupo_checkColumnConstraints(p_data.cod_grupo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_tipo_checkColumnConstraints(p_data.cod_tipo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cod_sec_checkColumnConstraints(p_data.cod_sec) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_iptb00011_cantidad_checkColumnConstraints(p_data.cantidad) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_iptb00011_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_iptb00011_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.iptb00011_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_fecha_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.fecha" column
|
|
#+
|
|
#+ @param p_fecha - DATE - fecha
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_fecha_checkColumnConstraints(p_fecha)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_fecha LIKE iptb00011.fecha
|
|
{<POINT Name="fct.iptb00011_fecha_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_fecha_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_fecha IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- fecha: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_fecha_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_fecha_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_bodega_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.bodega" column
|
|
#+
|
|
#+ @param p_bodega - SMALLINT - bodega
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_bodega_checkColumnConstraints(p_bodega)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_bodega LIKE iptb00011.bodega
|
|
{<POINT Name="fct.iptb00011_bodega_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_bodega_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_bodega IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- bodega: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_bodega_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_bodega_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_seccion_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_seccion" column
|
|
#+
|
|
#+ @param p_cod_seccion - SMALLINT - cod_seccion
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_seccion_checkColumnConstraints(p_cod_seccion)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_seccion LIKE iptb00011.cod_seccion
|
|
{<POINT Name="fct.iptb00011_cod_seccion_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_seccion_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_seccion IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_seccion: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_seccion_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_seccion_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_tramo_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_tramo" column
|
|
#+
|
|
#+ @param p_cod_tramo - SMALLINT - cod_tramo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_tramo_checkColumnConstraints(p_cod_tramo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_tramo LIKE iptb00011.cod_tramo
|
|
{<POINT Name="fct.iptb00011_cod_tramo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_tramo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_tramo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_tramo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_tramo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_tramo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_n_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_n" column
|
|
#+
|
|
#+ @param p_cod_n - SMALLINT - cod_n
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_n_checkColumnConstraints(p_cod_n)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_n LIKE iptb00011.cod_n
|
|
{<POINT Name="fct.iptb00011_cod_n_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_n_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_n IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_n: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_n_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_n_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_grupo_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_grupo" column
|
|
#+
|
|
#+ @param p_cod_grupo - SMALLINT - cod_grupo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_grupo_checkColumnConstraints(p_cod_grupo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_grupo LIKE iptb00011.cod_grupo
|
|
{<POINT Name="fct.iptb00011_cod_grupo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_grupo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_grupo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_grupo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_grupo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_tipo_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_tipo" column
|
|
#+
|
|
#+ @param p_cod_tipo - SMALLINT - cod_tipo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_tipo_checkColumnConstraints(p_cod_tipo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_tipo LIKE iptb00011.cod_tipo
|
|
{<POINT Name="fct.iptb00011_cod_tipo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_tipo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_tipo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_tipo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_tipo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_tipo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cod_sec_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cod_sec" column
|
|
#+
|
|
#+ @param p_cod_sec - SMALLINT - cod_sec
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cod_sec_checkColumnConstraints(p_cod_sec)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_sec LIKE iptb00011.cod_sec
|
|
{<POINT Name="fct.iptb00011_cod_sec_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cod_sec_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_sec IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_sec: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cod_sec_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cod_sec_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.iptb00011_cantidad_checkColumnConstraints">}
|
|
#+ Check constraints on the "iptb00011.cantidad" column
|
|
#+
|
|
#+ @param p_cantidad - DECIMAL(10,2) - cantidad
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_iptb00011_cantidad_checkColumnConstraints(p_cantidad)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cantidad LIKE iptb00011.cantidad
|
|
{<POINT Name="fct.iptb00011_cantidad_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.iptb00011_cantidad_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cantidad IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cantidad: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.iptb00011_cantidad_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.iptb00011_cantidad_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.intb00012_checkTableConstraints">}
|
|
#+ Check constraints on the "intb00012" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE intb00012.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_intb00012_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE intb00012.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.intb00012_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.intb00012_checkTableConstraints.init">} {</POINT>}
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_intb00012_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_intb00012_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.intb00012_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.intb00012_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.grupo_producto_checkTableConstraints">}
|
|
#+ Check constraints on the "grupo_producto" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE grupo_producto.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_grupo_producto_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE grupo_producto.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.grupo_producto_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.grupo_producto_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_grupo_producto_cod_grupo_checkColumnConstraints(p_data.cod_grupo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_grupo_producto_descripcion_checkColumnConstraints(p_data.descripcion) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint(p_forUpdate, p_data.cod_grupo) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_grupo_producto_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.grupo_producto_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.grupo_producto_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "grupo_producto"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE grupo_producto.cod_grupo = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), cod_grupo FROM grupo_producto ", l_where, " GROUP BY cod_grupo"
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.grupo_producto_cod_grupo_checkColumnConstraints">}
|
|
#+ Check constraints on the "grupo_producto.cod_grupo" column
|
|
#+
|
|
#+ @param p_cod_grupo - SMALLINT - cod_grupo
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_grupo_producto_cod_grupo_checkColumnConstraints(p_cod_grupo)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_grupo LIKE grupo_producto.cod_grupo
|
|
{<POINT Name="fct.grupo_producto_cod_grupo_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.grupo_producto_cod_grupo_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_grupo IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.grupo_producto_cod_grupo_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.grupo_producto_cod_grupo_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.grupo_producto_descripcion_checkColumnConstraints">}
|
|
#+ Check constraints on the "grupo_producto.descripcion" column
|
|
#+
|
|
#+ @param p_descripcion - CHAR(50) - descripcion
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_grupo_producto_descripcion_checkColumnConstraints(p_descripcion)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_descripcion LIKE grupo_producto.descripcion
|
|
{<POINT Name="fct.grupo_producto_descripcion_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.grupo_producto_descripcion_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_descripcion IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- descripcion: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.grupo_producto_descripcion_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.grupo_producto_descripcion_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "grupo_producto"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_grupo_producto_IDX_grupo_producto_2_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.grupo_producto_cod_grupo IS NULL) THEN
|
|
LET l_where = "WHERE grupo_producto.cod_grupo = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM grupo_producto ", l_where
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_grupo_producto_IDX_grupo_producto_2_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_grupo_producto_IDX_grupo_producto_2_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_grupo_producto_IDX_grupo_producto_2_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_grupo: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.companias_checkTableConstraints">}
|
|
#+ Check constraints on the "companias" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE companias.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_companias_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE companias.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.companias_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.companias_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_companias_cod_cia_checkColumnConstraints(p_data.cod_cia) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_companias_IDX_companias_1_checkUniqueConstraint(p_forUpdate, p_data.cod_cia) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_companias_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_companias_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.companias_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.companias_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.companias_IDX_companias_1_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "companias"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_companias_IDX_companias_1_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
companias_cod_cia LIKE companias.cod_cia
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
companias_cod_cia LIKE companias.cod_cia
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE companias.cod_cia = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), cod_cia FROM companias ", l_where, " GROUP BY cod_cia"
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_companias_IDX_companias_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_companias_IDX_companias_1_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_companias_IDX_companias_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_cia: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.companias_IDX_companias_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.companias_cod_cia_checkColumnConstraints">}
|
|
#+ Check constraints on the "companias.cod_cia" column
|
|
#+
|
|
#+ @param p_cod_cia - SMALLINT - cod_cia
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_companias_cod_cia_checkColumnConstraints(p_cod_cia)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_cia LIKE companias.cod_cia
|
|
{<POINT Name="fct.companias_cod_cia_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.companias_cod_cia_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_cia IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_cia: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.companias_cod_cia_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.companias_cod_cia_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.companias_IDX_companias_1_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "companias"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_companias_IDX_companias_1_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
companias_cod_cia LIKE companias.cod_cia
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.companias_cod_cia IS NULL) THEN
|
|
LET l_where = "WHERE companias.cod_cia = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM companias ", l_where
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_companias_IDX_companias_1_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_companias_IDX_companias_1_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_companias_IDX_companias_1_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_cia: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.companias_IDX_companias_1_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.companias_IDX_companias_1_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.clase_productos_checkTableConstraints">}
|
|
#+ Check constraints on the "clase_productos" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE clase_productos.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_clase_productos_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE clase_productos.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.clase_productos_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.clase_productos_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_clase_productos_cod_n_checkColumnConstraints(p_data.cod_n) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_clase_productos_descripcion_checkColumnConstraints(p_data.descripcion) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
CALL mydatabase_dbxconstraints_clase_productos_IDX_clase_productos_1_checkUniqueConstraint(p_forUpdate, p_data.cod_n) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_clase_productos_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_clase_productos_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.clase_productos_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.clase_productos_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_checkUniqueConstraint">}
|
|
#+ Check the primary key uniqueness constraint on the "clase_productos"
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_key - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_clase_productos_IDX_clase_productos_1_checkUniqueConstraint(p_forUpdate, p_key)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_key
|
|
RECORD
|
|
clase_productos_cod_n LIKE clase_productos.cod_n
|
|
END RECORD
|
|
DEFINE l_key
|
|
RECORD
|
|
clase_productos_cod_n LIKE clase_productos.cod_n
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkUniqueConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
LET l_where = "WHERE clase_productos.cod_n = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*), cod_n FROM clase_productos ", l_where, " GROUP BY cod_n"
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkUniqueConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_clase_productos_IDX_clase_productos_1_checkUniqueConstraint FROM l_sqlQuery
|
|
EXECUTE cur_clase_productos_IDX_clase_productos_1_checkUniqueConstraint USING p_key.* INTO l_count, l_key.*
|
|
FREE cur_clase_productos_IDX_clase_productos_1_checkUniqueConstraint
|
|
IF (NOT p_forUpdate AND l_count > 0) OR (p_forUpdate AND l_count > 0 AND p_key.* != l_key.*) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_n: " || ERROR_BAM_00002) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkUniqueConstraint.user">} {</POINT>}
|
|
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_checkUniqueConstraint
|
|
|
|
{<BLOCK Name="fct.clase_productos_cod_n_checkColumnConstraints">}
|
|
#+ Check constraints on the "clase_productos.cod_n" column
|
|
#+
|
|
#+ @param p_cod_n - CHAR(1) - cod_n
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_clase_productos_cod_n_checkColumnConstraints(p_cod_n)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_n LIKE clase_productos.cod_n
|
|
{<POINT Name="fct.clase_productos_cod_n_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.clase_productos_cod_n_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_n IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_n: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.clase_productos_cod_n_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.clase_productos_cod_n_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.clase_productos_descripcion_checkColumnConstraints">}
|
|
#+ Check constraints on the "clase_productos.descripcion" column
|
|
#+
|
|
#+ @param p_descripcion - CHAR(50) - descripcion
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_clase_productos_descripcion_checkColumnConstraints(p_descripcion)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_descripcion LIKE clase_productos.descripcion
|
|
{<POINT Name="fct.clase_productos_descripcion_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.clase_productos_descripcion_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_descripcion IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- descripcion: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.clase_productos_descripcion_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.clase_productos_descripcion_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_checkFKConstraint">}
|
|
#+ Check the Foreign Key existence constraint on the "clase_productos"
|
|
#+
|
|
#+ @param p_data - Primary Key
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_clase_productos_IDX_clase_productos_1_checkFKConstraint(p_data)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_data
|
|
RECORD
|
|
clase_productos_cod_n LIKE clase_productos.cod_n
|
|
END RECORD
|
|
DEFINE l_where STRING
|
|
DEFINE l_sqlQuery STRING
|
|
DEFINE l_count INTEGER
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkFKConstraint.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
IF NOT (p_data.clase_productos_cod_n IS NULL) THEN
|
|
LET l_where = "WHERE clase_productos.cod_n = ? "
|
|
LET l_sqlQuery = "SELECT COUNT(*) FROM clase_productos ", l_where
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkFKConstraint.init">} {</POINT>}
|
|
TRY
|
|
PREPARE cur_clase_productos_IDX_clase_productos_1_checkFKConstraint FROM l_sqlQuery
|
|
EXECUTE cur_clase_productos_IDX_clase_productos_1_checkFKConstraint USING p_data.* INTO l_count
|
|
FREE cur_clase_productos_IDX_clase_productos_1_checkFKConstraint
|
|
IF (l_count == 0) THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_n: " || ERROR_BAM_00004) RETURNING errNo, errMsg
|
|
END IF
|
|
CATCH
|
|
LET errNo = ERROR_FAILURE
|
|
END TRY
|
|
END IF
|
|
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkFKConstraint.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_checkFKConstraint
|
|
|
|
{<BLOCK Name="fct.bodegas_checkTableConstraints">}
|
|
#+ Check constraints on the "bodegas" table
|
|
#+
|
|
#+ @param p_forUpdate TRUE: for 'update' SQL operation, FALSE for 'insert' SQL operation
|
|
#+ @param p_data - a row data LIKE bodegas.*
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_bodegas_checkTableConstraints(p_forUpdate, p_data)
|
|
DEFINE p_forUpdate BOOLEAN
|
|
DEFINE p_data RECORD LIKE bodegas.*
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE l_errNo INTEGER
|
|
DEFINE l_errMsg STRING
|
|
{<POINT Name="fct.bodegas_checkTableConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.bodegas_checkTableConstraints.init">} {</POINT>}
|
|
|
|
CALL mydatabase_dbxconstraints_bodegas_cod_bodega_checkColumnConstraints(p_data.cod_bodega) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
CALL mydatabase_dbxconstraints_bodegas_descripcion_checkColumnConstraints(p_data.descripcion) RETURNING l_errNo, l_errMsg
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
IF mydatabase_events.m_DbxDataEvent_bodegas_CheckTableConstraints IS NOT NULL THEN
|
|
CALL mydatabase_events.m_DbxDataEvent_bodegas_CheckTableConstraints(p_forUpdate, p_data.*)
|
|
RETURNING l_errNo, l_errMsg
|
|
END IF
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
|
|
|
|
{<POINT Name="fct.bodegas_checkTableConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.bodegas_checkTableConstraints
|
|
|
|
{<BLOCK Name="fct.bodegas_cod_bodega_checkColumnConstraints">}
|
|
#+ Check constraints on the "bodegas.cod_bodega" column
|
|
#+
|
|
#+ @param p_cod_bodega - SMALLINT - cod_bodega
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_bodegas_cod_bodega_checkColumnConstraints(p_cod_bodega)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_cod_bodega LIKE bodegas.cod_bodega
|
|
{<POINT Name="fct.bodegas_cod_bodega_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.bodegas_cod_bodega_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_cod_bodega IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- cod_bodega: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.bodegas_cod_bodega_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.bodegas_cod_bodega_checkColumnConstraints
|
|
|
|
{<BLOCK Name="fct.bodegas_descripcion_checkColumnConstraints">}
|
|
#+ Check constraints on the "bodegas.descripcion" column
|
|
#+
|
|
#+ @param p_descripcion - CHAR(50) - descripcion
|
|
#+
|
|
#+ @returnType INTEGER, STRING
|
|
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message
|
|
PUBLIC FUNCTION mydatabase_dbxconstraints_bodegas_descripcion_checkColumnConstraints(p_descripcion)
|
|
DEFINE errNo INTEGER
|
|
DEFINE errMsg STRING
|
|
DEFINE p_descripcion LIKE bodegas.descripcion
|
|
{<POINT Name="fct.bodegas_descripcion_checkColumnConstraints.define">} {</POINT>}
|
|
|
|
LET errNo = ERROR_SUCCESS
|
|
INITIALIZE errMsg TO NULL
|
|
{<POINT Name="fct.bodegas_descripcion_checkColumnConstraints.init">} {</POINT>}
|
|
IF p_descripcion IS NULL THEN
|
|
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- descripcion: " || ERROR_BAM_00001) RETURNING errNo, errMsg
|
|
END IF
|
|
{<POINT Name="fct.bodegas_descripcion_checkColumnConstraints.user">} {</POINT>}
|
|
RETURN errNo, errMsg
|
|
END FUNCTION
|
|
{</BLOCK>} --fct.bodegas_descripcion_checkColumnConstraints
|
|
|
|
--------------------------------------------------------------------------------
|
|
--Add user functions
|
|
{<POINT Name="user.functions">} {</POINT>}
|