Commit e4d1d6a3 authored by Thomas Braun's avatar Thomas Braun
Browse files

DataBase.cpp: Avoid tmp prefix for attributes

parent eeff4e02
Loading
Loading
Loading
Loading
+60 −61
Original line number Diff line number Diff line
@@ -2252,7 +2252,7 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property(const Tango:
    MYSQL_ROW row;
    int n_rows = 0, n_props = 0;
    argout = new Tango::DevVarStringArray;
    const char *tmp_class, *tmp_attribute;
    const char *tmp_class, *attribute;

    INFO_STREAM << "DataBase::GetAttributeProperty(): get " << property_names->length() - 1 << " attributes for class "
                << (*property_names)[0] << std::endl;
@@ -2265,10 +2265,10 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property(const Tango:

    for(unsigned int i = 1; i < property_names->length(); i++)
    {
        tmp_attribute = (*property_names)[i];
        attribute = (*property_names)[i];
        sql_query_stream.str("");
        sql_query_stream << "SELECT name,value FROM property_attribute_class WHERE class = \"" << tmp_class
                         << "\" AND attribute LIKE \"" << tmp_attribute << "\" ";
                         << "\" AND attribute LIKE \"" << attribute << "\" ";
        DEBUG_STREAM << "DataBase::GetAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;

        DatabaseConnectionHandle dch(dcp);
@@ -2279,7 +2279,7 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property(const Tango:
        snprintf(n_rows_str, sizeof(n_rows_str), "%d", n_rows);
        n_props = n_props + 2;
        argout->length(n_props);
        (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute);
        (*argout)[n_props - 2] = CORBA::string_dup(attribute);
        (*argout)[n_props - 1] = CORBA::string_dup(n_rows_str);
        if(n_rows > 0)
        {
@@ -2349,7 +2349,7 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property2(const Tango
    MYSQL_ROW row;
    int n_rows = 0, n_props = 0;
    argout = new Tango::DevVarStringArray;
    const char *tmp_class, *tmp_attribute;
    const char *tmp_class, *attribute;

    INFO_STREAM << "DataBase::GetClassAttributeProperty2(): get " << property_names->length() - 1
                << " properties for device " << (*property_names)[0] << std::endl;
@@ -2362,10 +2362,10 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property2(const Tango

    for(unsigned int i = 1; i < property_names->length(); i++)
    {
        tmp_attribute = (*property_names)[i];
        attribute = (*property_names)[i];
        sql_query_stream.str("");
        sql_query_stream << "SELECT name,value FROM property_attribute_class WHERE class = \"" << tmp_class
                         << "\" AND attribute LIKE \"" << tmp_attribute << "\" ORDER BY name,count";
                         << "\" AND attribute LIKE \"" << attribute << "\" ORDER BY name,count";
        DEBUG_STREAM << "DataBase::GetClassAttributeProperty2(): sql_query " << sql_query_stream.str() << std::endl;

        DatabaseConnectionHandle dch(dcp);
@@ -2375,7 +2375,7 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property2(const Tango
        DEBUG_STREAM << "DataBase::GetClassAttributeProperty2(): mysql_num_rows() " << n_rows << std::endl;
        n_props = n_props + 2;
        argout->length(n_props);
        (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute);
        (*argout)[n_props - 2] = CORBA::string_dup(attribute);
        int prop_number_idx = n_props - 1;
        int prop_number = 0;
        if(n_rows > 0)
@@ -2478,7 +2478,7 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property_hist(const T
    MYSQL_RES *result;
    MYSQL_ROW row;
    const char *tmp_class;
    std::string tmp_attribute;
    std::string attribute;
    std::string tmp_name;

    if(argin->length() != 3)
@@ -2492,13 +2492,13 @@ Tango::DevVarStringArray *DataBase::db_get_class_attribute_property_hist(const T
    argout = new Tango::DevVarStringArray;

    tmp_class = (*argin)[0];
    tmp_attribute = replace_wildcard((*argin)[1]);
    attribute = replace_wildcard((*argin)[1]);
    tmp_name = replace_wildcard((*argin)[2]);

    // Get id list

    sql_query_stream << "SELECT DISTINCT id,date FROM property_attribute_class_hist WHERE class = \"" << tmp_class
                     << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                     << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                     << "\" ORDER by date ASC";

    {
@@ -3204,7 +3204,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property(const Tango
    MYSQL_ROW row;
    int n_rows = 0, n_props = 0;
    argout = new Tango::DevVarStringArray;
    const char *device, *tmp_attribute;
    const char *device, *attribute;

    TimeVal before, after;
    GetTime(before);
@@ -3220,10 +3220,10 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property(const Tango

    for(unsigned int i = 1; i < property_names->length(); i++)
    {
        tmp_attribute = (*property_names)[i];
        attribute = (*property_names)[i];
        sql_query_stream.str("");
        sql_query_stream << "SELECT name,value FROM property_attribute_device WHERE device = \"" << device
                         << "\" AND attribute LIKE \"" << tmp_attribute << "\" ";
                         << "\" AND attribute LIKE \"" << attribute << "\" ";
        DEBUG_STREAM << "DataBase::GetDeviceAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;

        DatabaseConnectionHandle dch(dcp);
@@ -3234,7 +3234,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property(const Tango
        snprintf(n_rows_str, sizeof(n_rows_str), "%d", n_rows);
        n_props = n_props + 2;
        argout->length(n_props);
        (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute);
        (*argout)[n_props - 2] = CORBA::string_dup(attribute);
        (*argout)[n_props - 1] = CORBA::string_dup(n_rows_str);
        if(n_rows > 0)
        {
@@ -3357,10 +3357,10 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property2(const Tang
    {
        for(unsigned int i = 1; i < property_names->length(); i++)
        {
            const char *tmp_attribute = (*property_names)[i];
            const char *attribute = (*property_names)[i];
            sql_query_stream.str("");
            sql_query_stream << "SELECT name,value FROM property_attribute_device WHERE device = \"" << device
                             << "\" AND attribute LIKE \"" << tmp_attribute << "\" ORDER BY name,count";
                             << "\" AND attribute LIKE \"" << attribute << "\" ORDER BY name,count";
            DEBUG_STREAM << "DataBase::GetDeviceAttributeProperty2(): sql_query " << sql_query_stream.str()
                         << std::endl;

@@ -3370,7 +3370,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property2(const Tang
            DEBUG_STREAM << "DataBase::GetDeviceAttributeProperty2(): mysql_num_rows() " << n_rows << std::endl;
            n_props = n_props + 2;
            argout->length(n_props);
            (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute);
            (*argout)[n_props - 2] = CORBA::string_dup(attribute);
            int prop_number_idx = n_props - 1;
            int prop_number = 0;
            if(n_rows > 0)
@@ -3529,8 +3529,8 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property2(const Tang

        for(unsigned int i = 1; i < property_names->length(); i++)
        {
            std::string tmp_attribute((*property_names)[i]);
            std::string tmp_att_lower(tmp_attribute);
            std::string attribute((*property_names)[i]);
            std::string tmp_att_lower(attribute);
            transform(tmp_att_lower.begin(), tmp_att_lower.end(), tmp_att_lower.begin(), ::tolower);

            std::map<std::string, std::vector<PropDef>>::iterator pos = db_data.find(tmp_att_lower);
@@ -3543,7 +3543,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property2(const Tang
            {
                n_props = n_props + 2;
                argout->length(n_props);
                (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute.c_str());
                (*argout)[n_props - 2] = CORBA::string_dup(attribute.c_str());
                (*argout)[n_props - 1] = CORBA::string_dup("0");
            }
            else
@@ -3552,7 +3552,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property2(const Tang

                n_props = n_props + 2;
                argout->length(n_props);
                (*argout)[n_props - 2] = CORBA::string_dup(tmp_attribute.c_str());
                (*argout)[n_props - 2] = CORBA::string_dup(attribute.c_str());
                snprintf(n_rows_str, sizeof(n_rows_str), "%d", prop_nb);
                (*argout)[n_props - 1] = CORBA::string_dup(n_rows_str);

@@ -3614,7 +3614,7 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property_hist(const
    MYSQL_RES *result;
    MYSQL_ROW row;
    const char *device;
    std::string tmp_attribute;
    std::string attribute;
    std::string tmp_name;

    if(argin->length() != 3)
@@ -3629,13 +3629,13 @@ Tango::DevVarStringArray *DataBase::db_get_device_attribute_property_hist(const
    argout = new Tango::DevVarStringArray;

    device = (*argin)[0];
    tmp_attribute = replace_wildcard((*argin)[1]);
    attribute = replace_wildcard((*argin)[1]);
    tmp_name = replace_wildcard((*argin)[2]);

    // Get id list

    sql_query_stream << "SELECT DISTINCT id,date FROM property_attribute_device_hist WHERE device = \"" << device
                     << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                     << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                     << "\" ORDER by date ASC";

    {
@@ -6042,7 +6042,7 @@ void DataBase::db_put_attribute_alias(const Tango::DevVarStringArray *argin)
    TangoSys_MemStream sql_query_stream;
    MYSQL_RES *result;
    std::string tmp_alias;
    std::string tmp_name, tmp_attribute, device;
    std::string tmp_name, attribute, device;

    if(argin->length() < 2)
    {
@@ -6116,7 +6116,7 @@ void DataBase::db_put_attribute_alias(const Tango::DevVarStringArray *argin)
            Tango::Except::throw_exception(DB_SQLError, o.str(), "DataBase::db_put_attribute_alias()");
        }
        device = tmp_name.substr(0, tmp_name.rfind("/"));
        tmp_attribute = tmp_name.substr(tmp_name.rfind("/") + 1);
        attribute = tmp_name.substr(tmp_name.rfind("/") + 1);
        // first delete the current entry (if any)

        sql_query_stream.str("");
@@ -6128,7 +6128,7 @@ void DataBase::db_put_attribute_alias(const Tango::DevVarStringArray *argin)

        sql_query_stream.str("");
        sql_query_stream << "INSERT attribute_alias SET alias=\'" << tmp_alias << "\',name=\'" << tmp_name
                         << "\',device=\'" << device << "\',attribute=\'" << tmp_attribute << "\',updated=NOW()";
                         << "\',device=\'" << device << "\',attribute=\'" << attribute << "\',updated=NOW()";
        DEBUG_STREAM << "DataBase::db_put_attribute_alias(): sql_query " << sql_query_stream.str() << std::endl;
        simple_query(sql_query_stream.str(), "db_put_attribute_alias()", al.get_dch());
    }
@@ -6158,7 +6158,7 @@ void DataBase::db_put_class_attribute_property(const Tango::DevVarStringArray *a

    const Tango::DevVarStringArray *property_list = argin;
    TangoSys_MemStream sql_query_stream;
    const char *tmp_class, *tmp_attribute, *tmp_name;
    const char *tmp_class, *attribute, *tmp_name;

    const int n_attributes = ParseString<int>((*property_list)[1]);
    INFO_STREAM << "DataBase::PutAttributeProperty(): put " << n_attributes << " attributes for device "
@@ -6172,7 +6172,7 @@ void DataBase::db_put_class_attribute_property(const Tango::DevVarStringArray *a
        for(i = 0; i < n_attributes; i++)
        {
            tmp_class = (*property_list)[0];
            tmp_attribute = (*property_list)[k];
            attribute = (*property_list)[k];
            const int n_properties = ParseString<int>((*property_list)[k + 1]);
            for(j = k + 2; j < k + n_properties * 2 + 2; j = j + 2)
            {
@@ -6182,7 +6182,7 @@ void DataBase::db_put_class_attribute_property(const Tango::DevVarStringArray *a
                // first delete the tuple (device,name,count) from the property table
                sql_query_stream.str("");
                sql_query_stream << "DELETE FROM property_attribute_class WHERE class LIKE \"" << tmp_class
                                 << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\"";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_class_attribute_property()", al.get_dch());
@@ -6190,8 +6190,8 @@ void DataBase::db_put_class_attribute_property(const Tango::DevVarStringArray *a
                // then insert the new value for this tuple
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_attribute_class SET class='" << tmp_class << "',attribute='"
                                 << tmp_attribute << "',name='" << tmp_name << "',count='1',value='"
                                 << tmp_escaped_string << "',updated=NOW(),accessed=NOW()";
                                 << attribute << "',name='" << tmp_name << "',count='1',value='" << tmp_escaped_string
                                 << "',updated=NOW(),accessed=NOW()";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_class_attribute_property()", al.get_dch());

@@ -6200,14 +6200,14 @@ void DataBase::db_put_class_attribute_property(const Tango::DevVarStringArray *a
                Tango::DevULong64 class_attribute_property_hist_id = get_id("class_attribute", al.get_dch());
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_attribute_class_hist SET class='" << tmp_class
                                 << "',attribute='" << tmp_attribute << "',name='" << tmp_name << "',id='"
                                 << "',attribute='" << attribute << "',name='" << tmp_name << "',id='"
                                 << class_attribute_property_hist_id << "',count='1',value='" << tmp_escaped_string
                                 << "'";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_class_attribute_property()", al.get_dch());

                purge_att_property(
                    "property_attribute_class_hist", "class", tmp_class, tmp_attribute, tmp_name, al.get_dch());
                    "property_attribute_class_hist", "class", tmp_class, attribute, tmp_name, al.get_dch());
            }
            k = k + n_properties * 2 + 2;
        }
@@ -6241,7 +6241,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    const char *tmp_class, *tmp_attribute, *tmp_name;
    const char *tmp_class, *attribute, *tmp_name;

    const int n_attributes = ParseString<int>((*argin)[1]);
    INFO_STREAM << "DataBase::PutClassAttributeProperty2(): put " << n_attributes << " attributes for device "
@@ -6255,7 +6255,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *
        for(i = 0; i < n_attributes; i++)
        {
            tmp_class = (*argin)[0];
            tmp_attribute = (*argin)[k];
            attribute = (*argin)[k];
            const int n_properties = ParseString<int>((*argin)[k + 1]);
            for(jj = 0; jj < n_properties; jj++)
            {
@@ -6266,7 +6266,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *

                sql_query_stream.str("");
                sql_query_stream << "DELETE FROM property_attribute_class WHERE class LIKE \"" << tmp_class
                                 << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\" ";
                DEBUG_STREAM << "DataBase::PutClassAttributeProperty2(): sql_query " << sql_query_stream.str()
                             << std::endl;
@@ -6285,7 +6285,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *

                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_attribute_class SET class=\'" << tmp_class
                                     << "\',attribute=\'" << tmp_attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                     << "\',attribute=\'" << attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                     << tmp_count_str << "\',value=\'" << tmp_escaped_string
                                     << "\',updated=NOW(),accessed=NOW()";
                    DEBUG_STREAM << "DataBase::PutClassAttributeProperty2(): sql_query " << sql_query_stream.str()
@@ -6296,7 +6296,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *

                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_attribute_class_hist SET class=\'" << tmp_class
                                     << "\',attribute=\'" << tmp_attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                     << "\',attribute=\'" << attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                     << tmp_count_str << "\',id=\'" << class_attribute_property_hist_id << "\',value=\'"
                                     << tmp_escaped_string << "\'";
                    DEBUG_STREAM << "DataBase::PutClassAttributeProperty2(): sql_query " << sql_query_stream.str()
@@ -6304,7 +6304,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *
                    simple_query(sql_query_stream.str(), "db_put_class_attribute_property2()", al.get_dch());
                }
                purge_att_property(
                    "property_attribute_class_hist", "class", tmp_class, tmp_attribute, tmp_name, al.get_dch());
                    "property_attribute_class_hist", "class", tmp_class, attribute, tmp_name, al.get_dch());
                k = k + n_rows + 2;
            }
            k = k + 2;
@@ -6501,7 +6501,7 @@ void DataBase::db_put_device_attribute_property(const Tango::DevVarStringArray *

    const Tango::DevVarStringArray *property_list = argin;
    TangoSys_MemStream sql_query_stream;
    const char *device, *tmp_attribute, *tmp_name;
    const char *device, *attribute, *tmp_name;

    TimeVal before, after;
    GetTime(before);
@@ -6518,7 +6518,7 @@ void DataBase::db_put_device_attribute_property(const Tango::DevVarStringArray *
        for(i = 0; i < n_attributes; i++)
        {
            device = (*property_list)[0];
            tmp_attribute = (*property_list)[k];
            attribute = (*property_list)[k];
            const int n_properties = ParseString<int>((*property_list)[k + 1]);

            for(j = k + 2; j < k + n_properties * 2 + 2; j = j + 2)
@@ -6529,7 +6529,7 @@ void DataBase::db_put_device_attribute_property(const Tango::DevVarStringArray *
                // first delete the tuple (device,name,count) from the property table
                sql_query_stream.str("");
                sql_query_stream << "DELETE FROM property_attribute_device WHERE device LIKE \"" << device
                                 << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                                 << "\"";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;

@@ -6538,8 +6538,8 @@ void DataBase::db_put_device_attribute_property(const Tango::DevVarStringArray *
                // then insert the new value for this tuple
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_attribute_device SET device='" << device << "',attribute='"
                                 << tmp_attribute << "',name='" << tmp_name << "',count='1',value='"
                                 << tmp_escaped_string << "',updated=NOW(),accessed=NOW()";
                                 << attribute << "',name='" << tmp_name << "',count='1',value='" << tmp_escaped_string
                                 << "',updated=NOW(),accessed=NOW()";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_device_attribute_property()", al.get_dch());

@@ -6547,14 +6547,14 @@ void DataBase::db_put_device_attribute_property(const Tango::DevVarStringArray *
                Tango::DevULong64 device_attribute_property_hist_id = get_id("device_attribute", al.get_dch());
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_attribute_device_hist SET device='" << device
                                 << "',attribute='" << tmp_attribute << "',name='" << tmp_name << "',id='"
                                 << "',attribute='" << attribute << "',name='" << tmp_name << "',id='"
                                 << device_attribute_property_hist_id << "',count='1',value='" << tmp_escaped_string
                                 << "'";
                DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_device_attribute_property()", al.get_dch());

                purge_att_property(
                    "property_attribute_device_hist", "device", device, tmp_attribute, tmp_name, al.get_dch());
                    "property_attribute_device_hist", "device", device, attribute, tmp_name, al.get_dch());
            }
            k = k + n_properties * 2 + 2;
        }
@@ -6592,7 +6592,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    const char *device, *tmp_attribute, *tmp_name;
    const char *device, *attribute, *tmp_name;

    TimeVal before, after;
    GetTime(before);
@@ -6617,7 +6617,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
            for(i = 0; i < n_attributes; i++)
            {
                device = (*argin)[0];
                tmp_attribute = (*argin)[k];
                attribute = (*argin)[k];
                const int n_properties = ParseString<int>((*argin)[k + 1]);
                for(jj = 0; jj < n_properties; jj++)
                {
@@ -6627,7 +6627,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
                    // first delete the tuple (device,name,count) from the property table
                    sql_query_stream.str("");
                    sql_query_stream << "DELETE FROM property_attribute_device WHERE device LIKE \"" << device
                                     << "\" AND attribute LIKE \"" << tmp_attribute << "\" AND name LIKE \"" << tmp_name
                                     << "\" AND attribute LIKE \"" << attribute << "\" AND name LIKE \"" << tmp_name
                                     << "\" ";
                    DEBUG_STREAM << "DataBase::PutAttributeProperty2(): sql_query " << sql_query_stream.str()
                                 << std::endl;
@@ -6646,8 +6646,8 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
                        // then insert the new value for this tuple
                        sql_query_stream.str("");
                        sql_query_stream << "INSERT INTO property_attribute_device SET device=\'" << device
                                         << "\',attribute=\'" << tmp_attribute << "\',name=\'" << tmp_name
                                         << "\',count=\'" << tmp_count_str << "\',value=\'" << tmp_escaped_string
                                         << "\',attribute=\'" << attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                         << tmp_count_str << "\',value=\'" << tmp_escaped_string
                                         << "\',updated=NOW(),accessed=NOW()";
                        DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str()
                                     << std::endl;
@@ -6656,16 +6656,15 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
                        // then insert the new value into the history table
                        sql_query_stream.str("");
                        sql_query_stream << "INSERT INTO property_attribute_device_hist SET device=\'" << device
                                         << "\',attribute=\'" << tmp_attribute << "\',name=\'" << tmp_name
                                         << "\',count=\'" << tmp_count_str << "\',id=\'"
                                         << device_attribute_property_hist_id << "\',value=\'" << tmp_escaped_string
                                         << "\'";
                                         << "\',attribute=\'" << attribute << "\',name=\'" << tmp_name << "\',count=\'"
                                         << tmp_count_str << "\',id=\'" << device_attribute_property_hist_id
                                         << "\',value=\'" << tmp_escaped_string << "\'";
                        DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str()
                                     << std::endl;
                        simple_query(sql_query_stream.str(), "db_put_device_attribute_property2()", al.get_dch());
                    }
                    purge_att_property(
                        "property_attribute_device_hist", "device", device, tmp_attribute, tmp_name, al.get_dch());
                        "property_attribute_device_hist", "device", device, attribute, tmp_name, al.get_dch());
                    k = k + n_rows + 2;
                }
                k = k + 2;
@@ -9376,7 +9375,7 @@ Tango::DevString DataBase::db_get_device_host(Tango::DevString argin)
void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin, AutoLock &al)
{
    const char *device = (*argin)[0];
    const char *tmp_attribute = (*argin)[2];
    const char *attribute = (*argin)[2];

    //
    // First the update
@@ -9385,7 +9384,7 @@ void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin, Auto
    std::stringstream sql_query_stream;
    std::string tmp_escaped_string = escape_string((*argin)[6]);
    sql_query_stream << "UPDATE property_attribute_device SET value=\"" << tmp_escaped_string << "\" WHERE device=\""
                     << device << "\" AND attribute=\"" << tmp_attribute << "\" AND name=\"__value\" AND count=1";
                     << device << "\" AND attribute=\"" << attribute << "\" AND name=\"__value\" AND count=1";
    DEBUG_STREAM << "DataBase::PutAttributeProperty2(): sql_query " << sql_query_stream.str() << std::endl;

    std::string sql_query = sql_query_stream.str();
@@ -9401,7 +9400,7 @@ void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin, Auto

        sql_query_stream.str("");
        sql_query_stream << "INSERT INTO property_attribute_device SET device=\'" << device << "\',attribute=\'"
                         << tmp_attribute << "\',name=\'__value\',count=1,value=\'" << tmp_escaped_string
                         << attribute << "\',name=\'__value\',count=1,value=\'" << tmp_escaped_string
                         << "\',updated=NOW(),accessed=NOW()";
        DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << std::endl;