[TriLUG] Yet another c++ question

Steve Kuekes steve at kuekes.homeip.net
Tue Nov 15 11:29:00 EST 2005


I think your key needs to be stored in the database and let the database 
automatically handle it for you. For SQLServer you need to create the 
table with a column with the IDENTITY attribute.  This tells SQLServer 
to automatically populate the field with a unique value and increment it 
according to your definition (you don't have to increment by 1 if you 
don't want to).  MYSQL had the same type of thing its just called 
AUTOINCREMENT.  You can even have the IDENTITY column start its counter 
at other than zero so you can move your data in and start where your 
registry key leaves off.

Having the database handle this even handles multiple programs inserting 
rows into the database at the same time.  After you insert each row you 
can read the value the database assigned to the field by using "SELECT 
@@IDENTITY".


Mark Freeze wrote:
> I do store my records in a SQLServer database that I am going to be
> moving to MySql.  Thanks for the info on the Oracle system.  That may
> influence my databasing decisions when I get to that step.
> 
> I think Phillip has hit a little closer to what I am looking for, but
> I still was looking for a different solution.
> 
> My Windows system has a key stored in the registry with one value.
> Which lets say for examples sake is 16E360. (Or 1.5 million.)  My VB
> program would get this value and then assign my first record the
> unique key of 16E361, then the next 16E262, etc... until the program
> gets to the eof of the text file currently being processed.  At eof,
> the VB program writes the last assigned keys value back to the
> registry to wait until the program needs more unique values. This week
> I processed 149,893 records, so the registry value would now be
> 192CE5.
> 
> I know Linux doesn't have a registry so I am looking for a more secure
> way of keeping track of this value other than just writing it to a
> file somewhere on the disk.  If writing this value to a file is the
> only way to keep track of it, what are some methods that I could
> employ to secure the file so that it is not deleted, lost,
> overwritten, or tampered with but still remains open enough where any
> user could run the program?
> 
> Thanks,
> Mark.
> 
> 
> On 11/15/05, Dave Sorenson <dave at logicalgeek.com> wrote:
> 
>>I second the database idea. Having the registry hold mission critical
>>data would scare the bejebus outta me seeing how often my windows gaming
>>box decides to scramble its registry. Databases are made for this and
>>even MySQL could handle a million or 2 statements without too much
>>trouble. Oracle has released 10g in a no cost form, some restriction
>>apply, but it might work well as well. See:
>>http://www.oracle.com/corporate/press/2005_oct/103105_databasexe_finalsite.html.
>>I'm going to be installing on my test server and play with it and see if
>>it can be useful.
>>
>>Dave S.
>>
>>Phillip Rhodes wrote:
>>
>>>On 11/15/05, Mark Freeze <mfreeze at gmail.com> wrote:
>>>
>>>
>>>>My question is this: What would be the best way on a Linux system to
>>>>keep track of this unique key identifier? Or is there a better way to
>>>>accomplish this task? I chose to write it to the Windows registry with
>>>>VB so it wouldn't get deleted from the disk, it was not easily
>>>>tampered with by users of the program, and really, it was just one
>>>>less file that I had to keep up with. Having the key off by even one
>>>>record could potentially catastrophic. I keep these files forever and
>>>>I process and print around 1 million statements per month.
>>>>
>>>
>>>
>>>I probably just don't understand your process well enough to comment,
>>>but it seems to me like it might be easier to just pump the data into
>>>an RDBMS as step 1 and then rely on the facilities the RDBMS
>>>provides for doing a lot of this other stuff... Is there a specific reason
>>>why that isn't an option?
>>>
>>>Failing that, Linux has no registry per se, so you'd probably just have
>>>to write your key values out to a file somewhere, or store the keys in an
>>>RDBMS.
>>>
>>>
>>>TTYL,
>>>
>>>Phil
>>>
>>
>>--
>>TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
>>TriLUG Organizational FAQ  : http://trilug.org/faq/
>>TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>>

-- 
Steve Kuekes

Insight Racing http://www.insightracing.org
Private Pilot: N9259R '95 Saratoga based at Sanford-Lee County Regional 
(TTA)
email: skuekes at nc.rr.com



More information about the TriLUG mailing list