PROCEDURE Id
LOCAL __idNotReturned, __notAvailable, __idReturned, __commandSql
* Id
* Obtener el Ultimo ID al insertar un Registro Nuevo, el valor se obtiene en la propiedad .id_Last
* Parámetros
* No Requiere
* Valor devuelto
* true Ultimo ID obtenido
* false No se pudo obtener el Ultimo ID
* Error Devuelto
__idNotReturned = -1 && ID no obtenido
__notAvailable = 0 && No disponible
__idReturned = 1 && ID Obtenido
__commandSql = "" && Comando SQL según el motor de base de datos
this.Id_last = 0 && Iniciar valor de Ultimo ID Insertando en Cero
* Generar Comando Sql
DO CASE
CASE this.engine = this.mySql
__commandSql = "SELECT LAST_INSERT_ID() as id"
CASE this.engine = this.mariaDb
__commandSql = "SELECT LAST_INSERT_ID() as id"
CASE this.engine = this.fireBird
IF USED("foxydb_last_id")
__id_name = this.id_name
this.id_last = foxydb_last_id.&__id_name
USE IN foxydb_last_id
RETURN this.Post(Program(),__idReturned,true)
ELSE
RETURN this.Post(Program(),__idNotReturned,false)
ENDIF
CASE this.engine = this.postgreSql
RETURN this.Post(Program(),__notAvailable,false)
CASE this.engine = this.sqlServer
RETURN this.Post(Program(),__notAvailable,false)
ENDCASE
* Obtener Ultimo Id
IF this.Sql(__commandSql,"foxydb_last_id")
USE IN foxydb_last_id
RETURN this.Post(Program(),__idReturned,true)
ELSE
RETURN this.Post(Program(),__idNotReturned,false)
ENDIF
ENDPROC