The task is to implement an effective way of processing data, which is a table (by the type of database tables), in which there are fields (columns of the same type), and records (rows). Fields will be only two types - string, double. The possible number of records (lines) to 3 000 000! Fields (columns) to 20. I decipher that for implementation it is better to use STL, the container vector. The question is still about the effective implementation of the structure of data storage and processing! What opinions will be !?
- Please help solve the problem with incomplete source data? - alexlz
- Complete source data is not needed, the problem is solved in a general form (universal), I think to split this table into two, one will contain double, the other string data ... - rejie
- Why don't you use a DBMS? - BuilderC
- In my task, the application itself should work like a DBMS, but not through SQL, but through DDE exchange! - rejie
- here and screw it say SQLite - renegator
|
1 answer
So there is a class Table and a class Record
class Record{ public: Record(unsigned long dwDblNum, unsigned long dwStrNum){ if (dwDblNum) pDblTab=new double[dwDblNum]; if (dwStrNum) pStrTab=new string[dwStrNum]; } ~Record(){ if(pStrTab) delete[] pStrTab; if(pDblTab) delete[] pDblTab; } string *pStrTab; double *pDblTab; }; Table class:
class Table{ public: Table():dwRowsNum(0), dwColumnsNum(0){}; ~Table(){}; void InitTable(unsigned long dwRowsNumber, unsigned long dwColumnsNumber, unsigned short *pTypeFields); unsigned long dwRowsNum; unsigned long dwColumnsNum; vector <Record> vecRecord; }; The InitTable method is used to initialize the table, parameters:
dwRowsNumber - Количество строк dwColumnsNumber - Количество столбцов pTypeFields - Массив соответсвия столбца конкретному типу (double-1, string-2) |