IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Circular Tables
Jetty
post 30. Jan 2009, 04:55
Post #1


new Member
*

Group: Members
Posts: 4
Joined: 30.01.2009
Member No.: 89
LV Version: 8.6
Zertifizierung: keine



Greetings:

I stumbled across ADO-Tools while searching for an easy way to implement a SQL database into my labview project. Thanks for putting the time and effort into developing this!

Eventually I'd like to port my application over to an embedded system that has rather limited memory (at least by PC standards). The question I have been pondering is how to setup a table that will only grow to a predetermined size (number of rows) and then start writing at the beginning again. I'm using an auto index field as the primary key and would like that to remain unique for each entry even after the "wrap-around".

The way it stands now, my tables will grow infinitely, eventually filling all of the available storage, and presumably crash the system.

Any examples of this or leads in the right direction would be greatly appreciated.

Jetty
Go to the top of the page
 
+Quote Post
CB
post 30. Jan 2009, 08:04
Post #2


proven Member
****

Group: Administrators
Posts: 315
Joined: 16.10.2006
From: Düsseldorf
Member No.: 2
LV Version: current
Zertifizierung: CLA
LV User seit: 2001



QUOTE (Jetty @ 30. Jan 2009, 05:55) *
Greetings:

I stumbled across ADO-Tools while searching for an easy way to implement a SQL database into my labview project. Thanks for putting the time and effort into developing this!

Eventually I'd like to port my application over to an embedded system that has rather limited memory (at least by PC standards). The question I have been pondering is how to setup a table that will only grow to a predetermined size (number of rows) and then start writing at the beginning again. I'm using an auto index field as the primary key and would like that to remain unique for each entry even after the "wrap-around".

The way it stands now, my tables will grow infinitely, eventually filling all of the available storage, and presumably crash the system.

Any examples of this or leads in the right direction would be greatly appreciated.

Jetty


hummm ...
as far as I know there is no build in mechanism to limit a table size to a certain ammount of kb or rows, but if I had to implement this I'd do it the folowing way:

after each insert statement I'd put a select statement, which counts the number of rows in the table, e.g.
CODE
SELECT COUNT(id_col_name) as rowcnt, MIN(id_col_name) as startid, MAX(id_col_name) as stopid FROM your_table_name

to find out how many rows are allready in the table, what's the minimum ID and what's the max ID

After that I'd check whether the amount of rows in my table is bigger than the amount I'd like to have, and if this happens I'd add an DELETE-Statement, and delete some rows, e.g your maxid=12 your minid=7, rowcount=6 and you'd like to have only 4 rows in the table, the delete Statement would be:
CODE
DELETE FROM your_table_name WHERE id_col_name<10


The big question mark is: If you use a Delete Statement, the data aren't physically deleted, but just marked as deleted. To free the disc space normally you have to call "compress and repair"command from the Access Tools Menu. You'll have to find out, if you can call this command through ActiveX and compress the database, then this plan could work ...


--------------------
künstliche Intelligenz ist besser als natürliche Dummheit!
rotabench:rotierende Prüfstände nach dem Baukasten-Prinzip
Go to the top of the page
 
+Quote Post
Jetty
post 30. Jan 2009, 21:12
Post #3


new Member
*

Group: Members
Posts: 4
Joined: 30.01.2009
Member No.: 89
LV Version: 8.6
Zertifizierung: keine



Thanks for the response. I'll have to give what you suggested some thought. Not sure about the specifics of compressing the database though. Something I'll have to look into.

Digging into some of the specifics about ADO properties and methods, I found there are ADO properties and methods that let users move around within the records in a data source. Since I'm a real newbie when it comes to relational databases, I not sure if you can just move around in a recordset when retrieving information or if you can also do it when writing. I guess what I ultimately want to do is when the record pointer reaches a certain row, I'd like to "repoint" it back to the top. I'm also uncertain if these commands can be sent to the database with the ADO-Toolkit.

Jetty
Go to the top of the page
 
+Quote Post
CB
post 30. Jan 2009, 22:21
Post #4


proven Member
****

Group: Administrators
Posts: 315
Joined: 16.10.2006
From: Düsseldorf
Member No.: 2
LV Version: current
Zertifizierung: CLA
LV User seit: 2001



QUOTE (Jetty @ 30. Jan 2009, 22:12) *
Thanks for the response. I'll have to give what you suggested some thought. Not sure about the specifics of compressing the database though. Something I'll have to look into.

Digging into some of the specifics about ADO properties and methods, I found there are ADO properties and methods that let users move around within the records in a data source. Since I'm a real newbie when it comes to relational databases, I not sure if you can just move around in a recordset when retrieving information or if you can also do it when writing. I guess what I ultimately want to do is when the record pointer reaches a certain row, I'd like to "repoint" it back to the top. I'm also uncertain if these commands can be sent to the database with the ADO-Toolkit.

Jetty


no, movin around in recordsets with cursors etc is not implemented in the ado toolkit ...


--------------------
künstliche Intelligenz ist besser als natürliche Dummheit!
rotabench:rotierende Prüfstände nach dem Baukasten-Prinzip
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 29.03.2024 - 08:50