[sqlite] authenticating user before allosw to use sql_lite?

2005-02-15 Thread teoh
hi , Is it possible to prompt user for username and
password before allow to use database like in mysql?



__ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


Re: [sqlite] bogus output for strftime('%s', 'now')

2005-02-01 Thread teoh
nope. that doesnt work either.  i got no problem
outputing other recoard. but got problem with 
strftime('%s', 'now')

--- Jeff Thompson <[EMAIL PROTECTED]> wrote:

> On Tue, 1 Feb 2005 06:51:49 -0800 (PST), teoh
> <[EMAIL PROTECTED]> wrote:
> >
> > 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
> > 
> 
> This is a guess since I'm not familiar with
> sql3_plus, but it looks
> like you may be printing the pointer to the
> character string instead
> of the string itself... If reader.getstring(0)
> returns a std::string,
> try the following:
> 
> cout << reader.getcolname(0) << ": " <<
> reader.getstring(0).c_str() << endl;
> 
> -- 
> Jeff Thompson
> [EMAIL PROTECTED]
> 




__ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


Re: [sqlite] bogus output for strftime('%s', 'now') ermm..

2005-02-01 Thread teoh
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


Re: [sqlite] bogus output for strftime('%s', 'now') .errm..

2005-02-01 Thread teoh
what i trying to say is, i cant use  strftime('%s',
'now') but also to use other function like
datetime('now') . This is because the output of select
will be invalid. if i use datetime('now') . the output
is 2005-02-01 15:44:23 . How does the "select"
statement should look like if i want it to show only
records before 2005-01-01 0:0:00 ? i believe that is
impossible if I unable to use  strftime('%s', 'now') .


please comment. thank you.



--- Jay <[EMAIL PROTECTED]> wrote:

> 
> Does this fix it?
>  insert into each_transaction(datetime)
> values(datetime('now'));
> 
> 
> --- teoh <[EMAIL PROTECTED]> wrote:
> 
> > 
> > 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.
> > 
> > I tried out the pre-compiled command-prompt sqlite
> but
> > doesn't faced with this problem. The sql_lite that
> i'm
> > using to do the above test was static lib compiled
> by
> > me using dev-cpp. I even tried out linking
> directly
> > with .dll but the result still the same,
> unexpected
> > output. 
> > 
> > thakn you for reading and clarifying my mistake.
> > 
> > 
> > 
> > 
> > 
> > 
> > __ 
> > Do you Yahoo!? 
> > Yahoo! Mail - Helps protect you from nasty
> viruses. 
> > 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!? 
> Meet the all-new My Yahoo! - Try it today! 
> http://my.yahoo.com 
>  
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


[sqlite] bogus output for strftime('%s', 'now')

2005-02-01 Thread teoh

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.

I tried out the pre-compiled command-prompt sqlite but
doesn't faced with this problem. The sql_lite that i'm
using to do the above test was static lib compiled by
me using dev-cpp. I even tried out linking directly
with .dll but the result still the same, unexpected
output. 

thakn you for reading and clarifying my mistake.






__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail


Re: [sqlite] sqlite search by "DATE" range ?

2005-01-27 Thread teoh
does that mean. i just create  "timedate int" in sql.
and use  unixepox to store the date+time inside it.
and query it using unixepox for range ?

select * from table1 where timedate >=
unixepox_number1 and timedate <= unixepox_number2;

is this correct? thank you.



--- [EMAIL PROTECTED] wrote:

> teoh <[EMAIL PROTECTED]> writes:
> 
> > does anyone knows algorithm use to quote date
> range?  
> > let say, user wants to quote for result from
> > 20-12-2004 until 14-1-2005 ?(dd-mm-)
> 
> This page contains all of the information about
> supported date and time
> functions in SQLite:
> 
>
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
> 
> You'll probably want to save your dates as a single
> number for ease of
> manipulation and comparison.  If all you care about
> are dates (i.e. without
> associated times during the day), then you can use
> the Julian day number, "%J"
> in the strftime() documentation.  If you need times
> as well, then a convenient
> format may be the Unix epoch value, the number of
> seconds since 1970-01-01 at
> midnight, "%s" in strftime().
> 
> Derrell
> 





__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail


[sqlite] sqlite search by "DATE" range ?

2005-01-27 Thread teoh
 hi,  i created  

date_year smallint,date_month smallint, date_day
smallint, time text  in  sqlite database.

does anyone knows algorithm use to quote date range?  
let say, user wants to quote for result from
20-12-2004 until 14-1-2005 ?(dd-mm-)

thank you for clarifying. 



__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail