[Maria-discuss] Read/Write file
![](https://secure.gravatar.com/avatar/868ea20e42a639c1e3c837f7e609f250.jpg?s=120&d=mm&r=g)
Hi, How to read/write a text file from a MariaDb routine ? Is this possible only via tables (loading via Load data infile or using connect engine..)? Thanks
![](https://secure.gravatar.com/avatar/39b623a1559cf9c69ac3d9d4fb44e7fe.jpg?s=120&d=mm&r=g)
Hi, Ghazi! On Mar 12, Ghazi Btissam wrote:
Hi,
How to read/write a text file from a MariaDb routine ? Is this possible only via tables (loading via Load data infile or using connect engine..)?
No, there is also LOAD_FILE function: https://mariadb.com/kb/en/mariadb/load_file/ Regards, Sergei Chief Architect MariaDB and security@mariadb.org
![](https://secure.gravatar.com/avatar/392856b43200ef35060b655747853c7c.jpg?s=120&d=mm&r=g)
Hi, There is no programmatic way to read a file line by line and write a file line by line. You could write a udf to do so. You can take a look at http://github.com/Fastbit_UDF if you like. fb_query() writes to CSV files and fb_inlist reads a one column file and turns it into an CSV list for use with IN predicates. You could construct a read_line udf and write_line udf that take a file name and offset as the first two params. If you really need such a set of UDF I can write and test them for a consulting fee. Contact me if you are interested. Sent from my iPhone
On Mar 12, 2016, at 5:13 AM, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Ghazi!
On Mar 12, Ghazi Btissam wrote: Hi,
How to read/write a text file from a MariaDb routine ? Is this possible only via tables (loading via Load data infile or using connect engine..)?
No, there is also LOAD_FILE function: https://mariadb.com/kb/en/mariadb/load_file/
Regards, Sergei Chief Architect MariaDB and security@mariadb.org
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
participants (3)
-
Ghazi Btissam
-
Justin Swanhart
-
Sergei Golubchik