Home » U++ Library support » U++ SQL » Sql .sch / Date (moved)
Sql .sch / Date (moved) [message #35379] |
Wed, 08 February 2012 15:42 |
|
ratah
Messages: 107 Registered: July 2010
|
Experienced Member |
|
|
Hello all,
I experiment with SQL schema / SqlId and apply it with MySQL database.
Here is my shema file
TABLE_(matable)
INT_ (ID) PRIMARY_KEY
STRING_ (SubscripDate, 20)
END_TABLE
and the CREATE statement in MySQL database
DROP TABLE IF EXISTS `mabase`.`matable`;
CREATE TABLE `mabase`.`matable`
(
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`SubscripDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Here is a bit of my code where I use an instance of Time.
SQL * Select(SqlCountRows()).From(matable).Where(ID == id && SubscripDate == Time(2012,1,5));
My question is how to correctly write a schema file (TIME_?? DATE_??) with sqlid of type Date or Time?
Because when I query data from MySQL like this
SQL * Select(SubscripDate).From(matable).Where(ID == id)
if(SQL.Fetch())
{
Cout() << SQL[0];
}
that prints me 00/00/ 0 00:00:00 instead of 00/00/0000 00:00:00
I precise I use
SetDefaultCharset(CHARSET_UTF8);
SetLanguage( LNG_('F','R','F','R') );
in my MAIN function.
I know it is not supported by Sqlite but very usefull for other databases MySQL, Oracle,...
Thanks,
RAtah
|
|
|
Goto Forum:
Current Time: Sun Apr 28 04:23:41 CEST 2024
Total time taken to generate the page: 0.03536 seconds
|