15.01.2015, 00:21
Hi guys, I have a problem which I don't know how to fix.
I am using SQLite for my business system.
With my command, I am inserting a biz like this
As you can see, the very first one biz will have an ID 1 and then 2 , 3 and so on...
*This is how my Database looks like*
I am using ">>>" only for spaces
>>>>>>|BIZ ID| |OWNER NAME | |TYPE OF BIZ | |ETC|
Row 1>>> 1>>>>>>> Bob>>>>>>>> 1
Row 2>>> 2>>>>>>> John>>>>>>> 1
Row 3>>> 3>>>>>>> Joe>>>>>>>> 3
Row 4>>> 4>>>>>>> Nancy>>>>>> 3
Row 5>>> 5>>>>>>> Alex>>>>>>>> 2
Now, what if I want to delete a row where BIZ ID 3?
Now it looks like this right?
>>>>>>|BIZ ID| |OWNER NAME | |TYPE OF BIZ | |ETC|
Row 1>>> 1>>>>>>> Bob>>>>>>>> 1
Row 2>>> 2>>>>>>> John>>>>>>> 1
Row 3>>> 4>>>>>>> Nancy>>>>>> 3
Row 4>>> 5>>>>>>> Alex>>>>>>>> 2
And now my question is: When I create a biz next time, it will have an ID of 6 and will be inserted after Row 4. How to make it so it creates an ID of 3 and puts it where it belongs, between Row 2 and Row 4?
I hope you understand what I mean.
Regards
I am using SQLite for my business system.
With my command, I am inserting a biz like this
Код:
new ID = SpawnedBiz+1; ... ... format(Query,sizeof(Query),"INSERT INTO `firme` (`IDFirme`,`ImeVlasnika`,`Vrsta`,`KolicinaGorivaNaPumpi`,`NovacUFirmi`,`Cijena`,`EXTX`,`EXTY`,`EXTZ`,`Owned`) VALUES ('%d','Nitko','%d','50','0','%d','%f','%f','%f',0)",ID,Type,cijena,xa,ya,za); db_query( Database, Query ); SpawnedBiz++; ...
*This is how my Database looks like*
I am using ">>>" only for spaces
>>>>>>|BIZ ID| |OWNER NAME | |TYPE OF BIZ | |ETC|
Row 1>>> 1>>>>>>> Bob>>>>>>>> 1
Row 2>>> 2>>>>>>> John>>>>>>> 1
Row 3>>> 3>>>>>>> Joe>>>>>>>> 3
Row 4>>> 4>>>>>>> Nancy>>>>>> 3
Row 5>>> 5>>>>>>> Alex>>>>>>>> 2
Now, what if I want to delete a row where BIZ ID 3?
Now it looks like this right?
>>>>>>|BIZ ID| |OWNER NAME | |TYPE OF BIZ | |ETC|
Row 1>>> 1>>>>>>> Bob>>>>>>>> 1
Row 2>>> 2>>>>>>> John>>>>>>> 1
Row 3>>> 4>>>>>>> Nancy>>>>>> 3
Row 4>>> 5>>>>>>> Alex>>>>>>>> 2
And now my question is: When I create a biz next time, it will have an ID of 6 and will be inserted after Row 4. How to make it so it creates an ID of 3 and puts it where it belongs, between Row 2 and Row 4?
I hope you understand what I mean.
Regards