GDateTime *ret;
ret = NULL;
- if (g_date_valid (gdate))
+ if (gdate != NULL && g_date_valid (gdate))
{
ret = g_date_time_new_local (g_date_get_year (gdate),
g_date_get_month (gdate),
{
GDate *ret;
- ret = g_new0 (GDate, 1);
- g_date_set_year (ret, g_date_time_get_year (gdatetime));
- g_date_set_month (ret, g_date_time_get_month (gdatetime));
- g_date_set_day (ret, g_date_time_get_day_of_month (gdatetime));
+ ret = NULL;
+ if (gdatetime != NULL)
+ {
+ ret = g_new0 (GDate, 1);
+ g_date_set_year (ret, g_date_time_get_year (gdatetime));
+ g_date_set_month (ret, g_date_time_get_month (gdatetime));
+ g_date_set_day (ret, g_date_time_get_day_of_month (gdatetime));
+ }
return ret;
}
return ret;
}
-
const gchar
-*solipa_gdate_to_sql (GDate *gdate, const gchar *format)
+*solipa_gdate_to_sql (GDate *gdate)
{
const gchar *ret;
ret = g_strdup ("NULL");
- if (g_date_valid (gdate))
+ if (gdate != NULL && g_date_valid (gdate))
{
- ret = solipa_gdatetime_to_sql (solipa_gdate_to_gdatetime (gdate), format);
+ ret = solipa_gdatetime_to_sql (solipa_gdate_to_gdatetime (gdate), "date");
}
return ret;
GDate *solipa_gdatetime_to_gdate (GDateTime *gdatetime);
const gchar *solipa_tm_to_sql (struct tm *tm_data, const gchar *format);
-const gchar *solipa_gdate_to_sql (GDate *gdate, const gchar *format);
+const gchar *solipa_gdate_to_sql (GDate *gdate);
const gchar *solipa_gdatetime_to_sql (GDateTime *gdatetime, const gchar *format);
GDate *solipa_get_gdate_from_string (const gchar *string, const gchar *format);