Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Darren Duncan
Patrick Earl wrote: > On Sat, Mar 26, 2011 at 10:03 PM, Darren Duncan > wrote: >> You could store your exact precision numbers as a pair of integers >> representing >> a numerator/denominator ratio and then have math operators that work on these >> pairs like they were one number. You would the

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
On Sat, Mar 26, 2011 at 10:03 PM, Darren Duncan wrote: > You could store your exact precision numbers as a pair of integers > representing > a numerator/denominator ratio and then have math operators that work on these > pairs like they were one number.  You would then know at the end how to move

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
If you use a view to return a double, you've lost the exact value you were trying to save by storing the decimal as a text value. If you continue to work with it as an integer, it's exact, but that requires continual awareness of the number of decimal places at any point in time. In essence, you

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Darren Duncan
Patrick Earl wrote: > That is true, but then when you are formulating generic queries within > a place such as an ORM like NHibernate, you would need to figure out > when to translate the user's "100" into "1". As well, if you > multiplied numbers, you'd need to re-scale the result. For examp

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread BareFeetWare
On 27/03/2011, at 2:09 PM, Patrick Earl wrote: > if you're in a context where you don't have significant understanding of the > user's query, how do you determine if 1.05 is $1.05 or 105%? Can you give us a bit more background and an example of this? How is the interface for the query represent

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
You're right, it doesn't make sens to multiply dollars, but if you're in a context where you don't have significant understanding of the user's query, how do you determine if 1.05 is $1.05 or 105%? I understand that one can custom-code everything for SQLite and get reasonable results in some cases

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread BareFeetWare
> On Sat, Mar 26, 2011 at 8:15 PM, BareFeetWare > wrote: >> Can you store all money amounts as integers, as the cents value? That is >> exact, searchable etc. On 27/03/2011, at 1:27 PM, Patrick Earl wrote: > That is true, but then when you are formulating generic queries within > a place such

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Gerry Snyder
Do money values really get multiplied together? What is the meaning of square cents as a unit? Gerry On 3/26/11, Patrick Earl wrote: > That is true, but then when you are formulating generic queries within > a place such as an ORM like NHibernate, you would need to figure out > when to translat

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
That is true, but then when you are formulating generic queries within a place such as an ORM like NHibernate, you would need to figure out when to translate the user's "100" into "1". As well, if you multiplied numbers, you'd need to re-scale the result. For example, (1 * 1) would be (100 *

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread BareFeetWare
On 27/03/2011, at 12:39 PM, Patrick Earl wrote: > Base-10 numbers are frequently used in financial calculations because > of their exact nature. SQLite forces us to store decimal numbers as > text to ensure precision is not lost. Unfortunately, this prevents > even simple operations such as retr

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
I've found the decimal numbers to be most generally useful in narrow ranges. For reference, here are a couple notes on how other databases implement them: MSSQL stores up to 38 digits in 17 bytes, with a specific precision. http://msdn.microsoft.com/en-us/library/aa258832(v=sql.80).aspx Post

[sqlite] SQLite & NHibernate

2011-03-26 Thread Patrick Earl
Greetings. I'm a committer for NHibernate who has been working on improving the support for SQLite. I've been able to get most of the over 3000 tests passing on SQLite. Kudos to Richard and the team for producing such an impressive little database. I wanted to share with you the main limitation

Re: [sqlite] Lack of "decimal" support

2011-03-26 Thread Simon Slavin
On 27 Mar 2011, at 2:39am, Patrick Earl wrote: > Base-10 numbers are frequently used in financial calculations because > of their exact nature. SQLite forces us to store decimal numbers as > text to ensure precision is not lost. Unfortunately, this prevents > even simple operations such as retr

[sqlite] Lack of "decimal" support

2011-03-26 Thread Patrick Earl
Base-10 numbers are frequently used in financial calculations because of their exact nature. SQLite forces us to store decimal numbers as text to ensure precision is not lost. Unfortunately, this prevents even simple operations such as retrieving all rows where an employee's salary is greater tha

Re: [sqlite] Full Table Scan after Analyze

2011-03-26 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/26/2011 03:12 AM, Black, Michael (IS) wrote: > When you say "All an index does" don't forget that an index is also usually > smaller than the data, thereby increase cache performance and reducing disk > seeks. That is muddied in the case (prob

Re: [sqlite] Full Table Scan after Analyze

2011-03-26 Thread Black, Michael (IS)
When you say "All an index does" don't forget that an index is also usually smaller than the data, thereby increase cache performance and reducing disk seeks. For a good chunk of typical uses (large tables with simple lookups) an index is notably faster. I'll admit my use of sqtlite3 hasn't

Re: [sqlite] Full Text Search

2011-03-26 Thread Sumesh KS
Hi, Thanks for help. Sumesh. On Sat, Mar 26, 2011 at 1:48 PM, Dan Kennedy wrote: > On 03/26/2011 02:18 PM, Sumesh KS wrote: >> Hi, >> >> I am Sumesh, student from india. I currently doing a project using qt >> and sqlite. I want to implement Full Text Search in that project. >> Anyone please te

Re: [sqlite] Full Text Search

2011-03-26 Thread Dan Kennedy
On 03/26/2011 02:18 PM, Sumesh KS wrote: > Hi, > > I am Sumesh, student from india. I currently doing a project using qt > and sqlite. I want to implement Full Text Search in that project. > Anyone please tell me, from where i start to learn FTS and it's > working and how it is implemented. htt

[sqlite] Full Text Search

2011-03-26 Thread Sumesh KS
Hi, I am Sumesh, student from india. I currently doing a project using qt and sqlite. I want to implement Full Text Search in that project. Anyone please tell me, from where i start to learn FTS and it's working and how it is implemented. regards, Sumesh.