Code
155template<typename T>156inline void CvDatabaseUtility::InitializeArray(T*& pArray, const char* szTableName, T default)157{158 size_t count = MaxRows(szTableName);159160 //This is a bit of a hack to support empty tables.161 //For example, the "Automates" table will be empty during a tutorial.162 //We cannot simply NULL out the array because WAY too much code blindly assumes SOMETHING will be there..163 //Instead we allocate room for 1 element and just roll with it.164165 //CvAssertMsg(count > 0, DB.ErrorMessage());166 if(count == 0)167 count = 1;168169 InitializeArray(pArray, count, default);170}