I'm having a huge problem with Insert/MySql. I have a Decimal field where I'm tryng to save the value 1(one), but it's saved as 0(zero). Bellow i'm showing a little sample where the problem is happening.
- Code: Select all Expand view
function Main()
LOCAL oCn, oAnt,nValInss,nValIn13,aVal,cvd_500
FW_SetUnicode( .t. )
SET FIXED ON
SET DATE BRIT
SET CENTURY ON
SET DECIMAL TO 2
MySql_TinyintAsLogical( .t. )
REQUEST DBFCDX
RddSetDefault ( "DBFCDX" )
aVal := {}
nValInss := nValIn13 := 0
oCn := maria_Connect( "10.10.1.10,teste_sfp,user,@#$@#@#", .t. )
oAnt := oCN:Query("SELECT fol.nfolha,fol.cmat,fol.cvandes,fol.val_calc,fol.clotacao,fol.situacao,fol.total_inc "+;
"FROM folhaprc AS folp LEFT JOIN foldet AS fld ON folp.cemp = fld.cemp AND folp.nfolha = fld.nfolha AND fld.cmat = '00261' "+;
"RIGHT JOIN folha AS fol ON folp.cemp = fol.cemp AND folp.nfolha = fol.nfolha AND fol.cmat = '00261' "+;
"WHERE folp.cemp = '047' AND fld.cmat = '00261' AND folp.nfolha <> '9WZ' AND "+;
"Concat(folp.ano,folp.mes) = '202402' AND fld.tipo <> 'D' AND fol.filial = '1' AND Locate(fol.cvandes,'001,400')<=0")
DO WHILE .NOT. oAnt:Eof()
IF oAnt:cvandes = "500"
nValInss += oAnt:val_calc
ENDIF
oAnt:Skip()
ENDDO
cvd_500 := 238.17 - nValInss //result = 1
Aadd(aVal,{"047","9WZ","00261","500","500",0,cvd_500,0,"1",oAnt:clotacao,1,oAnt:situacao})
oCN:Insert("folha","cemp,nfolha,cmat,cvandes,cvdorig,val_inf,val_calc,total_inc,filial,clotacao,prazo,situacao",aVal,.t.)
oCN:Close()
return nil