minor: removed entraneous constant

This commit is contained in:
Kyle Banker 2009-12-02 11:56:58 -05:00
parent d39169530a
commit 992f6c30dc
4 changed files with 7 additions and 9 deletions

View File

@ -14,11 +14,9 @@ begin
raise LoadError if CBson::VERSION != Mongo::VERSION raise LoadError if CBson::VERSION != Mongo::VERSION
require 'mongo/util/bson_c' require 'mongo/util/bson_c'
BSON = BSON_C BSON = BSON_C
BSON_SERIALIZER = CBson
rescue LoadError rescue LoadError
require 'mongo/util/bson_ruby' require 'mongo/util/bson_ruby'
BSON = BSON_RUBY BSON = BSON_RUBY
BSON_SERIALIZER = BSON
warn "\n**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance." warn "\n**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance."
warn " You can install the extension as follows:\n gem install mongo_ext\n" warn " You can install the extension as follows:\n gem install mongo_ext\n"
warn " If you continue to receive this message after installing, make sure that the" warn " If you continue to receive this message after installing, make sure that the"

View File

@ -218,7 +218,7 @@ module Mongo
message.put_int(0) message.put_int(0)
BSON_RUBY.serialize_cstr(message, "#{@db.name}.#{@name}") BSON_RUBY.serialize_cstr(message, "#{@db.name}.#{@name}")
message.put_int(0) message.put_int(0)
message.put_array(BSON_SERIALIZER.serialize(selector, false).unpack("C*")) message.put_array(BSON.serialize(selector, false).unpack("C*"))
@connection.send_message(Mongo::Constants::OP_DELETE, message, @connection.send_message(Mongo::Constants::OP_DELETE, message,
"db.#{@db.name}.remove(#{selector.inspect})") "db.#{@db.name}.remove(#{selector.inspect})")
end end
@ -248,8 +248,8 @@ module Mongo
update_options += 1 if options[:upsert] update_options += 1 if options[:upsert]
update_options += 2 if options[:multi] update_options += 2 if options[:multi]
message.put_int(update_options) message.put_int(update_options)
message.put_array(BSON_SERIALIZER.serialize(selector, false).unpack("C*")) message.put_array(BSON.serialize(selector, false).unpack("C*"))
message.put_array(BSON_SERIALIZER.serialize(document, false).unpack("C*")) message.put_array(BSON.serialize(document, false).unpack("C*"))
if options[:safe] if options[:safe]
@connection.send_message_with_safe_check(Mongo::Constants::OP_UPDATE, message, @db.name, @connection.send_message_with_safe_check(Mongo::Constants::OP_UPDATE, message, @db.name,
"db.#{@name}.update(#{selector.inspect}, #{document.inspect})") "db.#{@name}.update(#{selector.inspect}, #{document.inspect})")
@ -508,7 +508,7 @@ EOS
message = ByteBuffer.new message = ByteBuffer.new
message.put_int(0) message.put_int(0)
BSON_RUBY.serialize_cstr(message, "#{@db.name}.#{collection_name}") BSON_RUBY.serialize_cstr(message, "#{@db.name}.#{collection_name}")
documents.each { |doc| message.put_array(BSON_SERIALIZER.serialize(doc, check_keys).unpack("C*")) } documents.each { |doc| message.put_array(BSON.serialize(doc, check_keys).unpack("C*")) }
if safe if safe
@connection.send_message_with_safe_check(Mongo::Constants::OP_INSERT, message, @db.name, @connection.send_message_with_safe_check(Mongo::Constants::OP_INSERT, message, @db.name,
"db.#{collection_name}.insert(#{documents.inspect})") "db.#{collection_name}.insert(#{documents.inspect})")

View File

@ -470,7 +470,7 @@ module Mongo
BSON_RUBY.serialize_cstr(message, "#{db_name}.$cmd") BSON_RUBY.serialize_cstr(message, "#{db_name}.$cmd")
message.put_int(0) message.put_int(0)
message.put_int(-1) message.put_int(-1)
message.put_array(BSON_SERIALIZER.serialize({:getlasterror => 1}, false).unpack("C*")) message.put_array(BSON.serialize({:getlasterror => 1}, false).unpack("C*"))
add_message_headers(Mongo::Constants::OP_QUERY, message) add_message_headers(Mongo::Constants::OP_QUERY, message)
end end

View File

@ -324,8 +324,8 @@ module Mongo
if query_contains_special_fields? if query_contains_special_fields?
selector = selector_with_special_query_fields selector = selector_with_special_query_fields
end end
message.put_array(BSON_SERIALIZER.serialize(selector, false).unpack("C*")) message.put_array(BSON.serialize(selector, false).unpack("C*"))
message.put_array(BSON_SERIALIZER.serialize(@fields, false).unpack("C*")) if @fields message.put_array(BSON.serialize(@fields, false).unpack("C*")) if @fields
message message
end end