Manual .csdb generation

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
jalsola
Posts: 6
Joined: February 3rd, 2021, 4:56 pm
Location: Panamá

Manual .csdb generation

Post by jalsola »

Hello everyone, a question about the files generated by the Cs Entry.
The .csdb files can be generated in any way manually? This question is because I have an application that connects to a server and the transfer of the .csdb files is very heavy. What I need to do is save only the data from the .csdb files so that the sending is lighter and if I need to download that data, the application generates the .csdb file to open the CsEntry.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: Manual .csdb generation

Post by aaronw »

Are you using the syncdata function to synchronize the data contained in a CSDB file?
https://www.csprousers.org/help/CSPro/s ... ction.html

CSDB files allow for "smart" sync'ing. That is after uploading the initial data, subsequent uploads will only include cases that have changed. This will make them lighter.
jalsola
Posts: 6
Joined: February 3rd, 2021, 4:56 pm
Location: Panamá

Re: Manual .csdb generation

Post by jalsola »

Thanks for the reply, but it's really not what I'm looking for. I specifically want to know if there is any way to generate a .csdb file manually. For example, have a json and with that generate a .csdb file. What I have been able to do is pull the information that is in a .csdb and convert it to a json but I cannot find a way to do it vice versa now. In the following link they put code java of how to do it.
https://stackoverflow.com/questions/257 ... te-to-json
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Manual .csdb generation

Post by josh »

Since the csdb file is an sqlite database you could theoretically convert it to JSON and then convert it back. There are libraries to write SQLite databases from Java. You can open the csdb file in one of the free SQLite viewers to see what it looks like and base your code on that. However, if you use the built in synchronization in CSPro as Aaron suggests then CSPro does that all for you. In fact, CSPro converts the data to JSON, sends it to the server where it is stored. Then you when you download the data from the server it converts it back into a csdb. If you want to see the JSON format that CSPro uses you can sync your data file to Dropbox or to an FTP server and then look at the files that it generates. These files are gzipped JSON.

If you really want to do your own data transfer then you might consider using the text data format rather than csdb. Those files are smaller since they don't contain the history needed for synchronization and it does not contain the indexes that the SQLite databases. Another alternative is to drop the indexes in the csdb file before transferring it. That will make it smaller. Then you could recreate them later.
Post Reply