Insert A New Value In SQLite

ceaser

Active Member
Licensed User
Hi

I have a problem. I have a Database that consists of Stakevalues & Widths(this is for a road surface)...

0 6.5
1000 7.0
2000 7.0 ............etc.

What I want to do now, is to insert a new Stakevalue & Width between Stakevalue 1000 and Stakevalue 2000....i.e Stakevalue 1600 with a width of 6.5 meters.

The new SQLite Database should then look as follows:

0 6.5
1000 7.0
1600 6.5
2000 7.0

What I do is to sent all the data to an array, sort the array, delete the Database and then copy the array back to the Database. If I have a road that is 200km long and the surface is defined by about 1800 points(Stakevalue & Width) and I use this method, it takes forever! While the handheld is busy with this, I can drink a beer, take the dog for a walk and when I come back it has finally completed the action!:BangHead:

Surely there must be an easier way?:sign0085:

Thanks
Michael
 

agraham

Expert
Licensed User
Longtime User
There is no point in doing this. Databases don't have an intrinsic order, any order is imposed by you using an "ORDER BY" in the SQL statement. You just need to add the new StakeValue to the database. I'm no SQLite expert but you need to investigate how SQLite deals with CREATE INDEX and UNIQUE columns.
 
Top