Re: [sqlite] Storing monetary values and calculations

2007-08-14 Thread Mikey C
s stores fixed point numbers in > ASCII display format and performs accurate artithmetic and presents > nicely from HTML. > > Floating point numbers for money is a perennial trap for young players. > > Mikey C wrote: >> Hi there, >> >> Currently I am using a

[sqlite] Storing monetary values and calculations

2007-08-13 Thread Mikey C
Hi there, Currently I am using a SQLite 3.x database that stores and calculates currency values using the column type NUMERIC (which I believe has a FLOAT affinity). However this leads to errors in storing values values in floating point representation. I guess there is no planned support for d

[sqlite] Implementation of ANSI SQL-92 FOREIGN KEY and referential integrity

2007-08-02 Thread Mikey C
Hi, Does anyone know if there is a plan to implement the enforcement of the SQL-92 FOREIGN KEY constraints? Seems to me the No.1 missing feature. After all, data integrity, even in an embedded DB is very important and bugs in client code can easily mess up the referential integrity. Does appea

Re: [sqlite] I Need database fot some test

2007-03-06 Thread Mikey C
Here is a database http://www.nabble.com/file/6997/Northwind.db Northwind.db It is an exact SQLite implementation of the well known Microsoft Northwind sample that can be found for MS Access and SQL Server. -- View this message in context: http://www.nabble.com/I-Need-database-fot-some-test-

[sqlite] Backing up a SQlite database

2007-02-09 Thread Mikey C
This might be a dumb question, but is taking a backup of a live database simply a matter of copying the file to a backup device/drive? And restoring it a matter of copying it back? I am using Windows with NTFS drives. -- View this message in context: http://www.nabble.com/Backing-up-a-SQlite

[sqlite] DRH - Future of SQLite?

2007-02-09 Thread Mikey C
May I ask what the dev plan is for SQLIte? For example, out of the missing SQL-92 features, what is likely to be implemented first to complete the standard? I would like to see referential integrity natively enforced No.1 and then support for stored procedures with cached query plans. Thanks,

Re: [sqlite] Extension functions for SQLite in C for free

