Did you try this?
create table each_transaction(datetime text);
insert into each_transaction(datetime) values(datetime('now'));
D:\temp\convention>sqlite3 test.db
SQLite version 3.0.8
Enter ".help" for instructions
sqlite> create table each_transaction(datetime text);
sqlite> insert into each_transaction(datetime) values(datetime('now'));
sqlite> select * from each_transaction;
2005-02-01 18:30:26
sqlite>
--- teoh <[EMAIL PROTECTED]> wrote:
> nope. reader.getint32(0) will return 0
>
> i tried changed datetime to "text" and did the query
> by getsring(0) and i get same invalid output
>
> output:
> á "
>
> i still cant use strftime('%s', 'now') .
>
>
>
>
>
>
>
> --- [EMAIL PROTECTED] wrote:
>
> > teoh <[EMAIL PROTECTED]> writes:
> >
> > > create table each_transaction(datetime int);
> > >
> > > insert into each_transaction values(
> > datetime('%s',
> > > 'now'));
> > >
> > > this is how I create table and insert the
> > > strftime('%s', 'now'). But when I did query with
> > > sql3_plus.
> > >
> > > sqlite3::reader reader=con.executereader("select *
> > > from each_transaction;");
> > > while(reader.read())
> > > {cout << reader.getcolname(0) << ": " <<
> > > reader.getstring(0) << endl; }
> > >
> > >
> > > I get output like this:
> > >
> > > datetime: á " <- invalid
> > >
> > >
> > > Any idea? coz If I change to
> > > datetime('now','localtime');
> > > everything is ok. I only cannot use strftime('%s',
> > > 'now') for "insert" statement.
> >
> > It appears that you are getting back an integer but
> > not displaying it as an
> > integer. You have declared datetime as an integer
> > in your CREATE TABLE
> > statement. (Maybe you wanted to declare it as
> > TEXT?) I haven't used C++ with
> > sqlite. Can you do reader.getint(0) instead of
> > reader.getstring(0)?
> >
> > Derrell
> >
>
>
>
>
>
> __
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail
>
=
-
"Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on the walls of
the ancient tomb of the petrified pharaoh, he vowed there would be no curse on
him like on that other Lord, unless you count his marriage to Lady Tarlington
who, when the lost treasure was found, will be dumped faster than that basket
in the bulrushes."
Melissa Rhodes
-
The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's
Call
http://www.lulu.com/content/77264
__
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250