如何在 SQLite 中为 DELETE 启用 LIMIT?

How do you enable LIMIT for DELETE in SQLite?(如何在 SQLite 中为 DELETE 启用 LIMIT?)
本文介绍了如何在 SQLite 中为 DELETE 启用 LIMIT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 PHP,我有一个简单的数据库,可以存储具有相同内容的多个项目.我想在使用 DELETE 时删除第一次出现的实例.

Using PHP, I have a simple database that may store multiple items with the same content. I want to delete the first occurrence of an instance when I use DELETE.

如何在使用 PHP 的 SQLite 中为 DELETE 启用 LIMIT?

How do you enable LIMIT for DELETE in SQLite using PHP?

推荐答案

您无法在 PHP 中启用这些选项,您需要自己编译 SQLite 才能启用这些选项.重要的是,您需要从 SQLite 下载页面<下载完整版,而不是合并版源代码./a>.

You cannot enable these options from within PHP, you need to compile SQLite yourself in order to enable these options. Importantly, you need to download the full version, not the amalgamation source release from SQLite download page.

如果您使用的是 Unix,请获取 sqlite-3.6.20.tar.gz tarball 并下载它.然后:

If you're on Unix, get the sqlite-3.6.20.tar.gz tarball and download it. Then:

tar xzf sqlite-3.6.20.tar.gz
cd sqlite-3.6.20
export CFLAGS='-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1'
./configure
make

然后您将拥有 sqlite3 命令行实用程序和 .libs 子目录中的库文件.

Then you'll have the sqlite3 command-line utility and the library files in the .libs subdirectory.

这篇关于如何在 SQLite 中为 DELETE 启用 LIMIT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

FastAPI + Tortoise ORM + FastAPI Users (Python) - Relationship - Many To Many(FastAPI+Tortoise ORM+FastAPI用户(Python)-关系-多对多)
Window functions not working in pd.read_sql; Its shows error(窗口函数在pd.read_sql中不起作用;它显示错误)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
(Closed) Leaflet.js: How I can Do Editing Geometry On Specific Object I Select Only?((已关闭)Leaflet.js:如何仅在我选择的特定对象上编辑几何图形?)
in sqlite update trigger with multiple if/Case Conditions(在具有多个IF/CASE条件的SQLite UPDATE触发器中)
Android: Why is Room so slow?(Android:为什么Room这么慢?)