我很困惑。我试图在sql和IT WORKS中执行重置ai代码。
//---------
class iData
{
virtual const iData& operator=(const cDataChar& data) = 0;
virtual const iData& operator=(const cDataString& data) = 0;
}
//----------------------------
class cDataChar : public iData
{
char _data;
virtual const iData& operator=(const cDataChar& data)
{ [...implementation...] }
virtual const iData& operator=(const cDataString& data)
{ [...implementation...] }
}
//----------------------------
class cDataString : public iData
{
string _data;
virtual const iData& operator=(const cDataChar& data)
{ [...implementation...] }
virtual const iData& operator=(const cDataString& data)
{ [...implementation...] }
}
//=============================
void
cWorld::main(shared<iData> data1, shared<iData> data2)
{
if (data2->instanceOf(cDataChar))
{
auto dataChar = static_pointer_cast<cDataChar>(data2);
(*data1) = (*data2);
}
else if (data2->instanceOf(cDataString))
{
auto dataString = static_pointer_cast<cDataString>(data2);
(*data1) = (*data2);
}
// here if i do only (*data1) = (*data2);
// it doesnt find the right iData::operator=
// and goes into the default one.
}
但是当我在CI中这样做时:
SET @num := 0; UPDATE rancangan_bulanan SET id = @num := (@num+1);
它给了我一个错误。
// Location: rb_model.php
function reset_ai() {
$sql = "SET @num := 0; UPDATE rancangan_bulanan SET id = @num := (@num+1);";
$this->db->query($sql);
}
有任何建议吗?