如何通过 PHP 对 SQLite 数据库执行 .dump? [英] How do I perform a .dump on SQLite database through PHP?

查看:18
本文介绍了如何通过 PHP 对 SQLite 数据库执行 .dump?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从 sqlite3 数据库中获取命令行函数 .dump 的结果,但是通过 PHP.具体来说,我使用 Zend_Db.

I need to get the results of the command line function .dump from an sqlite3 database, but through PHP. Specifically, I am using Zend_Db.

是否可以通过数据库适配器调用 .dump 命令?如果没有,是否有解决方法,这比提取每个表模式、每一行并编写自己的输出更简单?

Is it possible to call the .dump command through the database adapter? If not, is there a work around, that is simpler than pulling each table schema, each row and write my own output?

我曾尝试简单地将 .dump 作为查询运行,但出现一般语法错误.

I have tried simply running .dump as a query, but I get a general syntax error.

推荐答案

SQLite3 .dump 命令是命令外壳的一部分,而不是数据库库本身的一部分.

The SQLite3 .dump command is part of the command shell, and not part of the database library itself.

请参阅 SQLite 的命令行外壳页面上的 sqlite3 的特殊命令 部分

See the section Special commands to sqlite3 on the page Command Line Shell For SQLite

你能做到这一点的唯一方法是通过 PHP exec()

The only way you can do this is via PHP exec()

这篇关于如何通过 PHP 对 SQLite 数据库执行 .dump?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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