Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MySQL's STR_TO_DATE function implementation #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuha-yuha
Copy link

@yuha-yuha yuha-yuha commented Mar 13, 2025

The STR_TO_DATE function in MySQL was not implemented, so it was added.
By specifying a string representing a date and the format of the string as an argument, it can be converted to a DATETIME type in a format such as %Y-%m-%d %H:%i:%s.

@yuha-yuha yuha-yuha marked this pull request as ready for review March 13, 2025 10:14
@yuha-yuha yuha-yuha marked this pull request as draft March 13, 2025 10:14
$format = Evaluator::evaluate($conn, $scope, $args[1], $row, $result);

if (strpos($format, '%') === false) {
return $format;

This comment was marked as resolved.

Comment on lines 1559 to 1571
$date_format_list = [
"%c" => "n", "%D" => "jS", "%d" => "d", "%e" => "j",
"%M" => "F", "%b" => "M", "%m" => "m" ,"%Y" => "Y", "%y" => "y"
];

$time_format_list = [
"%k" => "G", "%l" => "g", "%S" => "s", "%s" => "s", "%T" => "H:i:s",
"%r" => "h:i:s A", "%H" => "H", "%h" => "h", "%i" => "i",
];

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

];

$is_in_date_format = false;
$is_in_time_format = false;

This comment was marked as resolved.

Comment on lines 1572 to 1579
foreach ($matches[0] as $match) {
$is_in_date_format = in_array($match, array_keys($date_format_list));
$is_in_time_format = in_array($match, array_keys($time_format_list));
}

This comment was marked as resolved.

@yuha-yuha yuha-yuha force-pushed the master branch 2 times, most recently from d972da8 to c637a08 Compare March 14, 2025 08:06
@yuha-yuha yuha-yuha marked this pull request as ready for review March 14, 2025 08:07
@Javakky-pxv
Copy link
Contributor

@aaronm67
I want approval to run this workflow.

@aaronm67
Copy link
Collaborator

It looks like I can't grant you access to run workflows, but I can run them for you.

You can see results here - https://github.com/vimeo/php-mysql-engine/actions/runs/14122732372/job/39592916472?pr=56

@yuha-yuha yuha-yuha force-pushed the master branch 2 times, most recently from 0936aa8 to d9795ac Compare April 4, 2025 11:33
@yuha-yuha
Copy link
Author

@aaronm67
I have fixed the failed CI, can you please run it again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants