DbModel:
- Solucionado bug en el metodo db_model_create_where
This commit is contained in:
parent
a02e657579
commit
56dd9dfc5f
|
@ -96,14 +96,6 @@ struct _DbModelPrivate
|
||||||
|
|
||||||
// Structures
|
// Structures
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
gint col;
|
|
||||||
gint order;
|
|
||||||
DbRow * null_row;
|
|
||||||
}
|
|
||||||
SortInfo;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DbModel * self;
|
DbModel * self;
|
||||||
|
@ -130,6 +122,14 @@ typedef struct
|
||||||
}
|
}
|
||||||
DbJoin;
|
DbJoin;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
gint col;
|
||||||
|
gint order;
|
||||||
|
DbRow * null_row;
|
||||||
|
}
|
||||||
|
SortInfo;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
DB_MODEL_UNSORTED_SORT_COLUMN_ID = -2,
|
DB_MODEL_UNSORTED_SORT_COLUMN_ID = -2,
|
||||||
|
@ -2303,6 +2303,9 @@ static SqlObject * db_model_create_where (DbModel * self,
|
||||||
SqlObject * where;
|
SqlObject * where;
|
||||||
SqlList * and_operands;
|
SqlList * and_operands;
|
||||||
|
|
||||||
|
if (!tinfo->pkeys)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
where = sql_operation_new (SQL_OPERATION_TYPE_AND);
|
where = sql_operation_new (SQL_OPERATION_TYPE_AND);
|
||||||
|
|
||||||
and_operands = sql_list_new (SQL_TYPE_EXPR);
|
and_operands = sql_list_new (SQL_TYPE_EXPR);
|
||||||
|
@ -2319,24 +2322,27 @@ static SqlObject * db_model_create_where (DbModel * self,
|
||||||
|
|
||||||
g_value = &row->value[col];
|
g_value = &row->value[col];
|
||||||
|
|
||||||
for (n = operation->updated; n && (u = n->data); n = n->next)
|
if (!for_insert)
|
||||||
if (u->column == col)
|
|
||||||
{
|
{
|
||||||
g_value = u->value;
|
for (n = operation->updated; n && (u = n->data); n = n->next)
|
||||||
break;
|
if (u->column == col)
|
||||||
}
|
{
|
||||||
|
g_value = u->value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gvn_value_is_null (g_value))
|
if (!gvn_value_is_null (g_value))
|
||||||
{
|
value = sql_value_new_with_value (g_value);
|
||||||
value = sql_value_new_with_value (g_value);
|
|
||||||
}
|
}
|
||||||
else if (for_insert)
|
else
|
||||||
{
|
{
|
||||||
const GValue * def = gvn_param_spec_get_default (priv->column[col].spec);
|
const GValue * def = gvn_param_spec_get_default (priv->column[col].spec);
|
||||||
|
|
||||||
if (def && G_IS_VALUE (def)
|
if (def && G_IS_VALUE (def)
|
||||||
&& G_VALUE_TYPE (def) == SQL_TYPE_FUNCTION)
|
&& G_VALUE_TYPE (def) == SQL_TYPE_FUNCTION)
|
||||||
value = g_value_get_object (def);
|
value = g_value_get_object (def);
|
||||||
|
else
|
||||||
|
value = sql_value_new_with_value (g_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
|
|
Reference in New Issue