Files

2226 lines
103 KiB
Plaintext

{<CODEFILE Path="mydatabase.code" Hash="1B2M2Y8AsgTpgAmY7PhCfg==" />}
#+ DB schema - Data 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 libdbappSql
IMPORT FGL mydatabase
IMPORT FGL mydatabase_events
IMPORT FGL mydatabase_dbxconstraints
{<POINT Name="import">} {</POINT>}
--------------------------------------------------------------------------------
--Database schema
SCHEMA mydatabase
--------------------------------------------------------------------------------
--Functions
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_selectRowByKey">}
#+ Select a row identified by the primary key in the "transacciones_master" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE transacciones_master.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE transacciones_master.*
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_selectRowByKey(p_key, p_lock)
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 p_lock BOOLEAN
DEFINE l_data RECORD LIKE transacciones_master.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM transacciones_master
WHERE @transacciones_master.num_doc = p_key.transacciones_master_num_doc
AND @transacciones_master.cod_mov = p_key.transacciones_master_cod_mov
AND @transacciones_master.bodega = p_key.transacciones_master_bodega
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM transacciones_master
WHERE @transacciones_master.num_doc = p_key.transacciones_master_num_doc
AND @transacciones_master.cod_mov = p_key.transacciones_master_cod_mov
AND @transacciones_master.bodega = p_key.transacciones_master_bodega
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_selectRowByKey
{<BLOCK Name="fct.transacciones_master_insertRowByKey">}
#+ Insert a row in the "transacciones_master" table and return the primary key created
#+
#+ @param p_data - a row data LIKE transacciones_master.*
#+
#+ @returnType INTEGER, STRING, INTEGER, SMALLINT, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, transacciones_master.num_doc, transacciones_master.cod_mov, transacciones_master.bodega
PRIVATE FUNCTION mydatabase_dbxdata_transacciones_master_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE transacciones_master.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.transacciones_master_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.transacciones_master_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_transacciones_master_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.transacciones_master_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO transacciones_master VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_transacciones_master_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.transacciones_master_insertRowByKey.afterInsert">} {</POINT>}
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.num_doc, p_data.cod_mov, p_data.bodega
END FUNCTION
{</BLOCK>} --fct.transacciones_master_insertRowByKey
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_insertRowByKey">}
#+ Insert a row in the "transacciones_master" table and return the table keys
#+
#+ @param p_data - a row data LIKE transacciones_master.*
#+
#+ @returnType INTEGER, STRING, INTEGER, SMALLINT, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, transacciones_master.num_doc, transacciones_master.cod_mov, transacciones_master.bodega
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE transacciones_master.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_transacciones_master_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.num_doc, p_data.cod_mov, p_data.bodega
RETURN errNo, errMsg, p_data.num_doc, p_data.cod_mov, p_data.bodega
END FUNCTION
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_insertRowByKey
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey">}
#+ Update a row identified by the primary key in the "transacciones_master" table
#+
#+ @param p_dataT0 - a row data LIKE transacciones_master.*
#+ @param p_dataT1 - a row data LIKE transacciones_master.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE transacciones_master.*
DEFINE p_dataT1 RECORD LIKE transacciones_master.*
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 errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey.define">} {</POINT>}
LET l_key.transacciones_master_num_doc = p_dataT0.num_doc
LET l_key.transacciones_master_cod_mov = p_dataT0.cod_mov
LET l_key.transacciones_master_bodega = p_dataT0.bodega
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_transacciones_master_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE transacciones_master
SET transacciones_master.* = p_dataT1.*
WHERE @transacciones_master.num_doc = l_key.transacciones_master_num_doc
AND @transacciones_master.cod_mov = l_key.transacciones_master_cod_mov
AND @transacciones_master.bodega = l_key.transacciones_master_bodega
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_transacciones_master_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.transacciones_master_PK_transacciones_master_1_updateRowByKey
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "transacciones_master" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_deleteRowByKey(p_key)
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 errNo INTEGER
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM transacciones_master
WHERE @transacciones_master.num_doc = p_key.transacciones_master_num_doc
AND @transacciones_master.cod_mov = p_key.transacciones_master_cod_mov
AND @transacciones_master.bodega = p_key.transacciones_master_bodega
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_transacciones_master_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_deleteRowByKey
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "transacciones_master" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE transacciones_master.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE transacciones_master.*
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 errNo INTEGER
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.transacciones_master_num_doc = p_dataT0.num_doc
LET l_key.transacciones_master_cod_mov = p_dataT0.cod_mov
LET l_key.transacciones_master_bodega = p_dataT0.bodega
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "transacciones_master" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE transacciones_master.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE transacciones_master.*
DEFINE l_dataT2 RECORD LIKE transacciones_master.*
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 p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.transacciones_master_num_doc = p_dataT0.num_doc
LET l_key.transacciones_master_cod_mov = p_dataT0.cod_mov
LET l_key.transacciones_master_bodega = p_dataT0.bodega
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_transacciones_master_PK_transacciones_master_1_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.transacciones_master_PK_transacciones_master_1_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.transacciones_master_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_transacciones_master_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE transacciones_master.*
{<POINT Name="fct.transacciones_master_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.transacciones_master_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_transacciones_master_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_transacciones_master_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.transacciones_master_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.seqreg_pk_seqreg_selectRowByKey">}
#+ Select a row identified by the primary key in the "seqreg" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE seqreg.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE seqreg.*
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_selectRowByKey(p_key, p_lock)
DEFINE p_key
RECORD
seqreg_sr_name LIKE seqreg.sr_name
END RECORD
DEFINE p_lock BOOLEAN
DEFINE l_data RECORD LIKE seqreg.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.seqreg_pk_seqreg_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.seqreg_pk_seqreg_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM seqreg
WHERE @seqreg.sr_name = p_key.seqreg_sr_name
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM seqreg
WHERE @seqreg.sr_name = p_key.seqreg_sr_name
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.seqreg_pk_seqreg_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.seqreg_pk_seqreg_selectRowByKey
{<BLOCK Name="fct.seqreg_insertRowByKey">}
#+ Insert a row in the "seqreg" table and return the primary key created
#+
#+ @param p_data - a row data LIKE seqreg.*
#+
#+ @returnType INTEGER, STRING, VARCHAR(30)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, seqreg.sr_name
PRIVATE FUNCTION mydatabase_dbxdata_seqreg_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE seqreg.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seqreg_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seqreg_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seqreg_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_seqreg_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seqreg_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO seqreg VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seqreg_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seqreg_insertRowByKey.afterInsert">} {</POINT>}
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.sr_name
END FUNCTION
{</BLOCK>} --fct.seqreg_insertRowByKey
{<BLOCK Name="fct.seqreg_pk_seqreg_insertRowByKey">}
#+ Insert a row in the "seqreg" table and return the table keys
#+
#+ @param p_data - a row data LIKE seqreg.*
#+
#+ @returnType INTEGER, STRING, VARCHAR(30)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, seqreg.sr_name
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE seqreg.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seqreg_pk_seqreg_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.seqreg_pk_seqreg_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_seqreg_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.sr_name
RETURN errNo, errMsg, p_data.sr_name
END FUNCTION
{</BLOCK>} --fct.seqreg_pk_seqreg_insertRowByKey
{<BLOCK Name="fct.seqreg_pk_seqreg_updateRowByKey">}
#+ Update a row identified by the primary key in the "seqreg" table
#+
#+ @param p_dataT0 - a row data LIKE seqreg.*
#+ @param p_dataT1 - a row data LIKE seqreg.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE seqreg.*
DEFINE p_dataT1 RECORD LIKE seqreg.*
DEFINE l_key
RECORD
seqreg_sr_name LIKE seqreg.sr_name
END RECORD
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seqreg_pk_seqreg_updateRowByKey.define">} {</POINT>}
LET l_key.seqreg_sr_name = p_dataT0.sr_name
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seqreg_pk_seqreg_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.seqreg_pk_seqreg_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_seqreg_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.seqreg_pk_seqreg_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_seqreg_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE seqreg
SET seqreg.* = p_dataT1.*
WHERE @seqreg.sr_name = l_key.seqreg_sr_name
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seqreg_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seqreg_pk_seqreg_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.seqreg_pk_seqreg_updateRowByKey
{<BLOCK Name="fct.seqreg_pk_seqreg_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "seqreg" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_deleteRowByKey(p_key)
DEFINE p_key
RECORD
seqreg_sr_name LIKE seqreg.sr_name
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seqreg_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM seqreg
WHERE @seqreg.sr_name = p_key.seqreg_sr_name
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seqreg_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seqreg_pk_seqreg_deleteRowByKey
{<BLOCK Name="fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "seqreg" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE seqreg.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE seqreg.*
DEFINE l_key
RECORD
seqreg_sr_name LIKE seqreg.sr_name
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.seqreg_sr_name = p_dataT0.sr_name
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_seqreg_pk_seqreg_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seqreg_pk_seqreg_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "seqreg" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE seqreg.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE seqreg.*
DEFINE l_dataT2 RECORD LIKE seqreg.*
DEFINE l_key
RECORD
seqreg_sr_name LIKE seqreg.sr_name
END RECORD
DEFINE p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.seqreg_sr_name = p_dataT0.sr_name
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_seqreg_pk_seqreg_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seqreg_pk_seqreg_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.seqreg_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_seqreg_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE seqreg.*
{<POINT Name="fct.seqreg_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.seqreg_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seqreg_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seqreg_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.seqreg_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.seg000_IDX_seg000_1_selectRowByKey">}
#+ Select a row identified by the primary key in the "seg000" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE seg000.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE seg000.*
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_selectRowByKey(p_key, p_lock)
DEFINE p_key
RECORD
seg000_usuario LIKE seg000.usuario
END RECORD
DEFINE p_lock BOOLEAN
DEFINE l_data RECORD LIKE seg000.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.seg000_IDX_seg000_1_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.seg000_IDX_seg000_1_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM seg000
WHERE @seg000.usuario = p_key.seg000_usuario
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM seg000
WHERE @seg000.usuario = p_key.seg000_usuario
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.seg000_IDX_seg000_1_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.seg000_IDX_seg000_1_selectRowByKey
{<BLOCK Name="fct.seg000_insertRowByKey">}
#+ Insert a row in the "seg000" table and return the primary key created
#+
#+ @param p_data - a row data LIKE seg000.*
#+
#+ @returnType INTEGER, STRING, CHAR(50)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, seg000.usuario
PRIVATE FUNCTION mydatabase_dbxdata_seg000_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE seg000.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seg000_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seg000_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seg000_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_seg000_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seg000_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO seg000 VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seg000_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seg000_insertRowByKey.afterInsert">} {</POINT>}
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.usuario
END FUNCTION
{</BLOCK>} --fct.seg000_insertRowByKey
{<BLOCK Name="fct.seg000_IDX_seg000_1_insertRowByKey">}
#+ Insert a row in the "seg000" table and return the table keys
#+
#+ @param p_data - a row data LIKE seg000.*
#+
#+ @returnType INTEGER, STRING, CHAR(50)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, seg000.usuario
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE seg000.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seg000_IDX_seg000_1_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.seg000_IDX_seg000_1_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_seg000_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.usuario
RETURN errNo, errMsg, p_data.usuario
END FUNCTION
{</BLOCK>} --fct.seg000_IDX_seg000_1_insertRowByKey
{<BLOCK Name="fct.seg000_IDX_seg000_1_updateRowByKey">}
#+ Update a row identified by the primary key in the "seg000" table
#+
#+ @param p_dataT0 - a row data LIKE seg000.*
#+ @param p_dataT1 - a row data LIKE seg000.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE seg000.*
DEFINE p_dataT1 RECORD LIKE seg000.*
DEFINE l_key
RECORD
seg000_usuario LIKE seg000.usuario
END RECORD
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.seg000_IDX_seg000_1_updateRowByKey.define">} {</POINT>}
LET l_key.seg000_usuario = p_dataT0.usuario
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seg000_IDX_seg000_1_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.seg000_IDX_seg000_1_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_seg000_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.seg000_IDX_seg000_1_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_seg000_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE seg000
SET seg000.* = p_dataT1.*
WHERE @seg000.usuario = l_key.seg000_usuario
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seg000_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.seg000_IDX_seg000_1_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.seg000_IDX_seg000_1_updateRowByKey
{<BLOCK Name="fct.seg000_IDX_seg000_1_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "seg000" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_deleteRowByKey(p_key)
DEFINE p_key
RECORD
seg000_usuario LIKE seg000.usuario
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seg000_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM seg000
WHERE @seg000.usuario = p_key.seg000_usuario
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_seg000_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seg000_IDX_seg000_1_deleteRowByKey
{<BLOCK Name="fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "seg000" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE seg000.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE seg000.*
DEFINE l_key
RECORD
seg000_usuario LIKE seg000.usuario
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.seg000_usuario = p_dataT0.usuario
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_seg000_IDX_seg000_1_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seg000_IDX_seg000_1_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "seg000" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE seg000.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE seg000.*
DEFINE l_dataT2 RECORD LIKE seg000.*
DEFINE l_key
RECORD
seg000_usuario LIKE seg000.usuario
END RECORD
DEFINE p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.seg000_usuario = p_dataT0.usuario
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_seg000_IDX_seg000_1_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.seg000_IDX_seg000_1_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.seg000_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_seg000_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE seg000.*
{<POINT Name="fct.seg000_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.seg000_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_seg000_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_seg000_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.seg000_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.productos_IDX_productos_1_selectRowByKey">}
#+ Select a row identified by the primary key in the "productos" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE productos.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE productos.*
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_selectRowByKey(p_key, p_lock)
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 p_lock BOOLEAN
DEFINE l_data RECORD LIKE productos.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.productos_IDX_productos_1_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.productos_IDX_productos_1_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM productos
WHERE @productos.cod_grupo = p_key.productos_cod_grupo
AND @productos.cod_n = p_key.productos_cod_n
AND @productos.cod_sec = p_key.productos_cod_sec
AND @productos.cod_tipo = p_key.productos_cod_tipo
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM productos
WHERE @productos.cod_grupo = p_key.productos_cod_grupo
AND @productos.cod_n = p_key.productos_cod_n
AND @productos.cod_sec = p_key.productos_cod_sec
AND @productos.cod_tipo = p_key.productos_cod_tipo
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.productos_IDX_productos_1_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.productos_IDX_productos_1_selectRowByKey
{<BLOCK Name="fct.productos_insertRowByKey">}
#+ Insert a row in the "productos" table and return the primary key created
#+
#+ @param p_data - a row data LIKE productos.*
#+
#+ @returnType INTEGER, STRING, SMALLINT, SMALLINT, SMALLINT, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, productos.cod_grupo, productos.cod_n, productos.cod_sec, productos.cod_tipo
PRIVATE FUNCTION mydatabase_dbxdata_productos_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE productos.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.productos_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.productos_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_productos_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_productos_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.productos_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO productos VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_productos_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.productos_insertRowByKey.afterInsert">} {</POINT>}
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.cod_grupo, p_data.cod_n, p_data.cod_sec, p_data.cod_tipo
END FUNCTION
{</BLOCK>} --fct.productos_insertRowByKey
{<BLOCK Name="fct.productos_IDX_productos_1_insertRowByKey">}
#+ Insert a row in the "productos" table and return the table keys
#+
#+ @param p_data - a row data LIKE productos.*
#+
#+ @returnType INTEGER, STRING, SMALLINT, SMALLINT, SMALLINT, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, productos.cod_grupo, productos.cod_n, productos.cod_sec, productos.cod_tipo
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE productos.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.productos_IDX_productos_1_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.productos_IDX_productos_1_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_productos_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.cod_grupo, p_data.cod_n, p_data.cod_sec, p_data.cod_tipo
RETURN errNo, errMsg, p_data.cod_grupo, p_data.cod_n, p_data.cod_sec, p_data.cod_tipo
END FUNCTION
{</BLOCK>} --fct.productos_IDX_productos_1_insertRowByKey
{<BLOCK Name="fct.productos_IDX_productos_1_updateRowByKey">}
#+ Update a row identified by the primary key in the "productos" table
#+
#+ @param p_dataT0 - a row data LIKE productos.*
#+ @param p_dataT1 - a row data LIKE productos.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE productos.*
DEFINE p_dataT1 RECORD LIKE productos.*
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 errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.productos_IDX_productos_1_updateRowByKey.define">} {</POINT>}
LET l_key.productos_cod_grupo = p_dataT0.cod_grupo
LET l_key.productos_cod_n = p_dataT0.cod_n
LET l_key.productos_cod_sec = p_dataT0.cod_sec
LET l_key.productos_cod_tipo = p_dataT0.cod_tipo
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.productos_IDX_productos_1_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.productos_IDX_productos_1_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_productos_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.productos_IDX_productos_1_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_productos_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE productos
SET productos.* = p_dataT1.*
WHERE @productos.cod_grupo = l_key.productos_cod_grupo
AND @productos.cod_n = l_key.productos_cod_n
AND @productos.cod_sec = l_key.productos_cod_sec
AND @productos.cod_tipo = l_key.productos_cod_tipo
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_productos_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.productos_IDX_productos_1_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.productos_IDX_productos_1_updateRowByKey
{<BLOCK Name="fct.productos_IDX_productos_1_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "productos" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_deleteRowByKey(p_key)
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 errNo INTEGER
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_productos_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM productos
WHERE @productos.cod_grupo = p_key.productos_cod_grupo
AND @productos.cod_n = p_key.productos_cod_n
AND @productos.cod_sec = p_key.productos_cod_sec
AND @productos.cod_tipo = p_key.productos_cod_tipo
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_productos_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.productos_IDX_productos_1_deleteRowByKey
{<BLOCK Name="fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "productos" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE productos.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE productos.*
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 errNo INTEGER
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.productos_cod_grupo = p_dataT0.cod_grupo
LET l_key.productos_cod_n = p_dataT0.cod_n
LET l_key.productos_cod_sec = p_dataT0.cod_sec
LET l_key.productos_cod_tipo = p_dataT0.cod_tipo
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_productos_IDX_productos_1_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.productos_IDX_productos_1_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "productos" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE productos.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE productos.*
DEFINE l_dataT2 RECORD LIKE productos.*
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 p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.productos_cod_grupo = p_dataT0.cod_grupo
LET l_key.productos_cod_n = p_dataT0.cod_n
LET l_key.productos_cod_sec = p_dataT0.cod_sec
LET l_key.productos_cod_tipo = p_dataT0.cod_tipo
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_productos_IDX_productos_1_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.productos_IDX_productos_1_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.productos_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_productos_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE productos.*
{<POINT Name="fct.productos_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.productos_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_productos_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_productos_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.productos_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_selectRowByKey">}
#+ Select a row identified by the primary key in the "grupo_producto" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE grupo_producto.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE grupo_producto.*
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_selectRowByKey(p_key, p_lock)
DEFINE p_key
RECORD
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
END RECORD
DEFINE p_lock BOOLEAN
DEFINE l_data RECORD LIKE grupo_producto.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM grupo_producto
WHERE @grupo_producto.cod_grupo = p_key.grupo_producto_cod_grupo
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM grupo_producto
WHERE @grupo_producto.cod_grupo = p_key.grupo_producto_cod_grupo
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_selectRowByKey
{<BLOCK Name="fct.grupo_producto_insertRowByKey">}
#+ Insert a row in the "grupo_producto" table and return the primary key created
#+
#+ @param p_data - a row data LIKE grupo_producto.*
#+
#+ @returnType INTEGER, STRING, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, grupo_producto.cod_grupo
PRIVATE FUNCTION mydatabase_dbxdata_grupo_producto_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE grupo_producto.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.grupo_producto_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.grupo_producto_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_grupo_producto_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.grupo_producto_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO grupo_producto VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_grupo_producto_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.grupo_producto_insertRowByKey.afterInsert">} {</POINT>}
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.cod_grupo
END FUNCTION
{</BLOCK>} --fct.grupo_producto_insertRowByKey
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_insertRowByKey">}
#+ Insert a row in the "grupo_producto" table and return the table keys
#+
#+ @param p_data - a row data LIKE grupo_producto.*
#+
#+ @returnType INTEGER, STRING, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, grupo_producto.cod_grupo
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE grupo_producto.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_grupo_producto_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.cod_grupo
RETURN errNo, errMsg, p_data.cod_grupo
END FUNCTION
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_insertRowByKey
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey">}
#+ Update a row identified by the primary key in the "grupo_producto" table
#+
#+ @param p_dataT0 - a row data LIKE grupo_producto.*
#+ @param p_dataT1 - a row data LIKE grupo_producto.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE grupo_producto.*
DEFINE p_dataT1 RECORD LIKE grupo_producto.*
DEFINE l_key
RECORD
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
END RECORD
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey.define">} {</POINT>}
LET l_key.grupo_producto_cod_grupo = p_dataT0.cod_grupo
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_grupo_producto_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE grupo_producto
SET grupo_producto.* = p_dataT1.*
WHERE @grupo_producto.cod_grupo = l_key.grupo_producto_cod_grupo
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_grupo_producto_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.grupo_producto_IDX_grupo_producto_2_updateRowByKey
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "grupo_producto" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_deleteRowByKey(p_key)
DEFINE p_key
RECORD
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM grupo_producto
WHERE @grupo_producto.cod_grupo = p_key.grupo_producto_cod_grupo
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_grupo_producto_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKey
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "grupo_producto" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE grupo_producto.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE grupo_producto.*
DEFINE l_key
RECORD
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.grupo_producto_cod_grupo = p_dataT0.cod_grupo
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "grupo_producto" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE grupo_producto.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE grupo_producto.*
DEFINE l_dataT2 RECORD LIKE grupo_producto.*
DEFINE l_key
RECORD
grupo_producto_cod_grupo LIKE grupo_producto.cod_grupo
END RECORD
DEFINE p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.grupo_producto_cod_grupo = p_dataT0.cod_grupo
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_grupo_producto_IDX_grupo_producto_2_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.grupo_producto_IDX_grupo_producto_2_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.grupo_producto_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_grupo_producto_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE grupo_producto.*
{<POINT Name="fct.grupo_producto_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.grupo_producto_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_grupo_producto_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_grupo_producto_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.grupo_producto_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.companias_IDX_companias_1_selectRowByKey">}
#+ Select a row identified by the primary key in the "companias" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE companias.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE companias.*
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_selectRowByKey(p_key, p_lock)
DEFINE p_key
RECORD
companias_cod_cia LIKE companias.cod_cia
END RECORD
DEFINE p_lock BOOLEAN
DEFINE l_data RECORD LIKE companias.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.companias_IDX_companias_1_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.companias_IDX_companias_1_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM companias
WHERE @companias.cod_cia = p_key.companias_cod_cia
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM companias
WHERE @companias.cod_cia = p_key.companias_cod_cia
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.companias_IDX_companias_1_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.companias_IDX_companias_1_selectRowByKey
{<BLOCK Name="fct.companias_insertRowByKey">}
#+ Insert a row in the "companias" table and return the primary key created
#+
#+ @param p_data - a row data LIKE companias.*
#+
#+ @returnType INTEGER, STRING, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, companias.cod_cia
PRIVATE FUNCTION mydatabase_dbxdata_companias_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE companias.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.companias_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.companias_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_companias_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_companias_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.companias_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO companias VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_companias_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.companias_insertRowByKey.afterInsert">} {</POINT>}
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.cod_cia
END FUNCTION
{</BLOCK>} --fct.companias_insertRowByKey
{<BLOCK Name="fct.companias_IDX_companias_1_insertRowByKey">}
#+ Insert a row in the "companias" table and return the table keys
#+
#+ @param p_data - a row data LIKE companias.*
#+
#+ @returnType INTEGER, STRING, SMALLINT
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, companias.cod_cia
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE companias.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.companias_IDX_companias_1_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.companias_IDX_companias_1_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_companias_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.cod_cia
RETURN errNo, errMsg, p_data.cod_cia
END FUNCTION
{</BLOCK>} --fct.companias_IDX_companias_1_insertRowByKey
{<BLOCK Name="fct.companias_IDX_companias_1_updateRowByKey">}
#+ Update a row identified by the primary key in the "companias" table
#+
#+ @param p_dataT0 - a row data LIKE companias.*
#+ @param p_dataT1 - a row data LIKE companias.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE companias.*
DEFINE p_dataT1 RECORD LIKE companias.*
DEFINE l_key
RECORD
companias_cod_cia LIKE companias.cod_cia
END RECORD
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.companias_IDX_companias_1_updateRowByKey.define">} {</POINT>}
LET l_key.companias_cod_cia = p_dataT0.cod_cia
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.companias_IDX_companias_1_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.companias_IDX_companias_1_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_companias_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.companias_IDX_companias_1_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_companias_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE companias
SET companias.* = p_dataT1.*
WHERE @companias.cod_cia = l_key.companias_cod_cia
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_companias_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.companias_IDX_companias_1_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.companias_IDX_companias_1_updateRowByKey
{<BLOCK Name="fct.companias_IDX_companias_1_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "companias" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_deleteRowByKey(p_key)
DEFINE p_key
RECORD
companias_cod_cia LIKE companias.cod_cia
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_companias_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM companias
WHERE @companias.cod_cia = p_key.companias_cod_cia
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_companias_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.companias_IDX_companias_1_deleteRowByKey
{<BLOCK Name="fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "companias" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE companias.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE companias.*
DEFINE l_key
RECORD
companias_cod_cia LIKE companias.cod_cia
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.companias_cod_cia = p_dataT0.cod_cia
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_companias_IDX_companias_1_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.companias_IDX_companias_1_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "companias" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE companias.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE companias.*
DEFINE l_dataT2 RECORD LIKE companias.*
DEFINE l_key
RECORD
companias_cod_cia LIKE companias.cod_cia
END RECORD
DEFINE p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.companias_cod_cia = p_dataT0.cod_cia
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_companias_IDX_companias_1_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.companias_IDX_companias_1_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.companias_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_companias_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE companias.*
{<POINT Name="fct.companias_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
LET l_data.prima_us = "1"
LET l_data.itbis = "0"
{<POINT Name="fct.companias_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_companias_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_companias_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.companias_setDefaultValuesFromDBSchema
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_selectRowByKey">}
#+ Select a row identified by the primary key in the "clase_productos" table
#+
#+ @param p_key - Primary Key
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER, LIKE clase_productos.*
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_NOTFOUND, RECORD LIKE clase_productos.*
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_selectRowByKey(p_key, p_lock)
DEFINE p_key
RECORD
clase_productos_cod_n LIKE clase_productos.cod_n
END RECORD
DEFINE p_lock BOOLEAN
DEFINE l_data RECORD LIKE clase_productos.*
DEFINE l_supportLock BOOLEAN
DEFINE errNo INTEGER
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_selectRowByKey.define">} {</POINT>}
LET errNo = ERROR_SUCCESS
-- SQLite does not support the FOR UPDATE close in SELECT syntax
LET l_supportLock = (UPSHIFT(fgl_db_driver_type()) != "SQT")
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_selectRowByKey.init">} {</POINT>}
TRY
IF p_lock AND l_supportLock THEN
SELECT * INTO l_data.* FROM clase_productos
WHERE @clase_productos.cod_n = p_key.clase_productos_cod_n
FOR UPDATE
ELSE
SELECT * INTO l_data.* FROM clase_productos
WHERE @clase_productos.cod_n = p_key.clase_productos_cod_n
END IF
IF SQLCA.SQLCODE == NOTFOUND THEN
LET errNo = ERROR_NOTFOUND
END IF
CATCH
INITIALIZE l_data.* TO NULL
LET errNo = ERROR_FAILURE
END TRY
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_selectRowByKey.afterSelect">} {</POINT>}
RETURN errNo, l_data.*
END FUNCTION
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_selectRowByKey
{<BLOCK Name="fct.clase_productos_insertRowByKey">}
#+ Insert a row in the "clase_productos" table and return the primary key created
#+
#+ @param p_data - a row data LIKE clase_productos.*
#+
#+ @returnType INTEGER, STRING, CHAR(1)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, clase_productos.cod_n
PRIVATE FUNCTION mydatabase_dbxdata_clase_productos_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE clase_productos.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.clase_productos_insertRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.clase_productos_insertRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_clase_productos_BeforeInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_BeforeInsertRowByKey(p_data.*)
RETURNING errNo, errMsg, p_data.*
END IF
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_clase_productos_checkTableConstraints(FALSE, p_data.*) RETURNING errNo, errMsg
END IF
{<POINT Name="fct.clase_productos_insertRowByKey.beforeInsert">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
TRY
INSERT INTO clase_productos VALUES (p_data.*)
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_clase_productos_AfterInsertRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_AfterInsertRowByKey(p_data.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.clase_productos_insertRowByKey.afterInsert">} {</POINT>}
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.cod_n
END FUNCTION
{</BLOCK>} --fct.clase_productos_insertRowByKey
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_insertRowByKey">}
#+ Insert a row in the "clase_productos" table and return the table keys
#+
#+ @param p_data - a row data LIKE clase_productos.*
#+
#+ @returnType INTEGER, STRING, CHAR(1)
#+ @return ERROR_SUCCESS|ERROR_FAILURE, error message, clase_productos.cod_n
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_insertRowByKey(p_data)
DEFINE p_data RECORD LIKE clase_productos.*
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_insertRowByKey.define">} {</POINT>}
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_insertRowByKey.init">} {</POINT>}
CALL mydatabase_dbxdata_clase_productos_insertRowByKey(p_data.*) RETURNING errNo, errMsg, p_data.cod_n
RETURN errNo, errMsg, p_data.cod_n
END FUNCTION
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_insertRowByKey
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey">}
#+ Update a row identified by the primary key in the "clase_productos" table
#+
#+ @param p_dataT0 - a row data LIKE clase_productos.*
#+ @param p_dataT1 - a row data LIKE clase_productos.*
#+
#+ @returnType INTEGER, STRING
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE, error message
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_updateRowByKey(p_dataT0, p_dataT1)
DEFINE p_dataT0 RECORD LIKE clase_productos.*
DEFINE p_dataT1 RECORD LIKE clase_productos.*
DEFINE l_key
RECORD
clase_productos_cod_n LIKE clase_productos.cod_n
END RECORD
DEFINE errNo INTEGER
DEFINE errMsg STRING
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey.define">} {</POINT>}
LET l_key.clase_productos_cod_n = p_dataT0.cod_n
INITIALIZE errMsg TO NULL
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey.init">} {</POINT>}
TRY
LET errNo = mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
CALL mydatabase_dbxconstraints.mydatabase_dbxconstraints_clase_productos_checkTableConstraints(TRUE, p_dataT1.*) RETURNING errNo, errMsg
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey.beforeUpdate">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
IF mydatabase_events.m_DbxDataEvent_clase_productos_BeforeUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_BeforeUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
UPDATE clase_productos
SET clase_productos.* = p_dataT1.*
WHERE @clase_productos.cod_n = l_key.clase_productos_cod_n
END IF
END IF
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_clase_productos_AfterUpdateRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_AfterUpdateRowByKey(p_dataT1.*)
RETURNING errNo, errMsg
END IF
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_updateRowByKey.afterUpdate">} {</POINT>}
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>} --fct.clase_productos_IDX_clase_productos_1_updateRowByKey
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKey">}
#+ Delete a row identified by the primary key in the "clase_productos" table
#+
#+ @param p_key - Primary Key
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_deleteRowByKey(p_key)
DEFINE p_key
RECORD
clase_productos_cod_n LIKE clase_productos.cod_n
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKey.define">} {</POINT>}
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKey.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_clase_productos_BeforeDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_BeforeDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
TRY
DELETE FROM clase_productos
WHERE @clase_productos.cod_n = p_key.clase_productos_cod_n
CATCH
LET errNo = ERROR_FAILURE
END TRY
IF mydatabase_events.m_DbxDataEvent_clase_productos_AfterDeleteRowByKey IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_AfterDeleteRowByKey(p_key.*)
RETURNING errNo
END IF
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKey.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_deleteRowByKey
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess">}
#+ Delete a row identified by the primary key in the "clase_productos" table if the concurrent access is success
#+
#+ @param p_dataT0 - a row data LIKE clase_productos.*
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE|ERROR_DELETE_CASCADE_ROW_USED
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess(p_dataT0)
DEFINE p_dataT0 RECORD LIKE clase_productos.*
DEFINE l_key
RECORD
clase_productos_cod_n LIKE clase_productos.cod_n
END RECORD
DEFINE errNo INTEGER
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.clase_productos_cod_n = p_dataT0.cod_n
LET errNo = libdbapp_begin_work()
IF errNo == ERROR_SUCCESS THEN
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess.init">} {</POINT>}
LET errNo = mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0.*, TRUE)
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_deleteRowByKey(l_key.*)
END IF
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess.afterDelete">} {</POINT>}
IF errNo == ERROR_SUCCESS THEN
LET errNo = libdbapp_commit_work()
ELSE
CALL libdbapp_rollback_work()
END IF
END IF
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_deleteRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess">}
#+ Check if a row identified by the primary key in the "clase_productos" table has been modified or deleted
#+
#+ @param p_dataT0 - a row data LIKE clase_productos.*
#+ @param p_lock - Indicate if a lock is used in order to prevent several users editing the same rows at the same time
#+
#+ @returnType INTEGER
#+ @return ERROR_SUCCESS|ERROR_FAILURE|ERROR_CONCURRENT_ACCESS_NOTFOUND|ERROR_CONCURRENT_ACCESS_FAILURE
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess(p_dataT0, p_lock)
DEFINE p_dataT0 RECORD LIKE clase_productos.*
DEFINE l_dataT2 RECORD LIKE clase_productos.*
DEFINE l_key
RECORD
clase_productos_cod_n LIKE clase_productos.cod_n
END RECORD
DEFINE p_lock BOOLEAN
DEFINE errNo INTEGER
DEFINE errDiff INTEGER
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess.define">} {</POINT>}
LET l_key.clase_productos_cod_n = p_dataT0.cod_n
INITIALIZE l_dataT2.* TO NULL
LET errDiff = FALSE
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess.init">} {</POINT>}
CALL mydatabase_dbxdata_clase_productos_IDX_clase_productos_1_selectRowByKey(l_key.*, p_lock) RETURNING errNo, l_dataT2.*
CASE errNo
WHEN ERROR_SUCCESS
LET errDiff = (p_dataT0.* != l_dataT2.*)
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess.afterSelect">} {</POINT>}
IF NOT errDiff THEN
LET errNo = ERROR_SUCCESS
ELSE
LET errNo = ERROR_CONCURRENT_ACCESS_FAILURE
END IF
WHEN ERROR_NOTFOUND
LET errNo = ERROR_CONCURRENT_ACCESS_NOTFOUND
END CASE
{<POINT Name="fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess.afterCheck">} {</POINT>}
RETURN errNo
END FUNCTION
{</BLOCK>} --fct.clase_productos_IDX_clase_productos_1_checkRowByKeyWithConcurrentAccess
{<BLOCK Name="fct.clase_productos_setDefaultValuesFromDBSchema">}
#+ Set data with the default values coming from the DB schema
#+
PUBLIC FUNCTION mydatabase_dbxdata_clase_productos_setDefaultValuesFromDBSchema()
DEFINE l_data RECORD LIKE clase_productos.*
{<POINT Name="fct.clase_productos_setDefaultValuesFromDBSchema.define">} {</POINT>}
INITIALIZE l_data.* TO NULL
{<POINT Name="fct.clase_productos_setDefaultValuesFromDBSchema.init">} {</POINT>}
IF mydatabase_events.m_DbxDataEvent_clase_productos_SetDefaultValues IS NOT NULL THEN
CALL mydatabase_events.m_DbxDataEvent_clase_productos_SetDefaultValues(l_data.*)
RETURNING l_data.*
END IF
RETURN l_data.*
END FUNCTION
{</BLOCK>} --fct.clase_productos_setDefaultValuesFromDBSchema
--------------------------------------------------------------------------------
--Add user functions
{<POINT Name="user.functions">} {</POINT>}