Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 194603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:36:34+00:00 2026-05-11T16:36:34+00:00

I have user input strings specifying the cost of an event (eg: $4 for

  • 0

I have user input strings specifying the cost of an event (eg: “$4 for non-members”). I am trying to parse out the upper (and lower) bound of the cost (in the example, upper == lower == 4.00).

Suppose that a given string cannot be parsed (maybe it’s blank). In this case, I want to be able to store in the database that the maximum cost of the event is infinity (and minimum 0). How do I do this using Mysql and ActiveRecord?

What I’ve tried:

> e = Event.find(1234)
> e.cost_max = 1.0/0.0
> e.save
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'Infinity' in 'field list': UPDATE `events` SET `cost_max` = Infinity WHERE `id` = 1234

I’ve also tried marking cost_max with NULL, instead. This works in principle. However, I am using Ultrasphinx filters to retrieve events whose cost range has a non-empty intersection with a searched range. As Ultrasphinx filters accept only hash conditions (am I wrong?), my options are limited to this:

search_params[:filter].merge!(:cost_max => 0.0..99)

Meaning, no “OR cost_max is NULL” allowed.

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:36:34+00:00Added an answer on May 11, 2026 at 4:36 pm

    If the field type is a double it seems that you can store infinity values.

    VALUE('1e500');
    

    Then it’s just a matter of using that as the upper bounds for the comparison.

    For more information see this thread in the mysql mailing lists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I'm trying to do is have the user input a number, and then
in small program I'm writing, I have to parse a line of user input.
I have an array of Strings containing unsave content (user input). I want to
I have a string value from a user input box. I have to figure
I have a function that checks user input and wanted to know if it
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I have loop designed to validate the user input on a question, it was
I have the following requirement: Based on some user input, I need to generate
I have a Win32 C++ program that validates user input and updates the UI
I have a Login page that captures User input like this. MD5calc ss =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.