dbTalk Databases Forums  

Mysql++ list post

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Mysql++ list post in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Urscheler, Roger
 
Posts: n/a

Default Mysql++ list post - 09-28-2006 , 11:22 AM






------_=_NextPart_001_01C6E31A.361762F8
Content-Type: text/plain

Hi,
Can you please post this question:

I have a table 'Person' with column 'age' that allows NULL. How can I use
SSQLS to read that table and return '0' for age if age is 'NULL'?

What type do I need to define in the SSQLS macro to have an integer
nullable. Do I define the SSQLS like this:

typedef mysqlpp::Null<int, mysqlpp::NullisZero> MyIntNull;
sql_create_c_order_2(Person, 1, 2,
string, name, 0,
MyIntNull, age, 1)

When defining age with type int and the age in the database is 'NULL', then
I get a runtime error in Query::storein


Thanks,
Roger


------_=_NextPart_001_01C6E31A.361762F8--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Mysql++ list post - 09-28-2006 , 02:07 PM






Urscheler, Roger (COM Chantry CA) wrote:
Quote:
I have a table 'Person' with column 'age' that allows NULL. How can I use
SSQLS to read that table and return '0' for age if age is 'NULL'?
Search the list: there is a thread about this giving a patch, and an
explanation of why you won't see it in the main distribution anytime
soon. (Short version: you have to break the ABI to fix this, so we
can't do it until v3.0, and there are many other things I want to get to
before that.)

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Jim Wallace
 
Posts: n/a

Default RE: Mysql++ list post - 09-29-2006 , 07:24 AM



You can use COALESCE( age, 0 ) as age to have it return 0 instead of
null in the query. =20

Since SQLSS doesn't support NULL, I never return them, even on outer
joins. Our DBA says NULLable columns are slower anyway in MySQL.=20

-----Original Message-----
From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]=20
Sent: Thursday, September 28, 2006 3:09 PM
To: MySQL++ Mailing List
Subject: Re: Mysql++ list post

Urscheler, Roger (COM Chantry CA) wrote:
Quote:
=20
I have a table 'Person' with column 'age' that allows NULL. How can I=20
use SSQLS to read that table and return '0' for age if age is 'NULL'?
Search the list: there is a thread about this giving a patch, and an
explanation of why you won't see it in the main distribution anytime
soon. (Short version: you have to break the ABI to fix this, so we
can't do it until v3.0, and there are many other things I want to get to
before that.)

--=20
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsu...neva (DOT) com




--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.