c++有个头疼的问题,希望得到大佬指导!
本帖最后由 dmxayjn 于 2022-4-1 15:43 编辑char szSQL = { 0, };
sprintf(szSQL,
"uspBoothSystemSaveInfo '%07d', '%07d', '%06d', '%d', '%s', '%f', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%d',\
'%d', '%d', '%d', '%lld',\
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d'",
info->idPlayer, info->idCouple, info->idGuild, info->dwWorldId, info->szName, info->fAngle,
info->nSex, info->nJob, info->nLevel, info->nFame, info->vPos.x, info->vPos.y, info->vPos.z, info->nGold,
info->m_dwHairMesh, info->m_dwHairColor, info->m_dwHeadMesh, info->dwEndTime,
info->pBoothInfo->strTitle
, itemPartsContainer.szItem, itemPartsContainer.szExt, itemPartsContainer.szPet, itemPartsContainer.szPiercing
, itemVendContainer.szItem, itemVendContainer.szExt, itemVendContainer.szPet, itemVendContainer.szPiercing
, ACASH
);
ACASH 这个声明是 int 类型的,实际这个类型的数值是0,但是执行到SQL数据库里面就会是随机数,大概就是几亿左右。。
本来我以为是哪里出错了,我找了好多赋值的地方,我用 WriteLog("ACASH = %d",ACASH ); 打印日志查看发现,打印出来的日志是0
不知道为啥写入到SQL数据库里面变成 几亿左右了。。
最搞笑的事情出现了。
我直接这样打印日志如下:
WriteLog("uspBoothSystemSaveInfo '%07d', '%07d', '%06d', '%d', '%s', '%f', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%d',\
'%d', '%d', '%d', '%lld',\
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d'",
info->idPlayer, info->idCouple, info->idGuild, info->dwWorldId, info->szName, info->fAngle,
info->nSex, info->nJob, info->nLevel, info->nFame, info->vPos.x, info->vPos.y, info->vPos.z, info->nGold,
info->m_dwHairMesh, info->m_dwHairColor, info->m_dwHeadMesh, info->dwEndTime,
info->pBoothInfo->strTitle
, itemPartsContainer.szItem, itemPartsContainer.szExt, itemPartsContainer.szPet, itemPartsContainer.szPiercing
, itemVendContainer.szItem, itemVendContainer.szExt, itemVendContainer.szPet, itemVendContainer.szPiercing
, ACASH);
发现打印出来的日志是:
uspBoothSystemSaveInfo '0000107', '0000000', '000000', '1', 'Ef64', '123.997192', '1', '1', '30', '0', '6974.817383', '100.000000', '3250.815186', '0', '3', '-6921131', '1', '1680325040', '(null)', '', '-1,504,0,0,,1,0,9000000,0,0,0,1929786033,0,0,0,0,0/-1,508,0,0,,1,0,5850000,0,0,0,1260013805,0,0,0,0,0/-1,512,0,0,,1,0,4500000,0,0,0,-1867025630,0,0,0,0,0/-1,21,0,0,,1,0,7200000,0,0,0,830247347,0,0,0,0,0/$', '$', '$', '$', '-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/1,23823,0,0,,3,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/-1,21,0,0,,1,0,-1,0,0,0,0,0,0,0,0,0/$', '$', '$', '187559536'
但是上面的日志 ACASH = 187559536 了
但是单独打印出来的日志 ACASH = 0
问题原因找到了,是执行储存过程的时候,不知道为啥少传递一个参数,
暂时用临时办法解决了。直接又+了一个参数就可以了。。
看看ACASH的初始化是不是与执行语句再一个作用域; zxcvbnm10230 发表于 2022-4-1 13:32
看看ACASH的初始化是不是与执行语句再一个作用域;
是的。。在一个 作用域 问题找到了。。源码里写的参数是 28个,但是打印出来的日志是 27个,,卧槽。
页:
[1]