如何在SQLite中为LIMIT启用DELETE? [英] How do you enable LIMIT for DELETE in SQLite?

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

问题描述

使用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中启用LIMIT for DELETE?

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中为LIMIT启用DELETE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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