8 messages in com.mysql.lists.plusplusanother question
FromSent OnAttachments
Королев Илья16 Oct 2006 05:50 
Warren Young16 Oct 2006 17:28 
Королев Илья18 Oct 2006 00:53 
Королев Илья18 Oct 2006 01:41 
Joel Fielder18 Oct 2006 01:45 
Королев Илья18 Oct 2006 01:53 
Joel Fielder18 Oct 2006 01:53 
Королев Илья18 Oct 2006 06:17.patch
Subject:another question
From:Королев Илья (bre@begun.ru)
Date:10/18/2006 12:53:25 AM
List:com.mysql.lists.plusplus

Hello all

I tried to create such SSQLS

sql_create_XXX( DB_AdvDaily, 3, 0, OID, user_id, OID, campaign_id, mysqlpp::sql_datetime, ts, ... );

And I've got errors:

/usr/include/mysql++/stream2string.h: In function 'Strng
mysqlpp::stream2string(const T&) [with Strng = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, T =
mysqlpp::DTbase<mysqlpp::DateTime>]': /usr/include/mysql++/datetime.h:61: instantiated from
'mysqlpp::DTbase<T>::operator std::string() const [with T = mysqlpp::DateTime]' ../../../include/table_types/stat_advdaily.h:18: instantiated from 'int
sql_compare_DB_AdvDaily(const DB_AdvDaily&, const DB_AdvDaily&) [with
mysqlpp::sql_dummy_type dummy = sql_dummy]' ../../../include/table_types/stat_advdaily.h:18: instantiated from here /usr/include/mysql++/stream2string.h:47: error: 'const struct
mysqlpp::DTbase<mysqlpp::DateTime>' has no member named 'out_stream'

it thrilled me, and I've used ssqls-pretty to study the problem. I've got:

template <mysqlpp::sql_dummy_type dummy> int sql_compare_DB_AdvDaily (const
DB_AdvDaily &x, const DB_AdvDaily &y) { int cmp; if ((cmp = mysqlpp::sql_cmp(x.user_id , y.user_id ))) return cmp; if ((cmp = mysqlpp::sql_cmp(x.campaign_id , y.campaign_id ))) return cmp; return mysqlpp::sql_cmp(x.ts , y.ts ); }

As I can see, to compare to SSQLS we convert them into strings? Isn't it too
complicate? I guess it may look like:

template <mysqlpp::sql_dummy_type dummy> int sql_compare_DB_AdvDaily (const
DB_AdvDaily &x, const DB_AdvDaily &y) { if ( x.user_id < y.user_id ) return -1; else if ( x.user_id > y.user_id ) return 1; else if (x.campaign_id < y.campaign_id ) return -1; else if (x.campaign_id > y.campaign_id ) return 1; else if( x.ts < y.ts ) return -1; else if( x.ts > y.ts ) return 1; else return 0; }