List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:October 18 2006 12:20pm
Subject:Re: Problems with timestamp
View as plain text  
Королев Илья wrote:
> В сообщении от 17 октября 2006 16:04 Warren Young
> написал(a):
>> Королев Илья wrote:
>>> Why we can't just drop away static names[] ( and table)?
>> How would SSQLS build queries without a table of the field names?
> 
> like this:
> 
> template <class Manip> std::ostream& operator << (std::ostream&
> s, const 
> DB_AdvBase_field_list<Manip>& obj) {
>   s << obj.manip << "user_id" << obj.delem;
>   s << obj.manip << "position" << obj.delem;
>   s << obj.manip << "ts" << obj.delem;
>   s << obj.manip << "pads";
>   return s;
> }
> 
> IMHO in such way we don't need names[] at all.

Well, as a static example, that's interesting, but I'm not going to 
rebuild custom.pl to implement it.  If I were to spend a lot of time on 
reworking SSQLS it would be to completely replace it with a different 
mechanism.  The current macro-based mechanism is hard to understand and 
manipulate, so when we do run into problems, they tend not to get addressed.

This topic's come up before.  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.  This would be similar 
to the way things like IDL work in CORBA and COM.  The idea fizzled 
because the driving force behind it at that time was Borland C++ 
incompatibility, but that problem's taken care of itself, leaving my 
solution unnecessary.

You're welcome to tackle it, if you like.

>>> The only advantage IMHO is that we can change names[](table) on the
>>> fly.
>> Every single table in my own use of MySQL++ has a different name than
>> the corresponding SSQLS.  I am unwilling to give up that feature.
> 
> Explain please. 

I mean that I will define an SSQLS called something like 
SQL_MyTableName, where the actual MySQL table name is something else, 
like my_table_name.  There are several reasons I do this, but it's not 
important to argue them here.  The important point is, I and others 
depend on being able to have C++ structure names that are different from 
the corresponding SQL table names, yet still bind them together via SSQLS.

> In such case IMHO it's possible to declare "TableName" in other way.
> #define TABLE_NAME "TableName"
> Q << "SELECT " << obj.field_list() << " FROM " <<
> TABLE_NAME;

Why would I want to do that?  The whole point of SSQLS is to reduce the 
amount of SQL statements in my C++ code.  This is a regression.
Thread
Problems with timestampКоролев Илья16 Oct
  • Re: Problems with timestampWarren Young17 Oct
    • Re: Problems with timestampКоролев Илья17 Oct
      • Re: Problems with timestampWarren Young17 Oct
        • Re: Problems with timestampКоролев Илья17 Oct
          • Re: Problems with timestampWarren Young17 Oct
            • Re: Problems with timestampКоролев Илья17 Oct
              • Re: Problems with timestampWarren Young17 Oct
                • Re: Problems with timestampКоролев Илья17 Oct
                  • Re: Problems with timestampWarren Young18 Oct
                    • Re: Problems with timestampКоролев Илья18 Oct
                      • Re: Problems with timestampWarren Young18 Oct
                        • Re: Problems with timestampКоролев Илья24 Oct
                          • Re: Problems with timestampWarren Young24 Oct
                            • Re: Problems with timestampКоролев Илья25 Oct
                              • Re: Problems with timestampWarren Young25 Oct
                                • Re: Problems with timestampКоролев Илья20 Nov
                                  • Re: Problems with timestampWarren Young20 Nov