Tag: sqlite3

SQLite3不支持外键约束吗?

我有一个SQLITE3的问题。 我已经使用以下SQL脚本创build了2个表persons和orders : sqlite> create table Persons( P_Id int primary key, LastName varchar, FirstName varchar, Address varchar, City varchar ); sqlite> create table Orders( O_Id int NOT NULL, OrderNo int NOT NULL, P_Id int, PRIMARY KEY (O_Id), FOREIGN KEY (P_Id) REFERENCES Persons(P_Id) ); sqlite> insert into Orders values(1,77895,3); sqlite> select * from Orders; 1|77895|3 sqlite> […]

强制Python放弃原生sqlite3并使用(安装的)最新的sqlite3版本

我试图摆脱的错误消息是: AttributeError:'sqlite3.Connection'对象没有属性'enable_load_extension' 我'easy_install'-ed最新的sqlite3版本和python莫名其妙地知道它在那里,因为sqlite3.version_info产生3.6.13。 在这个版本中,连接应该有'enable_load_extension'属性。 我认为是python仍然使用原生sqlite3模块,我认为是2.4.1自sqlite3.version(iso sqlite3.version_info)产生2.4.1。 问题是我如何强制python的所有sqlite3调用使用新的sqlite3模块?

sqlite3并发访问

SQLite是否安全地处理多个进程从同一个数据库读取/写入的并发访问? 有没有平台的例外呢?

将数据从一个SQLite数据库复制到另一个

我有两个SQLite数据库与普通的数据,但目的不同,我想避免重新插入数据,所以我想知道是否有可能从一个数据库复制到另一个整个表?

string比较时如何设置Sqlite3不区分大小写?

我想通过string匹配从sqlite3数据库中selectlogging。 但是如果在where子句中使用'=',我发现sqlite3区分大小写。 谁能告诉我如何使用string比较不区分大小写?

sqlite3.ProgrammingError:提供的绑定数量不正确。 目前的声明使用1,并提供了74

def insert(array): connection=sqlite3.connect('images.db') cursor=connection.cursor() cnt=0 while cnt != len(array): img = array[cnt] print(array[cnt]) cursor.execute('INSERT INTO images VALUES(?)', (img)) cnt+= 1 connection.commit() connection.close() 我无法弄清楚为什么这是给我的错误,我试图插入的实际string是74个字符长,它是:“/ gifs /史诗 – 失败 – 照片 – 我 – 固定 – 它 – 噢人 – -tire-压力,low.gif” 我试图在插入之前str(array [cnt]),但同样的问题正在发生,数据库只有一列,这是一个TEXT值。 我已经呆了好几个小时了,我不知道是怎么回事。

带有“列表”条目的SQL表与每个条目有一行的SQL表

我有一个Sqlite表,其中每一行的forms是: value, "a,b,c,d,e,f,g,h,i,j", value3, value4 在我的查询查找值的配对, %b%使用LIKE 。 在查询时间方面更有效率,而不是有一个表,其中每一行是一个排列: value, a, value3, value4 … value, j, value3, value4 所以我的查询现在值,b这次使用=运算符。 作为一个说明,我感兴趣的用例有大约10,000行,每个“list”元素平均有8个条目。 我标记Sqlite和MySQL因为我有一个与MySQL和Sqlite的数据库类似的问题。

无法加载这样的文件 – 在rails上的sqlite3 / sqlite3_native(LoadError)

我是Ruby on Rails的新手。 当我尝试在ruby 2.0.0上使用rails 4.0.0设置服务器的基本安装和启动时,我遇到了上面的错误信息。 我怎样才能避免这个错误消息,并进一步进行? 完整的错误消息: /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file — sqlite3/sqlite3_native (LoadError) from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>' from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' from […]

使用Sqlite3部署RoR应用程序到Heroku失败

我正在尝试将我的第一个应用程序部署到Heroku。 我使用Sqlite作为数据库。 据我所知Heroku不使用Sqlite – 它在后台切换到Postgres。 当我部署时,我得到以下错误: /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in`require':no such file to load – sqlite3(LoadError) 我的gemfile(这是我认为是造成这个问题)看起来如下所示: source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' 我究竟做错了什么?

SQLiteencryption/密码保护

我只是学习使用SQLite,我很好奇,如果这是可能的: 数据库文件的encryption? 密码保护数据库的开放? PS。 我知道有这个“SQLiteencryption扩展(SEE)”,但根据文档,“SEE是许可软件….”和“SEE的永久源代码许可证的成本是2000美元”。