error = NULL;
v = gda_data_model_get_value_at (data_model, col, row, &error);
- if (v != NULL && error == NULL)
+ if (error == NULL)
{
- ret = g_strdup (gda_value_stringify (v));
+ if (!gda_value_is_null (v))
+ {
+ ret = gda_value_stringify (v);
+ }
+ else
+ {
+ ret = g_strdup ("");
+ }
}
else
{
error = NULL;
v = gda_data_model_get_value_at (data_model, col, row, &error);
- if (v == NULL || error != NULL)
+ if (gda_value_is_null (v) || error != NULL)
{
g_warning ("Error on retrieving field's value: %s\n",
error->message);
}
- else if (!gda_value_is_null (v))
+ else
{
if (gda_value_isa (v, G_TYPE_INT))
{
}
else
{
- ret = atol (gda_value_stringify (v));
+ ret = strtol (gda_value_stringify (v), NULL, 10);
}
}
error = NULL;
v = gda_data_model_get_value_at (data_model, col, row, &error);
- if (v == NULL || error != NULL)
+ if (gda_value_is_null (v) || error != NULL)
{
g_warning ("Error on retrieving field's value: %s\n",
error->message);
}
- else if (!gda_value_is_null (v))
+ else
{
if (gda_value_isa (v, G_TYPE_FLOAT))
{
error = NULL;
v = gda_data_model_get_value_at (data_model, col, row, &error);
- if (v == NULL || error != NULL)
+ if (gda_value_is_null (v) || error != NULL)
{
g_warning ("Error on retrieving field's value: %s\n",
error->message);
}
- else if (!gda_value_is_null (v))
+ else
{
if (gda_value_isa (v, G_TYPE_DOUBLE))
{
error = NULL;
v = gda_data_model_get_value_at (data_model, col, row, &error);
- if (v == NULL || error != NULL)
+ if (gda_value_is_null (v) || error != NULL)
{
g_warning ("Error on retrieving field's value: %s\n",
error->message);
}
- else if (!gda_value_is_null (v))
+ else
{
if (gda_value_isa (v, G_TYPE_BOOLEAN))
{
{
gchar *vstr = g_strstrip (gda_value_stringify (v));
if (strcasecmp (vstr, "true") == 0 ||
- strcasecmp (vstr, "t") == 0 ||
- strcasecmp (vstr, "yes") == 0 ||
- strcasecmp (vstr, "y") == 0 ||
- atol (vstr) != 0)
+ strcasecmp (vstr, "t") == 0 ||
+ strcasecmp (vstr, "yes") == 0 ||
+ strcasecmp (vstr, "y") == 0 ||
+ strtol (vstr, NULL, 10) != 0)
{
ret = TRUE;
}
*gdaex_strescape (const gchar *source, const gchar *exceptions)
{
gchar *nsource;
- gint l;
- l = strlen (source);
-
- if (source == NULL || l == 0) return "";
-
- nsource = g_strstrip (g_strdup (source));
- nsource = g_strescape (nsource, exceptions);
+ if (source == NULL)
+ {
+ nsource = g_strdup ("");
+ }
+ else
+ {
+ nsource = gda_default_escape_string (source);
+ }
- return gda_default_escape_string (nsource);
+ return nsource;
}
/**
{
gchar chr = '\"';
- const gchar *provider = gdaex_get_provider (gdaex);
+ const gchar *provider;
+
+ g_return_val_if_fail (IS_GDAEX (gdaex), chr);
+
+ provider = gdaex_get_provider (gdaex);
if (strcmp (provider, "MySQL") == 0)
{