From: Warren Young Date: October 18 2006 6:34pm Subject: Re: Problems with timestamp List-Archive: http://lists.mysql.com/plusplus/6051 Message-Id: <453673BA.80706@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit Королев Илья wrote: >> I proposed defining the structures in XML >> or some other such language and create a preprocessor that translates >> that into header files defining the structures. > > Unfortunately in closest period I'm enough > busy, but in next months I'll try take it. That's fine, I couldn't accept it before v3.0 anyway. > are there any concrete ideas? Just to move in correct way. Start with the file format. Something like this: The file name should use a unique extension (.ssqls ?) so you can write build rules. For example, in Makefile syntax: .ssqls.h: ssqlsgen $@ ...takes mytables.ssqls and creates mytables.h. (Maybe creates mytables.cpp, too, but I'm not certain about that. It might be better if everything remained inline.) For this to be valuable, the mechanism needs to: 1. Write clear, well-formatted C++ code 2. Create classes that are easy to subclass without problems. This means that there should be as little public and protected methods and data as possible. 3. Cope with different type systems. Notice above that I'm using SQL type names. It should be smart enough to translate those into the proper MySQL++ type names. Likewise, if I put in, say, time_t, it should be able to figure out the right thing to do there, too. 4. Work with the Null<> template. Notice this in the first field definition. 5. SSQLS structures should derive from a common base class. This let you put some useful common code in the MySQL++ library itself, but more importantly, it would let you make methods like Query::insert() into regular methods instead of templates.