On 14.01.2010 0:08, Maciej Sobczak wrote: > Hello, > > Konstantin Litvinenko wrote: > >> You already implement int and short. What is the difference in unsigned >> int and signed int? It is >> semantical and there is no difference in data representation. SQL doesn't >> have unsigned >> representation, but all signed maps to unsigned directly without any data >> loss. So, why we cannot >> map C++ unsigned int to SQL INTEGER and C++ unsigned short to SQL SHORT? > > Because this is not how the mapping is done. For example, for PostgreSQL > there are native types that are used for mapping instead of SQL types.
And what prevent me to map corresponding types to C++ types? > There is also a mapping in the other direction - for example, if the > database returns something that has type SQL INTEGER, which of the C++ > types should that map to? int or unsigned int? To that type I request. Is it not obvious?! if I write int foo; unsigned int bar; db << "select foo, bar from t limit 1;", into(foo), into(bar); I really do KNOW what I am doing. I KNOW that field foo is in range [-2147483648, +2147483647]. And I want store result to foo variable. I KNOW that field bar is in range [0, 4294967295]. And I want store result in bar. I KNOW that if bar will exceed [-2147483648, +2147483647] SQL INTEGER range I will get an error. So if I need more I will do use long long. More over you do support unsigned long. What is corresponding SQL type for that? What is corresponding PostgreSQL type? In PostgreSQL backend you don't check field type - just check that it can be parsed and fitted into numeric_limit bounds. Why not just do the same for unsigned int or short? Again. What prevents adding support of unsigned short and unsigned int as first citizen in SOCI? ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
