|
Re: SSQLS v2 :): msg#00061db.mysql.c++
Here is an example of autogenerated code. Code is divided into *.h and *.cpp. I guess it save all features. It's some examples of using such code 1. Normal case struct_A a; cerr << "INSERT INTO " << a.table() << "(" << a.field_list() << ") VALUES( " << ")" << endl; will output INSERT INTO table_A(tkey,tts) VALUES( ) 2. Global change field name struct_A a; struct_A::fields()[1] = "timestamp"; cerr << "INSERT INTO " << a.table() << "(" << a.field_list() << ") VALUES( " << ")" << endl; will output INSERT INTO table_A(tkey,timestamp) VALUES( ) 3. Global change field name struct_A a; struct_A::fields()[1] = "DATE_ADD(tts, INTERVAL 1 DAY)"; cerr << "SELECT " << a.field_list() << " FROM " << a.table() << endl; will output SELECT tkey,DATE_ADD(tts, INTERVAL 1 DAY) from table_A 4. Local change field name & Show only keys fields struct_A a; StringList flist = struct_A::fields(); list[0] = "tkey + 1"; cerr << "SELECT " << a.field_list(struct_A::keys(), false, flist) << " FROM " << a.table() << endl; will output SELECT tkey +1 FROM table_A 4. Local change field name & Show only not keys fields struct_A a; StringList flist = struct_A::fields(); list[0] = "tkey + 1"; cerr << "SELECT " << a.field_list(struct_A::keys(), true, flist) << " FROM " << a.table() << endl; will output SELECT tts FROM table_A Are any features missed? В сообщении от 22 ноября 2006 03:09 Warren Young написал(a): > Королев Илья wrote: > > I'm studying expanded SSQLS code and I have a question. > > As I can see, field_list() (for example) return a temporary object of > > <ClassName>_field_list. And real output to stream operate with it. I > > wonder, what are advantages of such approach? Why we can't just return > > std::string in field_list()? Disadvantage is heavy *.h. > > The advantage is that a list of field names is more flexible than a > single string listing the fields. This advantage matters if you don't > need all of the fields, or you need to have them in multiple formats. I > would only let you change this as you suggest if you can prove that all > uses of the field list objects only need the fields in a single format, > and they need all of them, always.
-- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Can some help me with this gdb output with mysql and string core: 00061, Warren Young |
|---|---|
| Next by Date: | Re: SSQLS v2 :): 00061, Королев Илья |
| Previous by Thread: | Re: SSQLS v2 :)i: 00061, Warren Young |
| Next by Thread: | Re: SSQLS v2 :): 00061, Королев Илья |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |