database without external file lazarus / 16-Databases ---------------------------------------------------------------------- azaky · 2012-01-16 13:55 I want to make a database that is editable without the need of any external files. Is there any option to make it? ---------------------------------------------------------------------- User137 · 2012-01-16 14:28 So basically you want to modify the executable while it's running? I don't really know any database or storage method that isn't stored in a separate file somewhere. Even when using Windows registry it is a file in the end, but less visible one. ---------------------------------------------------------------------- JanRoza · 2012-01-16 14:48 And using a modifying-itself program file I think antivirus programs will have a field day. Program files shouldn't be modified, data should be separate from your program (my humble opinion). How do you plan to upgrade your program when a user already is using the older version for some time without loosing his data? ---------------------------------------------------------------------- azaky · 2012-01-16 14:59 hmm, so it is impossible to do so? Actually I always wonder how, for example, those mini games which (apparently) only have a single executable file, but it can save things such as highscores. I thought lazarus can do the same thing. ---------------------------------------------------------------------- JuhaManninen · 2012-01-16 16:03 Quote from: azaky on January 16, 2012, 03:59:10 pmhmm, so it is impossible to do so? Actually I always wonder how, for example, those mini games which (apparently) only have a single executable file, but it can save things such as highscores. I thought lazarus can do the same thing. Those games can make a hidden file to user's home directory or they can use Windows registry. You could do the same. A program can also store user's profile data to a server through internet connection. Juha ---------------------------------------------------------------------- fredycc · 2012-01-16 16:05 Many times the file is created when you launch the application on any current user's path also has hidden attributes, sometimes if the game is through a login before you download a file with the most recent game items or cookies if they are web applications like JuhaManninen suggest you, if we talk about data sets could be in a single XML file only. Regards ---------------------------------------------------------------------- azaky · 2012-01-16 16:43 thanks for the replies guys! I am very new in programming with lazarus, so I don't know so much about databases. btw making files invisible is a good idea, but how to set that file to be invisible? ---------------------------------------------------------------------- TurboRascal · 2012-01-16 17:04 Also remember that you should not store data in the program directory unless really necessary. Doing that essentially makes the program unusable for limited users, and is a bad practice. ---------------------------------------------------------------------- Leledumbo · 2012-01-17 04:48 Quotehow to set that file to be invisible?under *nix: start the filename with . (dot) under windows: change the hidden attribute to true ---------------------------------------------------------------------- azaky · 2012-01-17 11:16 Quote from: Leledumbo on January 17, 2012, 05:48:04 amQuotehow to set that file to be invisible?under *nix: start the filename with . (dot) under windows: change the hidden attribute to true Do you mean by setting the file properties? After googling, I found that it can be done with FileSetAttr. But now I have another problem. Each time I want to retrieve data from hidden files, it always returns RunError(5). Should I set the file to be not hidden each time I want to read it? ---------------------------------------------------------------------- Leledumbo · 2012-01-17 15:17 http://www.freepascal.org/docs-html/user/userap4.html See error code 5. QuoteShould I set the file to be not hidden each time I want to read it?It shouldn't be the problem, but worth trying.