Files
MBS/DATABASE/dbdgii.code
T

733 lines
27 KiB
Plaintext

{<CODEFILE version="1.0" encoding="CP1252">}
{<SOURCEFILE name="dbdgii_dbxconstraints.4gl" hash="5jaoc9lxdEF8t+d1/ak0sQ==">}
{<USERCODE>}
{<POINT Name="user.comments" Status="MODIFIED">}
{</POINT>}
{<POINT Name="import" Status="MODIFIED">}
{</POINT>}
{<BLOCK Name="fct.empresastmp_checkTableConstraints" Status="MODIFIED">}
#+ Check constraints on the "empresastmp" table
#+
#+ @param p_data - a row data LIKE empresastmp.*
#+
#+ @returnType - INTEGER, STRING
#+ @return - ERROR_SUCCESS|ERROR_FAILURE, message error
PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_checkTableConstraints(p_forUpdate, p_data)
DEFINE p_forUpdate BOOLEAN
DEFINE p_data RECORD LIKE empresastmp.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
DEFINE l_errNo INTEGER
DEFINE l_errMsg STRING
LET errNo = ERROR_SUCCESS
INITIALIZE errMsg TO NULL
CALL dbdgii_dbxconstraints_empresastmp_rnc_checkColumnConstraints(p_data.rnc) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_razon_social_checkColumnConstraints(p_data.razon_social) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_nombre_empresa_checkColumnConstraints(p_data.nombre_empresa) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_actividad_checkColumnConstraints(p_data.actividad) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_calle_checkColumnConstraints(p_data.calle) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_no_local_checkColumnConstraints(p_data.no_local) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_sector_checkColumnConstraints(p_data.sector) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_telefono_checkColumnConstraints(p_data.telefono) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_fecha_inicio_checkColumnConstraints(p_data.fecha_inicio) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_estado1_checkColumnConstraints(p_data.estado1) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_estado2_checkColumnConstraints(p_data.estado2) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresastmp_pk_empresastmp_checkUniqueConstraint(p_forUpdate, p_data.rnc) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
RETURN errNo, errMsg
END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_pk_empresastmp_checkUniqueConstraint" Status="MODIFIED">}
#+ Check the primary key uniqueness constraint on the "empresastmp"
#+
#+ @param p_key - Primary Key
#+
#+ @returnType - INTEGER
#+ @return - ERROR_SUCCESS|ERROR_FAILURE
PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_pk_empresastmp_checkUniqueConstraint(p_forUpdate, p_key)
DEFINE errNo INTEGER
DEFINE errMsg STRING
DEFINE p_forUpdate BOOLEAN
DEFINE p_key
RECORD
empresastmp_rnc LIKE empresastmp.rnc
END RECORD
DEFINE l_key
RECORD
empresastmp_rnc LIKE empresastmp.rnc
END RECORD
DEFINE l_where STRING
DEFINE l_sqlQuery STRING
DEFINE l_count INTEGER
LET errNo = ERROR_SUCCESS
INITIALIZE errMsg TO NULL
LET l_where = "WHERE empresastmp.rnc = ? "
let l_sqlQuery = "SELECT COUNT(*), rnc FROM empresastmp ", l_where, " GROUP BY rnc"
PREPARE cur_empresastmp_pk_empresastmp_checkUniqueConstraint FROM l_sqlQuery
EXECUTE cur_empresastmp_pk_empresastmp_checkUniqueConstraint INTO l_count, l_key.* USING p_key.*
FREE cur_empresastmp_pk_empresastmp_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- rnc: " || ERROR_BAM_00002) RETURNING errNo, errMsg
END IF
RETURN errNo, errMsg
END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_rnc_checkColumnConstraints" Status="MODIFIED">}
#+ Check constraints on the "empresastmp.rnc" column
#+
#+ @param p_rnc - CHAR(11) -
#+
#+ @returnType - INTEGER
#+ @return - ERROR_SUCCESS|ERROR_FAILURE
PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_rnc_checkColumnConstraints(p_rnc)
DEFINE errNo INTEGER
DEFINE errMsg STRING
DEFINE p_rnc LIKE empresastmp.rnc
LET errNo = ERROR_SUCCESS
INITIALIZE errMsg TO NULL
IF p_rnc IS NULL THEN
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, ERROR_FAILURE, "\n- rnc: " || ERROR_BAM_00001) RETURNING errNo, errMsg
END IF
RETURN errNo, errMsg
END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_checkTableConstraints" Status="MODIFIED">}
#+ Check constraints on the "empresas" table
#+
#+ @param p_data - a row data LIKE empresas.*
#+
#+ @returnType - INTEGER, STRING
#+ @return - ERROR_SUCCESS|ERROR_FAILURE, message error
PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_checkTableConstraints(p_forUpdate, p_data)
DEFINE p_forUpdate BOOLEAN
DEFINE p_data RECORD LIKE empresas.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
DEFINE l_errNo INTEGER
DEFINE l_errMsg STRING
LET errNo = ERROR_SUCCESS
INITIALIZE errMsg TO NULL
CALL dbdgii_dbxconstraints_empresas_rnc_checkColumnConstraints(p_data.rnc) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_razon_social_checkColumnConstraints(p_data.razon_social) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_nombre_empresa_checkColumnConstraints(p_data.nombre_empresa) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_actividad_checkColumnConstraints(p_data.actividad) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_calle_checkColumnConstraints(p_data.calle) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_no_local_checkColumnConstraints(p_data.no_local) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_sector_checkColumnConstraints(p_data.sector) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_telefono_checkColumnConstraints(p_data.telefono) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_fecha_inicio_checkColumnConstraints(p_data.fecha_inicio) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_estado1_checkColumnConstraints(p_data.estado1) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
CALL dbdgii_dbxconstraints_empresas_estado2_checkColumnConstraints(p_data.estado2) RETURNING l_errNo, l_errMsg
CALL libdbapp_utilBuildErrorNoAndErrorMsg(errNo, errMsg, l_errNo, l_errMsg) RETURNING errNo, errMsg
RETURN errNo, errMsg
END FUNCTION
{</BLOCK>}
{<POINT Name="user.functions" Status="MODIFIED">}
{</POINT>}
{</USERCODE>}
{<LOSTCODE>}
{<BLOCK Name="fct.empresas_actividad_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.actividad" column
-- #+
-- #+ @param p_actividad - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_actividad_checkColumnConstraints(p_actividad)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_actividad LIKE empresas.actividad
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_calle_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.calle" column
-- #+
-- #+ @param p_calle - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_calle_checkColumnConstraints(p_calle)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_calle LIKE empresas.calle
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_estado1_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.estado1" column
-- #+
-- #+ @param p_estado1 - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_estado1_checkColumnConstraints(p_estado1)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_estado1 LIKE empresas.estado1
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_estado2_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.estado2" column
-- #+
-- #+ @param p_estado2 - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_estado2_checkColumnConstraints(p_estado2)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_estado2 LIKE empresas.estado2
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_fecha_inicio_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.fecha_inicio" column
-- #+
-- #+ @param p_fecha_inicio - CHAR(10) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_fecha_inicio_checkColumnConstraints(p_fecha_inicio)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_fecha_inicio LIKE empresas.fecha_inicio
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_no_local_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.no_local" column
-- #+
-- #+ @param p_no_local - CHAR(10) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_no_local_checkColumnConstraints(p_no_local)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_no_local LIKE empresas.no_local
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_nombre_empresa_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.nombre_empresa" column
-- #+
-- #+ @param p_nombre_empresa - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_nombre_empresa_checkColumnConstraints(p_nombre_empresa)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_nombre_empresa LIKE empresas.nombre_empresa
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_razon_social_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.razon_social" column
-- #+
-- #+ @param p_razon_social - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_razon_social_checkColumnConstraints(p_razon_social)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_razon_social LIKE empresas.razon_social
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_rnc_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.rnc" column
-- #+
-- #+ @param p_rnc - CHAR(11) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_rnc_checkColumnConstraints(p_rnc)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_rnc LIKE empresas.rnc
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_sector_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.sector" column
-- #+
-- #+ @param p_sector - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_sector_checkColumnConstraints(p_sector)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_sector LIKE empresas.sector
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresas_telefono_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresas.telefono" column
-- #+
-- #+ @param p_telefono - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresas_telefono_checkColumnConstraints(p_telefono)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_telefono LIKE empresas.telefono
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_actividad_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.actividad" column
-- #+
-- #+ @param p_actividad - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_actividad_checkColumnConstraints(p_actividad)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_actividad LIKE empresastmp.actividad
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_calle_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.calle" column
-- #+
-- #+ @param p_calle - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_calle_checkColumnConstraints(p_calle)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_calle LIKE empresastmp.calle
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_estado1_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.estado1" column
-- #+
-- #+ @param p_estado1 - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_estado1_checkColumnConstraints(p_estado1)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_estado1 LIKE empresastmp.estado1
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_estado2_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.estado2" column
-- #+
-- #+ @param p_estado2 - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_estado2_checkColumnConstraints(p_estado2)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_estado2 LIKE empresastmp.estado2
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_fecha_inicio_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.fecha_inicio" column
-- #+
-- #+ @param p_fecha_inicio - CHAR(10) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_fecha_inicio_checkColumnConstraints(p_fecha_inicio)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_fecha_inicio LIKE empresastmp.fecha_inicio
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_no_local_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.no_local" column
-- #+
-- #+ @param p_no_local - CHAR(10) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_no_local_checkColumnConstraints(p_no_local)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_no_local LIKE empresastmp.no_local
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_nombre_empresa_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.nombre_empresa" column
-- #+
-- #+ @param p_nombre_empresa - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_nombre_empresa_checkColumnConstraints(p_nombre_empresa)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_nombre_empresa LIKE empresastmp.nombre_empresa
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_razon_social_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.razon_social" column
-- #+
-- #+ @param p_razon_social - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_razon_social_checkColumnConstraints(p_razon_social)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_razon_social LIKE empresastmp.razon_social
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_sector_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.sector" column
-- #+
-- #+ @param p_sector - CHAR(100) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_sector_checkColumnConstraints(p_sector)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_sector LIKE empresastmp.sector
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_telefono_checkColumnConstraints" Status="LOST">}
-- #+ Check constraints on the "empresastmp.telefono" column
-- #+
-- #+ @param p_telefono - CHAR(15) -
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxconstraints_empresastmp_telefono_checkColumnConstraints(p_telefono)
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE p_telefono LIKE empresastmp.telefono
--
-- LET errNo = ERROR_SUCCESS
-- INITIALIZE errMsg TO NULL
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{</LOSTCODE>}
{</SOURCEFILE>}
{<SOURCEFILE name="dbdgii_dbxdata.4gl" hash="javWTIEHtIq+N8lJFwImXA==">}
{<USERCODE>}
{<POINT Name="user.comments" Status="MODIFIED">}
{</POINT>}
{<POINT Name="import" Status="MODIFIED">}
{</POINT>}
{<BLOCK Name="fct.empresastmp_insertRowByKey" Status="MODIFIED">}
#+ Insert a row in the "empresastmp" table and return the primary key created
#+
#+ @param p_data - a row data LIKE empresastmp.*
#+
#+ @returnType - INTEGER, CHAR(11)
#+ @return - ERROR_SUCCESS|ERROR_FAILURE, empresastmp.rnc
PUBLIC FUNCTION dbdgii_dbxdata_empresastmp_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE empresastmp.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
CALL dbdgii_dbxconstraints.dbdgii_dbxconstraints_empresastmp_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO empresastmp VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
END IF
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo, errMsg, p_data.rnc
END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_setDefaultValuesFromDBSchema" Status="MODIFIED">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION dbdgii_dbxdata_empresastmp_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE empresastmp.*
INITIALIZE l_data.* TO NULL
LET l_data.rnc = ""
LET l_data.razon_social = ""
LET l_data.nombre_empresa = ""
LET l_data.actividad = ""
LET l_data.calle = ""
LET l_data.no_local = ""
LET l_data.sector = ""
LET l_data.telefono = ""
LET l_data.fecha_inicio = ""
LET l_data.estado1 = ""
LET l_data.estado2 = ""
RETURN l_data.*
END FUNCTION
{</BLOCK>}
{<POINT Name="user.functions" Status="MODIFIED">}
{</POINT>}
{</USERCODE>}
{<LOSTCODE>}
{<BLOCK Name="fct.empresastmp_deleteRowByKey" Status="LOST">}
-- #+ Delete a row identified by the primary key in the "empresastmp" table
-- #+
-- #+ @param p_key - Primary Key
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxdata_empresastmp_deleteRowByKey(p_key)
-- DEFINE p_key
-- RECORD
-- empresastmp_rnc LIKE empresastmp.rnc
-- END RECORD
-- DEFINE errNo INTEGER
--
-- LET errNo = libdbapp_begin_work()
-- IF errNo == ERROR_SUCCESS THEN
-- TRY
-- DELETE FROM empresastmp
-- WHERE empresastmp.rnc = p_key.empresastmp_rnc
-- CATCH
-- LET errNo = ERROR_FAILURE
-- END TRY
-- END IF
-- IF errNo == ERROR_SUCCESS THEN
-- LET errNo = libdbapp_commit_work()
-- ELSE
-- CALL libdbapp_rollback_work()
-- END IF
--
-- RETURN errNo
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_selectRowByKey" Status="LOST">}
-- #+ Select a row identified by the primary key in the "empresastmp" table
-- #+
-- #+ @param p_key - Primary Key
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE, l_data
-- PUBLIC FUNCTION dbdgii_dbxdata_empresastmp_selectRowByKey(p_key)
-- DEFINE p_key
-- RECORD
-- empresastmp_rnc LIKE empresastmp.rnc
-- END RECORD
-- DEFINE l_data RECORD LIKE empresastmp.*
-- DEFINE errNo INTEGER
--
-- INITIALIZE l_data.* TO NULL
-- LET errNo = ERROR_SUCCESS
-- TRY
-- SELECT * INTO l_data.* FROM empresastmp
-- WHERE empresastmp.rnc = p_key.empresastmp_rnc
-- CATCH
-- INITIALIZE l_data.* TO NULL
-- LET errNo = ERROR_FAILURE
-- END TRY
--
-- RETURN errNo, l_data.*
-- END FUNCTION
{</BLOCK>}
{<BLOCK Name="fct.empresastmp_updateRowByKey" Status="LOST">}
-- #+ Update a row identified by the primary key in the "empresastmp" table
-- #+
-- #+ @param p_key - Primary Key
-- #+ @param p_dataT0 - a row data LIKE empresastmp.*
-- #+ @param p_dataT1 - a row data LIKE empresastmp.*
-- #+
-- #+ @returnType - INTEGER
-- #+ @return - ERROR_SUCCESS|ERROR_FAILURE
-- PUBLIC FUNCTION dbdgii_dbxdata_empresastmp_updateRowByKey(p_key, p_dataT0, p_dataT1)
-- DEFINE p_key
-- RECORD
-- empresastmp_rnc LIKE empresastmp.rnc
-- END RECORD
-- DEFINE p_dataT0 RECORD LIKE empresastmp.*
-- DEFINE p_dataT1 RECORD LIKE empresastmp.*
-- DEFINE l_dataT2 RECORD LIKE empresastmp.*
-- DEFINE errNo INTEGER
-- DEFINE errMsg STRING
-- DEFINE errDiff INTEGER
--
-- INITIALIZE l_dataT2.* TO NULL
-- INITIALIZE errMsg TO NULL
-- LET errDiff = FALSE
-- LET errNo = libdbapp_begin_work()
-- IF errNo == ERROR_SUCCESS THEN
-- TRY
-- -- Concurrent Access done with the FOR UPDATE (not supported by SQLite)
-- IF (UPSHIFT(fgl_db_driver_type()) != "SQT") THEN
-- SELECT * INTO l_dataT2.* FROM empresastmp
-- WHERE empresastmp.rnc = p_key.empresastmp_rnc
-- FOR UPDATE
-- LET errDiff = (p_dataT0.* != l_dataT2.*)
-- END IF
--
-- IF NOT errDiff THEN
-- CALL dbdgii_dbxconstraints.dbdgii_dbxconstraints_empresastmp_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
-- IF errNo == ERROR_SUCCESS THEN
-- UPDATE empresastmp
-- SET empresastmp.* = p_dataT1.*
-- WHERE empresastmp.rnc = p_key.empresastmp_rnc
-- END IF
-- ELSE
-- LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
-- END IF
-- CATCH
-- LET errNo = ERROR_FAILURE
-- END TRY
-- IF errNo == ERROR_SUCCESS THEN
-- LET errNo = libdbapp_commit_work()
-- ELSE
-- CALL libdbapp_rollback_work()
-- END IF
-- END IF
--
-- RETURN errNo, errMsg
-- END FUNCTION
{</BLOCK>}
{</LOSTCODE>}
{</SOURCEFILE>}
{</CODEFILE>}