- Code: Select all Expand view RUN
STATIC PROCEDURE NuevoPrestamo_Grabar()
LOCAL i, cSqlDetalle := "INSERT INTO prestamosdet (num_pres,cuota_no,fecha_prog,valor_prog,estado) VALUES "
LOCAL lGrabado := FALSE
FOR i:=1 TO Len( aTabla )
cSqlDetalle += "( &1, " + Var2Str( aTabla[ i, TABLA_ABO_NO ] ) + "," + ;
Var2Str( aTabla[ i, TABLA_ABO_FECHA ] ) + "," + ;
Var2Str( aTabla[ i, TABLA_ABO_VALPROG ] ) + "," + "'A'),"
NEXT
cSqlDetalle := HB_StrShrink( cSqlDetalle )
oServer:lThrowError := TRUE
TRY
oServer:BeginTransaction()
IF ( nPresNum := IncCount( "control", "cont_pres" ) ) > 0
oServer:Insert2( "prestamosmas", { { "num_ruta" , nRutaCob }, ;
{ "num_clie" , nClieNum }, ; /*datos de cliente*/
{ "nombre" , cClieNom }, ;
{ "cedula" , cClieCed }, ;
{ "ciudad" , cClieCiu }, ;
{ "direccion" , cClieDir }, ;
{ "telefonos" , cClieTel }, ;
{ "num_pres" , nPresNum }, ; /*datos del prestamo*/
{ "importe" , nImporte }, ;
{ "interes" , nInteres }, ;
{ "cuotas" , nCuotas }, ;
{ "modalidad_pago", nModalidad }, ;
{ "valor_cuota" , nValorCuota }, ;
{ "total" , nTotal }, ;
{ "fecha_ent" , dFechaEnt }, ;
{ "fecha_ini" , dFechaIni }, ;
{ "fecha_fin" , dFechaFin }, ;
{ "abonado" , 0 }, ;
{ "estado" , "A" }, ;
{ "nota" , cNota } } )
oServer:Execute( cSqlDetalle, { nPresNum } )
ENDIF
oServer:Commit()
lGrabado := TRUE
CATCH oError
ShowError( oError )
oServer:Rollback()
END
oServer:lThrowError := FALSE
IF lGrabado
NuevoPrestamo_MostrarNumero()
IF MsgNoYes( "Desea imprimir contrato del prestamo?" )
NuevoPrestamo_Imprimir()
ENDIF
NuevoPrestamo_Limpiar1( TRUE )
oDlgE:Update()
oBtnSearch:SetFocus()
ENDIF
RETURN lGrabado
- Code: Select all Expand view RUN
METHOD Execute( cSqlCmd, aParams, lShow ) CLASS TMySQLServer
LOCAL nRet, oErr
DEFAULT lShow TO FALSE
::lError := FALSE
::cError := ""
IF hb_IsArray( aParams )
cSqlCmd := EvalQueryParams( cSqlCmd, aParams, ::pMySql )
ENDIF
IF lShow
MsgInfo( ::cQuery, "SQL" )
ENDIF
IF ::lTraceLog
TraceLog( cSqlCmd )
ENDIF
IF hb_isBlock( ::bOnLoadQuery )
Eval( ::bOnLoadQuery, Self )
ENDIF
nRet := mysql_real_query( ::pMySQL, cSqlCmd )
IF hb_isBlock( ::bOnAfterQuery )
Eval( ::bOnAfterQuery, Self )
ENDIF
IF nRet > 0
::lError := TRUE
::cError := ::ErrorTxt()
IF ::lThrowError
oErr := ErrorNew()
oErr:Args := { ::pMySQL, cSqlCmd, aParams }
oErr:CanDefault := FALSE
oErr:CanRetry := FALSE
oErr:CanSubstitute := FALSE
oErr:GenCode := EG_SYNTAX
oErr:Severity := ES_ERROR
oErr:SubSystem := "HBMYSQL-(EXECUTE)"
oErr:SubCode := ::ErrNo()
oErr:Description := ::cError
oErr:Operation := cSqlCmd
Eval( ErrorBlock(), oErr )
ENDIF
ENDIF
RETURN !::lError
Currently in the native fiad class of mariadb / mysql what I have found is how to show or not show error messages, is there any way to simulate the way I currently work?
since I want to use the native class. Thanks for your attention.
salu2
carlos vargas