Skip to content

Instantly share code, notes, and snippets.

@kenton
Created November 28, 2012 20:52
Show Gist options
  • Save kenton/4164406 to your computer and use it in GitHub Desktop.
Save kenton/4164406 to your computer and use it in GitHub Desktop.
Loading Configuration Settings!
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration.yml
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration_development.yml
[1] pry(main)> .clear
[2] pry(main)> conn = ActiveRecord::Base.connection
=> #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x1067de6a8
@config=
{:adapter=>"mysql",
:username=>"root",
:password=>nil,
:database=>"limos_development"},
@connection=#<Mysql:0x1067de6f8>,
@connection_options=[nil, "root", "", "limos_development", nil, nil, 131072],
@last_verification=0,
@logger=
#<ActiveSupport::BufferedLogger:0x103002b08
@auto_flushing=1,
@buffer={},
@guard=#<Mutex:0x102fef738>,
@level=0,
@log=#<File:/Users/kentonnewby/dev/limos/log/development.log>>,
@query_cache_enabled=false,
@quoted_column_names=
{"service_areas"=>"`service_areas`",
"places"=>"`places`",
"searches"=>"`searches`",
"marketing_affiliates"=>"`marketing_affiliates`",
"code"=>"`code`",
"vehicle_colors"=>"`vehicle_colors`",
[3] pry(main)> .clear
[4] pry(main)> search = Search.last
=> #<Search id: 4766986, uuid: "A4HF8A", ride_date: "2012-11-30", user_id: nil, pickup_time: "2000-01-01 13:00:00", drop_off_time: nil, pickup_ts: "2012-11-30 13:00:00", drop_off_ts: nil, ride_duration: #<BigDecimal:108a8c9e8,'0.0',9(18)>, service_type: 100, pickup_place: "San Francisco, CA 94111", drop_off_place: "SFO", pickup_place_id: 861326, drop_off_place_id: 1599, distance_seg2: 12, vehicle_types: "1,2,3,4,5,6,7", pax: 1, luggage: nil, msc: nil, msp: nil, user_tz: #<BigDecimal:108a8c5d8,'0.5E1',9(18)>, created_at: "2012-11-28 20:31:27", updated_at: "2012-11-28 20:31:30", pickup_magic_place_id: nil, drop_off_magic_place_id: nil, pickup_user_disambig: false, drop_off_user_disambig: false, num_operators_found: 4, pickup_google_place_id: -1, drop_off_google_place_id: -1, freeform_pickup: "94111 | ", freeform_dropoff: "San Francisco International Airport | ", freeform_comments: nil, lead_status: 587268096, lowest_total_amount: #<BigDecimal:108a89e00,'0.3088E2',18(18)>, event_time: nil, notifications_cancelled: false, requested_operator_id: nil, search_source_id: 49, admin_user_id: nil, quote_handle: nil, company_proxy_id: nil, visit_id: 1541, contact_page_status: 0, search_billing_type: 1>
[5] pry(main)> .clear
[6] pry(main)> in_search_mode = SEARCH_MODE_SUPER_SEARCH if search.is_super_search?
=> nil
[7] pry(main)> call_stmt = search.call_statement(in_search_mode)
=> ["CALL process_search_operators( 1, 861326, 0, 1599, 1, 4766986, NULL, 2, 1, NULL, NULL, 1 )",
"CALL process_search( 1, '2012-11-30 13:00:00', NULL, 0.0, 1, 0, '1,2,3,4,5,6,7', 4766986, -8.0, NULL, NULL, 2, NULL, NULL, 1, 15.0 )"]
[8] pry(main)> connection
NameError: undefined local variable or method `connection' for #<Object:0x1001dc288>
from (pry):5:in `__pry__'
[9] pry(main)> connection = ActiveRecord::Base.connection; nil
=> nil
[10] pry(main)> connection.class
=> ActiveRecord::ConnectionAdapters::MysqlAdapter
[11] pry(main)> .clear
[12] pry(main)> results = nil
=> nil
[13] pry(main)> search.is_same_connection_id?(true)
=> true
[14] pry(main)> connection.execute(call_stmt[0])
=> nil
[15] pry(main)> conn = search.class.connection
=> #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x1067de6a8
@config=
{:adapter=>"mysql",
:username=>"root",
:password=>nil,
:database=>"limos_development"},
@connection=#<Mysql:0x1067de6f8>,
@connection_options=[nil, "root", "", "limos_development", nil, nil, 131072],
@last_verification=0,
@logger=
#<ActiveSupport::BufferedLogger:0x103002b08
@auto_flushing=1,
@buffer={},
@guard=#<Mutex:0x102fef738>,
@level=0,
@log=#<File:/Users/kentonnewby/dev/limos/log/development.log>>,
@query_cache_enabled=false,
@quoted_column_names=
{"service_areas"=>"`service_areas`",
"places"=>"`places`",
"bit"=>"`bit`",
"searches"=>"`searches`",
"marketing_affiliates"=>"`marketing_affiliates`",
"code"=>"`code`",
[16] pry(main)> .clear
[17] pry(main)> temp_table_operators = connection.select_value("SELECT @_table_operators")
=> "__search_operators_0_646"
[18] pry(main)> ops = conn.select_all("SELECT operator_id FROM #{temp_table_operators}")
=> []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment