I want to save and read XSDL file to/from database. Is it possible?
Smile introduces readfile() to load XSDL file from disk. How can it read from a database? Is there any other readfile function available?
Thank you very much!
How to read file from database?
Re: How to read file from database?
Hi,
The SMILE library does not have the ability to read from a database directly.
In general, you would have to implement that yourself (in your own code) and, using the SMILE library, construct the DSL_network object from what you have read from your database.
Are you storing whole xdsl files in your database?
If so, maybe you can read it from your db, create a temporary file and then read it with SMILE.
Best,
Martijn
The SMILE library does not have the ability to read from a database directly.
In general, you would have to implement that yourself (in your own code) and, using the SMILE library, construct the DSL_network object from what you have read from your database.
Are you storing whole xdsl files in your database?
If so, maybe you can read it from your db, create a temporary file and then read it with SMILE.
Best,
Martijn
Re: How to read file from database?
Hi Martijn,
Thank you very much! I think your suggestions are right. If SMILE only have the readfile() function to obtain XDSL file, it is a good idea to save a temp file and then use readfile();
Actually, I wanted to use database to save hundreds of XSDL files to improve computing performance and reduce file count in disk. Now, I think it is no necessary to use database.
Thank you!
Young
Thank you very much! I think your suggestions are right. If SMILE only have the readfile() function to obtain XDSL file, it is a good idea to save a temp file and then use readfile();
Actually, I wanted to use database to save hundreds of XSDL files to improve computing performance and reduce file count in disk. Now, I think it is no necessary to use database.
Thank you!
Young
Re: How to read file from database?
Hi,
Just my two cents
It would be great to have a SMILE function which could get the data from a stream instead of a file. You can always open a file as a stream but you cannot load your data from a custom source (i.e. encoded XDSL file stored on disk / in memory / database).
Kind Regards,
Piotr
Just my two cents

Kind Regards,
Piotr
-
- Site Admin
- Posts: 1445
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to read file from database?
Streaming XDSL files is definitely implementable within reasonable time/cost range, with stream defined as a very simple abstract class with 2 or 3 methods. User's application would have to provide the derived stream class reading the actual bytes from database, memory, cloud or any serializable data source.orzech wrote:Just my two centsIt would be great to have a SMILE function which could get the data from a stream instead of a file. You can always open a file as a stream but you cannot load your data from a custom source (i.e. encoded XDSL file stored on disk / in memory / database).
Other file formats are legacy and depend heavily on stdio.
Re: How to read file from database?
Hi,
Thank you for your response. That would be absolutely great. But even easier, it would be totally sufficient to provide a method which reads XDSL file from an array of raw bytes instead of a file path. This way the user's application could read from any source, store and preprocess data in the memory and then pass it to SMILE for loading.
Cheers,
Piotr
Thank you for your response. That would be absolutely great. But even easier, it would be totally sufficient to provide a method which reads XDSL file from an array of raw bytes instead of a file path. This way the user's application could read from any source, store and preprocess data in the memory and then pass it to SMILE for loading.

Cheers,
Piotr
shooltz wrote:Streaming XDSL files is definitely implementable within reasonable time/cost range, with stream defined as a very simple abstract class with 2 or 3 methods. User's application would have to provide the derived stream class reading the actual bytes from database, memory, cloud or any serializable data source.orzech wrote:Just my two centsIt would be great to have a SMILE function which could get the data from a stream instead of a file. You can always open a file as a stream but you cannot load your data from a custom source (i.e. encoded XDSL file stored on disk / in memory / database).
Other file formats are legacy and depend heavily on stdio.
-
- Site Admin
- Posts: 1445
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to read file from database?
Current SMILE release supports this feature with DSL_network::ReadString and DSL_network::WriteString.orzech wrote:But even easier, it would be totally sufficient to provide a method which reads XDSL file from an array of raw bytes instead of a file path.
Re: How to read file from database?
That's great! I need to check this out. 
