String serializeForNumberType(const Decimal& number)
{
    if (number.isZero()) {
        // Decimal::toString appends exponent, e.g. "0e-18"
        return number.isNegative() ? "-0" : "0";
    }
    return number.toString();
}
static PassRefPtr<TypeBuilder::Animation::KeyframeStyle> buildObjectForStringKeyframe(const StringKeyframe* keyframe)
{
    Decimal decimal = Decimal::fromDouble(keyframe->offset() * 100);
    String offset = decimal.toString();
    offset.append("%");

    RefPtr<TypeBuilder::Animation::KeyframeStyle> keyframeObject = TypeBuilder::Animation::KeyframeStyle::create()
        .setOffset(offset)
        .setEasing(keyframe->easing().toString());
    return keyframeObject.release();
}
static std::unique_ptr<protocol::Animation::KeyframeStyle>
buildObjectForStringKeyframe(const StringKeyframe* keyframe) {
  Decimal decimal = Decimal::fromDouble(keyframe->offset() * 100);
  String offset = decimal.toString();
  offset.append('%');

  std::unique_ptr<protocol::Animation::KeyframeStyle> keyframeObject =
      protocol::Animation::KeyframeStyle::create()
          .setOffset(offset)
          .setEasing(keyframe->easing().toString())
          .build();
  return keyframeObject;
}
string PgsqlDataProvider::getPrice(string methodName, uint32_t stockId)
{
  nontransaction command(*conn);  
  string query = "SELECT " + methodName + "(" + to_string(stockId) + ");";
  result queryResult(command.exec(query));
  
  if (verbose)
    cout << "Result of " << query << ": ";

  if (queryResult.size() == 1 && !queryResult[0][0].is_null())
  {
    Decimal price = Decimal(queryResult[0][0].as<string>());
    if (verbose)
      cout << price << endl;
    return price.toString();
  }

  if (verbose)
    cout << "null" << endl;
  return "null";
}