Permalink
Browse files

update sqlite3 1.2.5 -> 1.3.5

  • Loading branch information...
1 parent cc41771 commit 0f387e6cb6bece388158e5c452ddaa926e2c7a3c @mzp mzp committed Jan 22, 2012
Showing with 12 additions and 8 deletions.
  1. +2 −2 Gemfile.lock
  2. +1 −1 atig.gemspec
  3. +9 −5 lib/atig/db/followings.rb
View
@@ -6,7 +6,7 @@ PATH
net-irc
oauth
rake
- sqlite3-ruby (~> 1.2.5)
+ sqlite3 (>= 1.3.2)
GEM
remote: http://rubygems.org/
@@ -24,7 +24,7 @@ GEM
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
- sqlite3-ruby (1.2.5)
+ sqlite3 (1.3.5)
PLATFORMS
ruby
View
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = Atig::VERSION
- gem.add_dependency 'sqlite3-ruby', ['~> 1.2.5']
+ gem.add_dependency 'sqlite3', ['>= 1.3.2']
gem.add_dependency 'net-irc', ['>= 0']
gem.add_dependency 'oauth', ['>= 0']
@@ -70,6 +70,10 @@ def may_notify(mode, xs)
end
end
+ def bool(b)
+ if b then 1 else 0 end
+ end
+
def update(users)
@db.execute do|db|
may_notify :join, users.select{|u|
@@ -90,25 +94,25 @@ def update(users)
may_notify :mode, users.select{|u|
exists?(db,
"screen_name = ? AND (protected != ? OR only != ?)",
- u.screen_name, u.protected, u.only)
+ u.screen_name, bool(u.protected), bool(u.only))
}
users.each do|user|
id = db.get_first_value('SELECT id FROM users WHERE user_id = ? LIMIT 1', user.id)
if id then
db.execute("UPDATE users SET screen_name = ?, protected = ?, only = ?, data = ? WHERE id = ?",
user.screen_name,
- user.protected,
- user.only,
+ bool(user.protected),
+ bool(user.only),
@db.dump(user),
id)
else
db.execute("INSERT INTO users
VALUES(NULL, :screen_name, :user_id, :protected, :only, :data)",
:screen_name => user.screen_name,
:user_id => user.id,
- :protected => user.protected,
- :only => user.only,
+ :protected => bool(user.protected),
+ :only => bool(user.only),
:data => @db.dump(user))
end
end

0 comments on commit 0f387e6

Please sign in to comment.