id_spreadsheet = par_id;
cou_logError( cnx, CO_LOG_DEBUG, "setReferencedRange called");
snprintf(SQLString, SQLBUFSIZE, "
UPDATE co_sys_expression_range
SET index_ref = %d ,
function = %d,
id_ref_spreadsheet = %d ,
id_ref_column = %d ,
id_ref_row = %d ,
is_ref_column_hard = (%d<>0) ,
is_ref_row_hard = (%d<>0) ,
is_ref_column_named = (%d<>0) ,
is_ref_row_named = (%d<>0) ,
id_ref_column2 = %d ,
id_ref_row2 = %d ,
is_ref_column2_hard = (%d<>0) ,
is_ref_row2_hard = (%d<>0) ,
is_ref_column2_named = (%d<>0) ,
is_ref_row2_named = (%d<>0)
WHERE id_spreadsheet=%d AND id_column=%d AND id_row=%d
",index, function, id_ref_spreadsheet,
id_ref_column, id_ref_row, ref_column_hard, ref_row_hard, ref_column_named, ref_row_named,
id_ref_column2, id_ref_row2, ref_column2_hard, ref_row2_hard, ref_column2_named, ref_row2_named,
id_spreadsheet, id_column, id_row);
__SQL_EXEC
cou_logError( cnx, CO_LOG_DEBUG, "setReferencedRange 1st done");
if (!ok) { /* new reference */
snprintf(SQLString, SQLBUFSIZE, "
INSERT INTO co_sys_expression_range
(id_spreadsheet,id_column,id_row, index_ref, function,
id_ref_spreadsheet,
id_ref_column, id_ref_row, is_ref_column_hard, is_ref_row_hard, is_ref_column_named, is_ref_row_named,
id_ref_column2, id_ref_row2, is_ref_column2_hard, is_ref_row2_hard, is_ref_column2_named, is_ref_row2_named)
VALUES(%d,%d,%d,%d,%d,
%d,
%d,%d,(%d<>0),(%d<>0),(%d<>0),(%d<>0),
%d,%d,(%d<>0),(%d<>0),(%d<>0),(%d<>0))
", id_spreadsheet,id_column, id_row, index, function,
id_ref_spreadsheet,
id_ref_column, id_ref_row, ref_column_hard, ref_row_hard, ref_column_named, ref_row_named,
id_ref_column2, id_ref_row2, ref_column2_hard, ref_row2_hard, ref_column2_named, ref_row2_named);
__SQL_EXEC
cou_logError( cnx, CO_LOG_DEBUG, "setReferencedRange 2nd done");
}
{
const char* class_names[] = {"spreadsheet","spreadsheet_column","spreadsheet_row",NULL};
int object_ids[] = {id_spreadsheet,id_column,id_row};
char prop_name[32]; /* 2*id(10dig) + 1*index+2*'_' */
char prop_value[64]; /* 2*id + 2*bool+3*',' */
snprintf(prop_name, 32, "p%d_%d_%d", id_column, id_row,index);
snprintf(prop_value, 64, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
id_ref_column, id_ref_row, ref_column_hard, ref_row_hard,ref_column_named, ref_row_named,
id_ref_column2, id_ref_row2, ref_column2_hard, ref_row2_hard, ref_column2_named, ref_row2_named,
function);
cou_queueActionX( cnx, "expression_range", class_names, object_ids, CO_OP_UPDATE, prop_name, prop_value, NULL );
}