2007-02-07 Thread Mikey C
No problem, attached is the raw source code, no binaries. Ralf Junker wrote: > > Hello Mikey C, > >>If anyone is having problems downloading the file (which is large as it >>contains debug & release binaries and all the obj files), please email me at >>[EMAIL

Re: [sqlite] Extension functions for SQLite in C for free

2007-02-07 Thread Mikey C
ey. > > On 2/6/07, Mikey C <[EMAIL PROTECTED]> wrote: >> >> >> Hi, >> >> I've had these functions hanging around for some time. They are not >> fully >> tested and come with no warranty of fitness, but if anyone wants the >

[sqlite] Extension functions for SQLite in C for free

2007-02-06 Thread Mikey C
Hi, I've had these functions hanging around for some time. They are not fully tested and come with no warranty of fitness, but if anyone wants the code, please take it. I have all the code as a MS Visual Studio 2003 project. It is based on source code 3.3.5 abs(X) Return the absolute value of

Re: [sqlite] Extra functions - New Project?

2006-10-23 Thread Mikey C
I entirely agree. I had the functions coded because I needed them for my own project. I never intended to do the other 85% of the work required to make them a supported part of SQLite. drh wrote: > > Mikey C <[EMAIL PROTECTED]> wrote: >> >> I sent the source co

Re: [sqlite] Extra functions - New Project?

2006-10-20 Thread Mikey C
Hi Rohit. I sent the source code to DRH with the extra functions. I don't myself have the time now to incorporate the extra functions into SQLite. I don't know if DRH plans to add the extra functions. If he does not and he doesn't mind, I am happy to send the source code to anyone that is inte

Re: [sqlite] Optimistic concurrency control

2006-09-19 Thread Mikey C
henever data changes? I could implement is with a trigger on each table BUT it would be nice if SQLite supported this natively. Anyhow, I get from the tone of the answers that this is not likely to happen, so I'll code it up myself. Cheers, Mike Christian Smith-4 wrote: > > Mikey C utter

[sqlite] Optimistic concurrency control

2006-09-19 Thread Mikey C
What are peoples thoughts on implementing optimistic concurrency control in SQLite? One way is modify the where clause to compare every column being updated, old value to new value. This makes the SQL cumbersome. Microsoft SQL Server has a column data type named TIMESTAMP/ROWVERSION which is da

[sqlite] Partial indexes

2006-08-23 Thread Mikey C
Any plans to support partial indexes in SQLite? http://en.wikipedia.org/wiki/Partial_index http://db.cs.berkeley.edu/papers/ERL-M89-17.pdf PostgreSQL supports them and they seem very useful. -- View this message in context: http://www.nabble.com/Partial-indexes-tf2151623.html#a5941879 Sent f

[sqlite] How does sqlite3_column_type work?

2006-08-03 Thread Mikey C
Hi, I've got a weird one. I'm using the ADO.NET wrapper and this makes two calls in order to determine a column affinity. First it calls sqlite3_column_decltype and if this returns null it calls sqlite3_column_type 99.% of the time this works great. However I have a piece of SQL that UNIO

[sqlite] sum(a+b) vs sum(a) + sum(b)

2006-07-31 Thread Mikey C
Is there any performance or other gain in writing: select sum(column_a) + sum(column_b) vs select sum(column_a + column_b) ??? -- View this message in context: http://www.nabble.com/sum%28a%2Bb%29-vs-sum%28a%29-%2B-sum%28b%29-tf2027991.html#a5577196 Sent from the SQLite forum at Nab

Re: [sqlite] Compressing the DBs?

2006-07-06 Thread Mikey C
Not sure what you mean there DRH, but I set compression on one of my database files on NTFS and file size shrunk from 1,289,216 bytes to 696,320 bytes. And of course the whole compression / decompression process is completely transparent to SQLite and if you decide that compression is a bad thin

Re: [sqlite] Compressing the DBs?

2006-07-05 Thread Mikey C
What platform are you using? If you are using NTFS filesystem you can just mark the file for compression and the OS takes care of it transparently. -- View this message in context: http://www.nabble.com/Compressing-the-DBs--tf1897195.html#a5190175 Sent from the SQLite forum at Nabble.com.

[sqlite] Is this query correct?

2006-06-22 Thread Mikey C
select avg((select 100 union select 200)) Returns 100 I would have expected 150? Am I being thick or is it a bug? -- View this message in context: http://www.nabble.com/Is-this-query-correct--t1829679.html#a4991615 Sent from the SQLite forum at Nabble.com.

Re: [sqlite] suggesiton needed for using SQL lite in a situation

2006-06-22 Thread Mikey C
One things to bear in mind is will you need to query data across all users? Perhaps a report or some stats for all users? If so, this is much more problematic if you have one DB per user, since you would need to ATTACH all the separate files to enable the query to work. A single DB file, such r

Re: [sqlite] Delete performance vs. Insert performance

2006-06-21 Thread Mikey C
Might be obvious but make sure you do all your inserts and deletes within a single transaction as I believe this has a big impact on performance. Might bring the insert and delete times closer. -- View this message in context: http://www.nabble.com/Delete-performance-vs.-Insert-performance-t1823

[sqlite] Index usage

2006-06-20 Thread Mikey C
Hi, I just wanted to ask for confirmation that my understanding on how the query optimiser works is correct. SQLite only uses one index for each table in a FROM? What if tables are joined? Does an index get used for each joined table? So if I have SELECT * FROM A INNER JOIN B ON A.COL1 = B

Re: [sqlite] WHERE clause syntax error

2006-06-17 Thread Mikey C
Something like: SELECT A.ID FROM A LEFT JOIN B ON A.ID = B.ID WHERE B.ID IS NULL Might be more efficient? -- View this message in context: http://www.nabble.com/WHERE-clause-syntax-error-t1801701.html#a4912687 Sent from the SQLite forum at Nabble.com.

Re: [sqlite] SQLite Vs VistaDB - Comparison ???

2006-06-16 Thread Mikey C
Okay I know very little about these things, but the fact that Access/JET MDB files are serverless (it's just a bunch of Windows dll's) in the same way as SQLite, and that JET implements row and table level locking means I guess it is possible. If it meant losing ACID compliance, then no, forget a

Re: [sqlite] SQLite Vs VistaDB - Comparison ???

2006-06-16 Thread Mikey C
MS Access (MDB files) use the Jet engine. Not every PC has the correct drivers, since jet has changed many times as Access evolved from version 2.0 thru 95, XP and 2003. Access is NOT ACID compliant, is limited in maximum database size, is limited to 255 connections. http://www.somacon.com/p369

[sqlite] integrity error

2006-06-09 Thread Mikey C
One of my databases reports the following error, although in practice the database seems fine: *** in database main *** Page 101 is never used Any ideas/suggestions? Is this something to worry about? Can it be "fixed"? Cheers, Mike -- View this message in context: http://www.nabble.com/inte

Re: [sqlite] Extra functions - New Project?

2006-06-09 Thread Mikey C
Cool, I all ready have the code for a library of functions working with SQLite V3.3.5 source. This has been integrated into the SQLite code at compile time using conditional compilation. Math functions: acos asin atan atn2 atan2 acosh asinh atanh degrees radians cos sin tan cot cosh sinh tanh

[sqlite] case insensitive joins and comparisons

2006-06-05 Thread Mikey C
What is the best/most efficient way to perform comparisons or joins on data where case sensivitiy is not important? e.g join two tables where the primary and foreign key values have different case? Best to use Like or upper() or Lower() or some other way of ignoring case? Thanks, Mike -- View

Re: [sqlite] OffTopic: Locking on Windows XP

2006-06-01 Thread Mikey C
Don't know if this helps: http://support.microsoft.com/kb/Q296264 Looks like you need to turn optimistic locking off. Same is true with MS Access if the file is located on a share. http://support.microsoft.com/default.aspx?scid=KB;EN-US;q300216&; -- View this message in context: http://www.na

[sqlite] What's planned in the next major release of SQLite?

2006-05-31 Thread Mikey C
Anyone know where SQLite is going? Is there a roadmap for features? -- View this message in context: http://www.nabble.com/What%27s+planned+in+the+next+major+release+of+SQLite--t1711756.html#a4647686 Sent from the SQLite forum at Nabble.com.

[sqlite] Compiler optimisations

2006-05-31 Thread Mikey C
Just a note for anyone interested, I originally took the Windows DLL 3.3.5 and benchmarked a particular query. Takes 2.4 seconds on a reasonable dataset. Took the src, compiled up in VS.NET 2003, with lots of speed optimisations, Pentium 4 and above, SSE on etc. Same query takes 1.6 seconds, so

[sqlite] RE: .NET bindings or Csharp wrapper

2006-05-31 Thread Mikey C
I use the Finisar src (taken from CVS so it has all the latest bug fixes), .NET 1.1 SP1 and SQLite 3.3.5 (compiled up myself from source with compiler speed and pentium 4 optimisations on) and have no issues at all. But your mileage may vary. -- View this message in context: http://www.nabble.

Re: [sqlite] .NET bindings or Csharp wrapper

2006-05-31 Thread Mikey C
For .NET 1.1 this works quite well. http://sourceforge.net/projects/adodotnetsqlite I use this on many projects. Works for me using SQLite 3.3.5 I have the full source if you want it, including some bug fixes. For .NET 2.0 there is this: http://sqlite.phxsoftware.com/ Never used it but beli

Re: [sqlite] LIMIT and paging records

2006-05-29 Thread Mikey C
I don't think you really understand what I'm trying to say. Web based systems require paging that does not iterate through all records. What is required is a means to LIMIT the results read from the database but at the same time know how many records WOULD have been returned if the query was not

[sqlite] LIMIT and paging records

2006-05-29 Thread Mikey C
Hi, I think this has been discussed before, but I can't find a good solution so I'll post it again to see what people think. Here's the problem. I have a large number of records in a table, which contains many columns. Hence a large amount of data. I have a SQL query that filters the results

Re: [sqlite] Relative query cost

2006-05-27 Thread Mikey C
Thanks Marco, I'll take a look and if it compares well to may current favourite GUI http://www.kraslabs.com/sqlite_analyzer.php I'll be buying a copy! If you feel up to the challenge, perhaps you can convert the output of the explain statement into a graphical tool, SQL Server style. -- View th

[sqlite] Relative query cost

2006-05-27 Thread Mikey C
Hi, Does anyone know of a tool that can use the output of the explain statement to produce something akin to: http://www.nldelphi.com/artimages/sqls38.jpg Which is what MS SQL Server gives. When developing queries it would be good to see how different queries compare in terms of relative cost

[sqlite] last_insert_rowid()

2006-05-27 Thread Mikey C
Hi, Does last_insert_rowid() return the identity of the main insert or would it return the id of a row inserted by a trigger if the main insert caused a 2nd insert to occur on another table via a trigger? SQL Server has a scope_identity() function to make sure you can get the original id regardl

Re: [sqlite] Extra functions - New Project?

2006-05-25 Thread Mikey C
These are the functions that I tend to have implemented: Numeric Functions: Sqrt Floor Ceiling Sign Pi - constant function 3.141.. ACos ASin ATan Atn2 Cos Cot Degrees Exp Log Log10 Power Radians Sin Square Tan String Functions: Charindex Patindex Left Right LTrim RTrim Trim Replicate Rever

Re: [sqlite] Extra functions - New Project?

2006-05-25 Thread Mikey C
With some assistance I intend to implement pretty much all the SQL Server 2000 arithmetic and string functions into SQLite 3 codebase as well as a few others, such as aggregates for StdDev and Variance. I will then release the source under the same license as SQLite itself. If anyone has any com

Re: [sqlite] SQLite under mono

2006-05-25 Thread Mikey C
http://www.mono-project.com/SQL_Lite -- View this message in context: http://www.nabble.com/SQLite+under+mono-t1680769.html#a4558894 Sent from the SQLite forum at Nabble.com.

Re: [sqlite] Extra functions - New Project?

2006-05-24 Thread Mikey C
Roberto-10 wrote: > > On 24/05/06, Christian Smith <[EMAIL PROTECTED]> wrote: >> Attach a patch to the ticket that implements your new functions. Send >> your >> declaration of dedication of the code to the public domain to the list, >> and hope DRH includes the patch in the next release. > > I

Re: [sqlite] Extra functions - New Project?

2006-05-24 Thread Mikey C
I would rather add these functions directly to the core SQLite DLL in C in and compile them directly into the code (using a conditional). For example on the web I found an example of adding a sign() function: /* ** Implementation of the sign() function */ static void signFunc(sqlite3_context *co

Re: [sqlite] Extra functions - New Project?

2006-05-24 Thread Mikey C
Thanks for the response. I did think of this, but this is a pain since: 1. I am using the Finisar ADO.NET provider and to do this these functions would need to be registered every time the database connection is opened and closed and I don't want to have to mess with the ADO.NET provider code.

[sqlite] Extra functions - New Project?

2006-05-24 Thread Mikey C
Hi, I am in need of some new SQL functions and wanted to ask advice on the best way to integrate these functions into SQLite 3. I am not a proficient C coder unfortunately. I have compiled the source for 3.5.5 using Visual Studio.NET 2003 and all works fine. I have added a couple of simple func

Re: [sqlite] Integer / Numeric calculations

2006-05-22 Thread Mikey C
Ah, thanks for that tip. I did not know SQLite had a REAL column type. I thought there were basically CHAR, VARCHAR, NUMERIC and INTEGER types. Mike -- View this message in context: http://www.nabble.com/Integer+-+Numeric+calculations-t1661126.html#a4502144 Sent from the SQLite forum at Nabble

Re: [sqlite] Integer / Numeric calculations

2006-05-22 Thread Mikey C
Thanks for taking the time John, It does not seem to matter what the underlying column type is defined at, SELECT 42 / 9 will always return an integer division. I fool SQLite by always adding 0.00 to my numbers incase they happen to be integer values in that row, SELECT (col1 + 0.00) / (col2 +

[sqlite] Integer / Numeric calculations

2006-05-21 Thread Mikey C
Hi, This is my 1st post here. I hope someone can help. I've been using SQlite for about a year and so far very impressed. Trouble is the typeless nature when doing simple maths on the columns. I have two columns, rating and votes, both declared as NUMERIC. I wan't to calculate the average ra