作者:苏小明2602896955 | 来源:互联网 | 2023-05-19 15:45
WhenIrunthiscode:当我运行此代码时:requiresqlite3dbSQLite3::Database.new:memory:db.execut
When I run this code:
当我运行此代码时:
require 'sqlite3'
db = SQLite3::Database.new ":memory:"
db.execute 'CREATE TABLE foo (bar TEXT);'
db.execute 'INSERT INTO foo VALUES ("baz");'
db.execute 'SELECT * FROM foo WHERE bar="baz"'
db.close
I get nothing. Normally in SQLite when I run:
我一无所获。通常在SQLite中运行时:
create table foo (bar TEXT);
insert into foo values ("baz");
select * from foo;
I get:
我明白了:
bar
----------
baz
Why does this happen and how can I get the exact same result?
为什么会发生这种情况?如何才能获得完全相同的结果?
1 个解决方案