mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Repositories] Convert database.cpp to Repositories (#4054)
* [Repositories] Convert database.cpp to Repositories - Convert all database.cpp methods to repositories where possible. * Final push. * Cleanup * Cleanup * Update database.h * Fix crash * Update database.cpp
This commit is contained in:
@@ -280,7 +280,7 @@ foreach my $table_to_generate (@tables) {
|
||||
|
||||
# column names (string)
|
||||
$column_names_quoted .= sprintf("\t\t\t\"%s\",\n", format_column_name_for_mysql($column_name));
|
||||
if ($data_type =~ /datetime/) {
|
||||
if ($data_type =~ /datetime|timestamp/) {
|
||||
$select_column_names_quoted .= sprintf("\t\t\t\"UNIX_TIMESTAMP(%s)\",\n", format_column_name_for_mysql($column_name));
|
||||
}
|
||||
else {
|
||||
@@ -293,7 +293,7 @@ foreach my $table_to_generate (@tables) {
|
||||
if ($data_type =~ /int|float|double|decimal/) {
|
||||
$query_value = sprintf('" + std::to_string(e.%s));', $column_name_formatted);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")");', $column_name_formatted, $column_name_formatted);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ foreach my $table_to_generate (@tables) {
|
||||
if ($data_type =~ /int|float|double|decimal/) {
|
||||
$value = sprintf('std::to_string(e.%s)', $column_name_formatted);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")"', $column_name_formatted, $column_name_formatted);
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ foreach my $table_to_generate (@tables) {
|
||||
$all_entries .= sprintf("\t\t\te.%-${longest_column_length}s = row[%s] ? strtoll(row[%s], nullptr, 10) : %s;\n", $column_name_formatted, $index, $index, $default_value);
|
||||
$find_one_entries .= sprintf("\t\t\te.%-${longest_column_length}s = row[%s] ? strtoll(row[%s], nullptr, 10) : %s;\n", $column_name_formatted, $index, $index, $default_value);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$all_entries .= sprintf("\t\t\te.%-${longest_column_length}s = strtoll(row[%s] ? row[%s] : \"-1\", nullptr, 10);\n", $column_name_formatted, $index, $index);
|
||||
$find_one_entries .= sprintf("\t\t\te.%-${longest_column_length}s = strtoll(row[%s] ? row[%s] : \"-1\", nullptr, 10);\n", $column_name_formatted, $index, $index);
|
||||
}
|
||||
@@ -591,7 +591,7 @@ sub translate_mysql_data_type_to_c
|
||||
elsif ($mysql_data_type =~ /double/) {
|
||||
$struct_data_type = 'double';
|
||||
}
|
||||
elsif ($mysql_data_type =~ /datetime/) {
|
||||
elsif ($mysql_data_type =~ /datetime|timestamp/) {
|
||||
$struct_data_type = 'time_t';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user