def sql_to_soql(frozen_sql)
      sql = frozen_sql.dup
      # Unescape column and table names
      sql.gsub!('`', '')

      # Remove table namespace from fields
      sql.gsub!("#{QueryBuilder::DUMMY_TABLE_NAME}.", '')

      # Add table name
      sql.gsub!(QueryBuilder::DUMMY_TABLE_NAME, klass.object_name)

      # Convert 1=0 to id IS NULL (id never be NULL, so it a false case)
      sql.gsub!(/\s+1=0(\s*)/i, ' id IS NULL\1')

      # Convert IS NOT to !=
      sql.gsub!(/\s+IS\s+NOT\s+/i, ' != ')

      # Convert IS to =
      sql.gsub!(/\s+IS\s+/i, ' = ')

      # Convert datatime to salesforce format
      sql.gsub!(/'(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)?'/, '\1T\2Z')

      # Convert date to salesforce format
      sql.gsub!(/'(\d{4}-\d{2}-\d{2})'/, '\1')

      # Convert boolean_field = (1|0) to boolean_field = (true|false)
      sql = boolean_data_type_conversion(sql)

      # Convert aliased fields
      convert_aliased_fields(sql).strip
    end
def sql_to_soql(frozen_sql)
      sql = frozen_sql.dup
      # Unescape column and table names
      sql.gsub!('`', '')

      # Remove table namespace from fields
      sql.gsub!("#{QueryBuilder::DUMMY_TABLE_NAME}.", '')

      # Add table name
      sql.gsub!(QueryBuilder::DUMMY_TABLE_NAME, klass.object_name)

      # Convert 1=0 to id IS NULL (id never be NULL, so it a false case)
      sql.gsub!(/\s+1=0(\s*)/i, ' id IS NULL\1')

      # Convert IS NOT to !=
      sql.gsub!(/\s+IS\s+NOT\s+/i, ' != ')

      # Convert IS to =
      sql.gsub!(/\s+IS\s+/i, ' = ')

      # Convert datatime to salesforce format
      sql.gsub!(/'(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)?'/, '\1T\2Z')

      # Convert date to salesforce format
      sql.gsub!(/'(\d{4}-\d{2}-\d{2})'/, '\1')

      # Convert boolean_field = (1|0) to boolean_field = (true|false)
      sql = boolean_data_type_conversion(sql)

      # Convert aliased fields
      convert_aliased_fields(sql).strip
    end
TODO: optimize this method