round ?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

round ?

Nicolas Martin-7
Some strange effect of the round expression :

sqlite> select round(1-0.5);
0
sqlite> select round(2-0.5);
2
sqlite> select round(3-0.5);
2
sqlite> select round(4-0.5);
4
sqlite> select round(5-0.5);
4
sqlite> select round(6-0.5);
6
sqlite>





Reply | Threaded
Open this post in threaded view
|

RE: round ?

Damian Slee
I tried it on windows for you.   sqlite3.exe v3.21

sqlite> select round(1-0.5);
1
sqlite> select round(2-0.5);
2
sqlite> select round(3-0.5);
3
sqlite> select round(4-0.5);
4
sqlite> select round(5-0.5);
5
sqlite> select round(6-0.5);
6

Maybe the math libarary on the C compiler you are using?
 

-----Original Message-----
From: Nicolas Martin [mailto:[hidden email]]
Sent: Thursday, July 28, 2005 2:37 PM
To: [hidden email]
Subject: [sqlite] round ?

Some strange effect of the round expression :

sqlite> select round(1-0.5);
0
sqlite> select round(2-0.5);
2
sqlite> select round(3-0.5);
2
sqlite> select round(4-0.5);
4
sqlite> select round(5-0.5);
4
sqlite> select round(6-0.5);
6
sqlite>






--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005
 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005
 
Reply | Threaded
Open this post in threaded view
|

Commit and Rollback

Marco Bambini
In reply to this post by Nicolas Martin-7
I need to know when a commit or a rollback is executed, I know that I  
can use the sqlite_commit_hook routine to be notified of a commit  
command, but what about rollback?
Is there a way to know (or to be notified) when a rollback happens?

Thanks a lot for your help,
Marco Bambini

Reply | Threaded
Open this post in threaded view
|

Re: round ?

Nicolas Martin-7
In reply to this post by Damian Slee
My version in sqlite3 v3.22 on freebsd5.4
I will check on Windows on the same computer.


Damian Slee wrote:

>I tried it on windows for you.   sqlite3.exe v3.21
>
>sqlite> select round(1-0.5);
>1
>sqlite> select round(2-0.5);
>2
>sqlite> select round(3-0.5);
>3
>sqlite> select round(4-0.5);
>4
>sqlite> select round(5-0.5);
>5
>sqlite> select round(6-0.5);
>6
>
>Maybe the math libarary on the C compiler you are using?
>
>
>-----Original Message-----
>From: Nicolas Martin [mailto:[hidden email]]
>Sent: Thursday, July 28, 2005 2:37 PM
>To: [hidden email]
>Subject: [sqlite] round ?
>
>Some strange effect of the round expression :
>
>sqlite> select round(1-0.5);
>0
>sqlite> select round(2-0.5);
>2
>sqlite> select round(3-0.5);
>2
>sqlite> select round(4-0.5);
>4
>sqlite> select round(5-0.5);
>4
>sqlite> select round(6-0.5);
>6
>sqlite>
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: round ?

D. Richard Hipp
In reply to this post by Nicolas Martin-7
On Thu, 2005-07-28 at 08:37 +0200, Nicolas Martin wrote:
> Some strange effect of the round expression :
>
> sqlite> select round(1-0.5);
> 0
> sqlite> select round(2-0.5);
> 2

See http://www.sqlite.org/cvstrac/tktview?tn=1316.  The
problem results from inconsistent behavior in platform
printf() functions.  The fix was for SQLite to always use
it's own internal printf() function.
--
D. Richard Hipp <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: round ?

Nicolas Martin-7
Oops,
i didn't check cvstrack
Many thanks !
Nicolas
D. Richard Hipp wrote:

>On Thu, 2005-07-28 at 08:37 +0200, Nicolas Martin wrote:
>  
>
>>Some strange effect of the round expression :
>>
>>sqlite> select round(1-0.5);
>>0
>>sqlite> select round(2-0.5);
>>2
>>    
>>
>
>See http://www.sqlite.org/cvstrac/tktview?tn=1316.  The
>problem results from inconsistent behavior in platform
>printf() functions.  The fix was for SQLite to always use
>it's own internal printf() function.
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: Commit and Rollback

Edwin Knoppert
In reply to this post by Marco Bambini
And i wish for a test if the transaction is already set or not, without
using a callback.
Even better, nested tranactions would be the best.
:)



----- Original Message -----
From: "Marco Bambini" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, July 28, 2005 9:24 AM
Subject: [sqlite] Commit and Rollback


>I need to know when a commit or a rollback is executed, I know that I  can
>use the sqlite_commit_hook routine to be notified of a commit  command, but
>what about rollback?
> Is there a way to know (or to be notified) when a rollback happens?
>
> Thanks a lot for your help,
> Marco Bambini
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Commit and Rollback

Will Leshner

On Jul 28, 2005, at 4:29 AM, Edwin Knoppert wrote:

> And i wish for a test if the transaction is already set or not,  
> without using a callback.
>

You already can:

"
   int sqlite3_get_autocommit(sqlite3*);
Test to see whether or not the database connection is in autocommit  
mode. Return TRUE if it is and FALSE if not. Autocommit mode is on by  
default. Autocommit is disabled by a BEGIN statement and reenabled by  
the next COMMIT or ROLLBACK.

"