如何在Android中将数据从sqlite导出到csv文件 [英] How to export data from sqlite to csv file in Android

查看:177
本文介绍了如何在Android中将数据从sqlite导出到csv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在开发一个简单的Android应用程序,其中数据将从sqlite导出到csv。请解释这是怎么做的?



谢谢提前



Neeraj Rathi

Hi I am developing simple an Android app where data will be export from sqlite to csv.Please explain how this can do?

Thanks in advance

Neeraj Rathi

推荐答案

导出数据库的命令行版本具有以下语法。< br $>


The command line version of the export database has the following syntax.

sqlite_export_cmd -database DATABASE -output FILENAME -table TABLENAME [-mode MODE]
sqlite_export_cmd -database DATABASE -output FILENAME -sql SQLCOMMAND  [-mode MODE]
sqlite_export_cmd -help





可用参数:



-database DATABASE:SQLite数据库的名称。

-output FILENAME:输出文件的文件名。

-table TABLENAME:要导出的表的表名。

-sql SQLCOMMAND:自定义sql命令

-mode模式:输出f ormat,可选。

如果没有提供模式,程序会根据文件名的扩展名猜对。

以下是MODE的不同值。

制表符:制表符分隔文件

csv:命令分隔文件

xls:Excel文件

html:一个html文件

屏幕:在屏幕上显示结果



-help:如果提供参数-help,有关用法的信息是打印。





请参考 LINK 需要安装Android代码将SQLite数据库以CSV格式转储到SD卡上的文件中。



Available parameters:

-database DATABASE : The name of the SQLite database.
-output FILENAME : The filename of the output file.
-table TABLENAME : Table name of the table to be exported.
-sql SQLCOMMAND : A custom sql command
-mode MODE : The output format, optional.
If mode is not provided, the program will guess the right based on the extension of the filename.
Following are the diffrent values for MODE.
tabs: A tab separated file
csv : A command separated file
xls : An Excel file
html: A html file
screen: Show results on screen

-help : If parameter -help is provided, information about the usage is printed.


Please refer this LINK for android code required to dump an SQLite database to a file on the SD card in CSV format.


这篇关于如何在Android中将数据从sqlite导出到csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