Re: [sqlite] Bug in division?

2014-04-30 Thread Charles J. Daniels
This is a very common thing. Many programming languages, like C++, do the
same thing. So it's not just a SQL thing.

--charlie

On Wed, Apr 30, 2014 at 7:11 AM, Marc L. Allen
wrote:

> Not an error. Int/Int uses integer division and results in an integer
> number. When one number is a float, the result becomes a float.
>
> I don't know about all SQL varieties, but MSSQL is the same.
>
> > On Apr 30, 2014, at 8:04 AM, "Gene Connor" 
> wrote:
> >
> >
> > SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0
> > SELECT DISTINCT 2/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.01 AS RESULT FROM TABLE;returns 0.49875 (correct)
> > As long as one or both numbers has at least one decimal place, it calcs
> correctly.
> > Verified that it also happens in queries using tables and real data.
> > Windows SQLite version 3.8.4.3 2014-04-03 16:53:12
> >
> > Thanks
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> This email and any attachments are only for use by the intended
> recipient(s) and may contain legally privileged, confidential, proprietary
> or otherwise private information. Any unauthorized use, reproduction,
> dissemination, distribution or other disclosure of the contents of this
> e-mail or its attachments is strictly prohibited. If you have received
this
> email in error, please notify the sender immediately and delete the
> original.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread Petite Abeille

On Apr 30, 2014, at 8:50 PM, Jay Kreibich  wrote:

> Given Oracle’s legacy, it might be that “2” defaults to a “numeric” type, 
> rather than an integer.

Indeed, there are no ‘integer’ type per se in Oracle. At least not at the SQL 
level. But more to the point, I don’t thing the various ANSI standards have 
anything normative to say about  what the result of a division should be, 
merely that there is a division operator. So it’s rather a free for all. Sigh.

FWIW, I personally find Oracle’s behavior more intuitive in that respect. But 
then again, nothing really wrong with how SQLite handles it.

In other news:

http://stilldrinking.org/programming-sucks

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread Rob Richardson
I don't know if it's in the SQL standard or not, but the C, C++ and C# 
languages all act this way.  The result of mathematical operations on integers 
is always an integer.  If you want the result to be a floating-point number, 
you have to force at least one of the operands to be a floating-point number.

RobR
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Problem with ODBC Access via Code

2014-04-30 Thread Leist, Carsten
Hi @all,

I want to link a table of my Database dynamically on runtime. I use the 
following code in my Access2007 DB
Dim tdf As DAO.TableDef

Set tdf = CurrentDb.CreateTableDef("tableName")
tdf.Connect = "ODBC;DRIVER=SQLite3 ODBC Driver;Database=C:\SQLite\MyDB.sqlite;"
tdf.SourceTableName = "LiteTabName"
currentdb.TableDefs.Append tdf

I always get the message "Error -7778;there is no message for this error"

I can link the table using the SQLite3 ODBC, but not with code. The driver and 
the DB seems tob e absolutely ok

I hope some one can help me

Kind regards
Carsten


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread Jay Kreibich




On Apr 30, 2014, at 1:00 PM, Petite Abeille  wrote:
> 
> On Apr 30, 2014, at 2:22 PM, John McKown  wrote:
> 
>> PostgreSQL likewise returns 0 for 2/4 and .5 for 2/4.0 . This is likely a
>> part of the SQL standard.
> 
> Just to be contrarian, Oracle doesn’t and returns 0.5. Ah!
> 


Given Oracle’s legacy, it might be that “2” defaults to a “numeric” type, 
rather than an integer.
 
 -j


--  
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it, but showing 
it to the wrong people has the tendency to make them feel uncomfortable." -- 
Angela Johnson




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread Petite Abeille

On Apr 30, 2014, at 2:22 PM, John McKown  wrote:

> PostgreSQL likewise returns 0 for 2/4 and .5 for 2/4.0 . This is likely a
> part of the SQL standard.

Just to be contrarian, Oracle doesn’t and returns 0.5. Ah!

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] detach failed with error code 1

2014-04-30 Thread dd
I have set busy time out for 5 seconds and given different names for every
attach and detaching database. still, this error is not getting fixed.
prepare, step and finalize are not throwing any errors.

What is the alternative solution for attach and detaching database? Thanks
in advance.


On Sun, Apr 20, 2014 at 9:16 PM, Simon Slavin  wrote:

>
> On 20 Apr 2014, at 12:58pm, dd  wrote:
>
> > Given different database name for in-memory database for every
> > iteration(looped for 1000 times). Still, it's throwing Database Locked at
> > least once on Windows, not on Mac/Linux. Is there any way to track this
> > issue? I am using 3.7.11. Any ideas?
>
> Technically this should not solve the problem, but I'm curious to know.
>
> Have you set a timeout value ?  If not, please set one to at least five
> seconds using either of these:
>
> 
> 
>
> I'm curious to know whether (a) this solves the problem or (b) it makes
> your loop of 1000 take longer.
>
> However, we do seem to still think that the error is in your code
> somewhere rather than in the SQLite library.  Are you checking the result
> returned by all calls for errors, rather than checking just the result
> returned by your DETACH ?  Check the result returned by every single
> _prepare(), _step() and _finalize() and other sqlite_ call in your code.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread John McKown
PostgreSQL likewise returns 0 for 2/4 and .5 for 2/4.0 . This is likely a
part of the SQL standard.


