use of com.actiontech.dble.plan.common.time.MySQLTime in project dble by actiontech.
the class MySQLcom method getDateFromStr.
/**
* @return converted value. 0 on error and on zero-dates -- check 'failure'
* @brief Convert date provided in a string to its packed temporal int
* representation.
* @param[in] thd thread handle
* @param[in] str a string to convert
* @param[in] warn_type type of the timestamp for issuing the warning
* @param[in] warn_name field name for issuing the warning
* @param[out] error_arg could not extract a DATE or DATETIME
* @details Convert date provided in the string str to the int
* representation. If the string contains wrong date or doesn't
* contain it at all then a warning is issued. The warn_type and
* the warn_name arguments are used as the name and the type of the
* field when issuing the warning.
*/
public static long getDateFromStr(String str, MySQLTimestampType warntype, BoolPtr error) {
MySQLTime ltime = new MySQLTime();
MySQLTimeStatus status = new MySQLTimeStatus();
error.set(MyTime.strToDatetime(str, str.length(), ltime, MyTime.TIME_FUZZY_DATE, status));
if (error.get())
return 0;
return MyTime.timeToLonglongDatetimePacked(ltime);
}
Aggregations