On Wed, Apr 30, 2014 at 7:11 AM, Marc L. Allen
wrote:

> Not an error. Int/Int uses integer division and results in an integer
> number. When one number is a float, the result becomes a float.
>
> I don't know about all SQL varieties, but MSSQL is the same.
>
> > On Apr 30, 2014, at 8:04 AM, "Gene Connor" 
> wrote:
> >
> >
> > SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0
> > SELECT DISTINCT 2/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.01 AS RESULT FROM TABLE;returns 0.49875 (correct)
> > As long as one or both numbers has at least one decimal place, it calcs
> correctly.
> > Verified that it also happens in queries using tables and real data.
> > Windows SQLite version 3.8.4.3 2014-04-03 16:53:12
> >
> > Thanks
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> This email and any attachments are only for use by the intended
> recipient(s) and may contain legally privileged, confidential, proprietary
> or otherwise private information. Any unauthorized use, reproduction,
> dissemination, distribution or other disclosure of the contents of this
> e-mail or its attachments is strictly prohibited. If you have received this
> email in error, please notify the sender immediately and delete the
> original.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Bug in division?

2014-04-30 Thread Marc L. Allen
Not an error. Int/Int uses integer division and results in an integer number. 
When one number is a float, the result becomes a float. 

I don't know about all SQL varieties, but MSSQL is the same. 

> On Apr 30, 2014, at 8:04 AM, "Gene Connor"  wrote:
> 
> 
> SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0
> SELECT DISTINCT 2/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> SELECT DISTINCT 2.0/4 AS RESULT FROM TABLE;returns 0.5 (correct)
> SELECT DISTINCT 2.0/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> SELECT DISTINCT 2.0/4.01 AS RESULT FROM TABLE;returns 0.49875 (correct)
> As long as one or both numbers has at least one decimal place, it calcs 
> correctly.
> Verified that it also happens in queries using tables and real data.
> Windows SQLite version 3.8.4.3 2014-04-03 16:53:12
> 
> Thanks 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Bug in division?

2014-04-30 Thread Gene Connor

SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0
SELECT DISTINCT 2/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
SELECT DISTINCT 2.0/4 AS RESULT FROM TABLE;returns 0.5 (correct)
SELECT DISTINCT 2.0/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
SELECT DISTINCT 2.0/4.01 AS RESULT FROM TABLE;returns 0.49875 (correct)
As long as one or both numbers has at least one decimal place, it calcs 
correctly.
Verified that it also happens in queries using tables and real data.
Windows SQLite version 3.8.4.3 2014-04-03 16:53:12

Thanks
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] When to open/close connections

2014-04-30 Thread Yuriy Kaminskiy
Simon Slavin wrote:
> On 29 Apr 2014, at 2:24pm, Drago, William @ MWG - NARDAEAST 
>  wrote:
> 
>> Does closing the connection force, or at least encourage, the OS to write to 
>> disk whatever it might have been caching?
> 
> Closing a connection calls fclose() on the database file (as long as fopen() 
> was called because at least one operation was done on the database).  So the 
> operating system does everything it would normally do in response to fclose().

No, sqlite does NOT use fopen/fclose, neither on unix, nor on windows, it uses
lower-level interface (open(2)/close(2) on unix). AFAIK, close(2) normally does
not attempt to write/flush/sync anything (it could be more complex with unusual
fs, e.g. NFS, but sqlite is incompatible with NFS anyway). (No idea about MS
Windows specifics).

> This means closing a connection can take a long time because it does lots of 
> things.  For example under Windows/Mac/Unix if the file has been changed it 
> changes the 'last modified' date on the file.  Consequently you would not 
> want to keep opening and closing a connection in a program that made a lot of 
> changes to a SQLite database.

AFAIK, on unix, "last modified" (st_mtime) is updated when write(2) is called,
and not delayed till close(2). (Again, no idea about MS Windows specifics).

I have not instrumented sqlite (and thus could be wrong), but I'd guess only
"expensive" thing in database "connection" close is memory deallocation. On
other hand, database "connection" open is much more expensive, as it requires
re-reading and re-parsing database schema and various other things.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there any reason which use OS file system on default mode?

2014-04-30 Thread Simon Slavin

On 30 Apr 2014, at 8:49am, 김병준  wrote:

> If sqlite3 access storage device directly, I think, it must be faster than 
> using os file system.
> Because using os file system mean there must be some overhead.
> So, I'm curious about the reason why use os file system default.

Would you have to write a hardware driver for each different type of storage 
device ?

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Is there any reason which use OS file system on default mode?

2014-04-30 Thread 김병준
If sqlite3 access storage device directly, I think, it must be faster than 
using os file system.
Because using os file system mean there must be some overhead.
So, I'm curious about the reason why use os file system default.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users