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

DataBase.cpp: Remove tmp prefix from tmp_count* variables

parent 5b72fc6e
Loading
Loading
Loading
Loading
+48 −48
Original line number Diff line number Diff line
@@ -6230,7 +6230,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *
    /* clang-format on */

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *cls, *attribute, *name;

    const int n_attributes = ParseString<int>((*argin)[1]);
@@ -6240,7 +6240,7 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *
    {
        AutoLock al(this);

        int tmp_count, i, j, k, l, jj;
        int count, i, j, k, l, jj;
        k = 2;
        for(i = 0; i < n_attributes; i++)
        {
@@ -6262,20 +6262,20 @@ void DataBase::db_put_class_attribute_property2(const Tango::DevVarStringArray *
                simple_query(sql_query_stream.str(), "db_put_class_attribute_property2()", al.get_dch());

                const int n_rows = ParseString<int>((*argin)[j + 1]);
                tmp_count = 0;
                count = 0;
                Tango::DevULong64 class_attribute_property_hist_id = get_id("class_attribute", al.get_dch());
                for(l = j + 1; l < j + n_rows + 1; l++)
                {
                    std::string escaped_string = escape_string((*argin)[l + 1]);
                    tmp_count++;
                    snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                    count++;
                    snprintf(count_str, sizeof(count_str), "%d", count);

                    // then insert the new value for this tuple

                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_attribute_class SET class=\'" << cls << "\',attribute=\'"
                                     << attribute << "\',name=\'" << name << "\',count=\'" << tmp_count_str
                                     << "\',value=\'" << escaped_string << "\',updated=NOW(),accessed=NOW()";
                                     << attribute << "\',name=\'" << name << "\',count=\'" << count_str << "\',value=\'"
                                     << escaped_string << "\',updated=NOW(),accessed=NOW()";
                    DEBUG_STREAM << "DataBase::PutClassAttributeProperty2(): sql_query " << sql_query_stream.str()
                                 << std::endl;
                    simple_query(sql_query_stream.str(), "db_put_class_attribute_property2()", al.get_dch());
@@ -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_hist SET class=\'" << cls
                                     << "\',attribute=\'" << attribute << "\',name=\'" << name << "\',count=\'"
                                     << tmp_count_str << "\',id=\'" << class_attribute_property_hist_id << "\',value=\'"
                                     << count_str << "\',id=\'" << class_attribute_property_hist_id << "\',value=\'"
                                     << escaped_string << "\'";
                    DEBUG_STREAM << "DataBase::PutClassAttributeProperty2(): sql_query " << sql_query_stream.str()
                                 << std::endl;
@@ -6323,7 +6323,7 @@ void DataBase::db_put_class_property(const Tango::DevVarStringArray *argin)

    const Tango::DevVarStringArray *property_list = argin;
    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *cls, *name;

    TimeVal before, after;
@@ -6337,13 +6337,13 @@ void DataBase::db_put_class_property(const Tango::DevVarStringArray *argin)
        AutoLock al(this);

        int i, j, k;
        int tmp_count;
        int count;

        k = 2;
        cls = (*property_list)[0];
        for(i = 0; i < n_properties; i++)
        {
            tmp_count = 0;
            count = 0;
            name = (*property_list)[k];

            // first delete all tuples (device,name) from the property table
@@ -6358,20 +6358,20 @@ void DataBase::db_put_class_property(const Tango::DevVarStringArray *argin)
            for(j = k + 2; j < k + n_rows + 2; j++)
            {
                std::string escaped_string = escape_string((*property_list)[j]);
                tmp_count++;
                snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                count++;
                snprintf(count_str, sizeof(count_str), "%d", count);

                // then insert the new value for this tuple
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_class SET class='" << cls << "',name='" << name << "',count='"
                                 << tmp_count_str << "',value='" << escaped_string << "',updated=NOW(),accessed=NOW()";
                                 << count_str << "',value='" << escaped_string << "',updated=NOW(),accessed=NOW()";
                DEBUG_STREAM << "DataBase::PutClassProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_class_property()", al.get_dch());

                // then insert the new value into the history table
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_class_hist SET class='" << cls << "',name='" << name
                                 << "',count='" << tmp_count_str << "',id='" << class_property_hist_id << "',value='"
                                 << "',count='" << count_str << "',id='" << class_property_hist_id << "',value='"
                                 << escaped_string << "'";
                DEBUG_STREAM << "DataBase::PutClassProperty(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_class_property()", al.get_dch());
@@ -6573,7 +6573,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
    /* clang-format on */

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *device, *attribute, *name;

    TimeVal before, after;
@@ -6594,7 +6594,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
        {
            AutoLock al(this);

            int tmp_count, i, j, k, l, jj;
            int count, i, j, k, l, jj;
            k = 2;
            for(i = 0; i < n_attributes; i++)
            {
@@ -6616,20 +6616,20 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
                    simple_query(sql_query_stream.str(), "db_put_device_attribute_property2()", al.get_dch());

                    const int n_rows = ParseString<int>((*argin)[j + 1]);
                    tmp_count = 0;
                    count = 0;
                    Tango::DevULong64 device_attribute_property_hist_id = get_id("device_attribute", al.get_dch());

                    for(l = j + 1; l < j + n_rows + 1; l++)
                    {
                        std::string escaped_string = escape_string((*argin)[l + 1]);
                        tmp_count++;
                        snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                        count++;
                        snprintf(count_str, sizeof(count_str), "%d", count);

                        // then insert the new value for this tuple
                        sql_query_stream.str("");
                        sql_query_stream << "INSERT INTO property_attribute_device SET device=\'" << device
                                         << "\',attribute=\'" << attribute << "\',name=\'" << name << "\',count=\'"
                                         << tmp_count_str << "\',value=\'" << escaped_string
                                         << count_str << "\',value=\'" << escaped_string
                                         << "\',updated=NOW(),accessed=NOW()";
                        DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str()
                                     << std::endl;
@@ -6639,7 +6639,7 @@ void DataBase::db_put_device_attribute_property2(const Tango::DevVarStringArray
                        sql_query_stream.str("");
                        sql_query_stream << "INSERT INTO property_attribute_device_hist SET device=\'" << device
                                         << "\',attribute=\'" << attribute << "\',name=\'" << name << "\',count=\'"
                                         << tmp_count_str << "\',id=\'" << device_attribute_property_hist_id
                                         << count_str << "\',id=\'" << device_attribute_property_hist_id
                                         << "\',value=\'" << escaped_string << "\'";
                        DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str()
                                     << std::endl;
@@ -6682,7 +6682,7 @@ void DataBase::db_put_device_property(const Tango::DevVarStringArray *argin)

    const Tango::DevVarStringArray *property_list = argin;
    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *device;
    std::string name;

@@ -6697,12 +6697,12 @@ void DataBase::db_put_device_property(const Tango::DevVarStringArray *argin)
        AutoLock al(this);

        int i, j, k;
        int tmp_count;
        int count;

        k = 2;
        for(i = 0; i < n_properties; i++)
        {
            tmp_count = 0;
            count = 0;
            device = (*property_list)[0];
            name = (*property_list)[k];

@@ -6719,13 +6719,13 @@ void DataBase::db_put_device_property(const Tango::DevVarStringArray *argin)
            for(j = k + 2; j < k + n_rows + 2; j++)
            {
                std::string escaped_string = escape_string((*property_list)[j]);
                tmp_count++;
                snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                count++;
                snprintf(count_str, sizeof(count_str), "%d", count);

                // then insert the new value for this tuple
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_device SET device='" << device << "',name='" << name
                                 << "',count='" << tmp_count_str << "',value='" << escaped_string
                                 << "',count='" << count_str << "',value='" << escaped_string
                                 << "',updated=NOW(),accessed=NOW()";
                DEBUG_STREAM << "DataBase::PutDeviceProperty(): sql_query " << sql_query_stream.str() << std::endl;

@@ -6734,7 +6734,7 @@ void DataBase::db_put_device_property(const Tango::DevVarStringArray *argin)
                // insert the new value into the history table
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_device_hist SET device='" << device << "',id='"
                                 << device_property_hist_id << "',name='" << name << "',count='" << tmp_count_str
                                 << device_property_hist_id << "',name='" << name << "',count='" << count_str
                                 << "',value='" << escaped_string << "'";

                DEBUG_STREAM << "DataBase::PutDeviceProperty(): sql_query " << sql_query_stream.str() << std::endl;
@@ -6786,11 +6786,11 @@ void DataBase::db_put_property(const Tango::DevVarStringArray *argin)
        AutoLock al(this);

        int k = 2;
        int tmp_count;
        int count;

        for(int i = 0; i < n_properties; i++)
        {
            tmp_count = 0;
            count = 0;
            name = (*property_list)[k];
            const int n_rows = ParseString<int>((*property_list)[k + 1]);

@@ -6804,19 +6804,19 @@ void DataBase::db_put_property(const Tango::DevVarStringArray *argin)
            for(int j = k + 2; j < k + n_rows + 2; j++)
            {
                std::string escaped_string = escape_string((*property_list)[j]);
                tmp_count++;
                count++;

                // then insert the new value for this tuple
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property SET object='" << object << "',name='" << name << "',count='"
                                 << tmp_count << "',value='" << escaped_string << "',updated=NOW(),accessed=NOW()";
                                 << count << "',value='" << escaped_string << "',updated=NOW(),accessed=NOW()";
                DEBUG_STREAM << "DataBase::db_put_property(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_property()", al.get_dch());

                // then insert the new value into history table
                sql_query_stream.str("");
                sql_query_stream << "INSERT INTO property_hist SET object='" << object << "',name='" << name
                                 << "',count='" << tmp_count << "',id='" << object_property_hist_id << "',value='"
                                 << "',count='" << count << "',id='" << object_property_hist_id << "',value='"
                                 << escaped_string << "'";
                DEBUG_STREAM << "DataBase::db_put_property(): sql_query " << sql_query_stream.str() << std::endl;
                simple_query(sql_query_stream.str(), "db_put_property()", al.get_dch());
@@ -8762,7 +8762,7 @@ void DataBase::db_put_class_pipe_property(const Tango::DevVarStringArray *argin)
    /* clang-format on */

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *cls, *pipe, *name;

    const int n_pipes = ParseString<int>((*argin)[1]);
@@ -8772,7 +8772,7 @@ void DataBase::db_put_class_pipe_property(const Tango::DevVarStringArray *argin)
    {
        AutoLock al(this);

        int tmp_count, i, j, k, l, jj;
        int count, i, j, k, l, jj;
        k = 2;
        for(i = 0; i < n_pipes; i++)
        {
@@ -8793,19 +8793,19 @@ void DataBase::db_put_class_pipe_property(const Tango::DevVarStringArray *argin)
                simple_query(sql_query_stream.str(), "db_put_class_pipe_property()", al.get_dch());

                const int n_rows = ParseString<int>((*argin)[j + 1]);
                tmp_count = 0;
                count = 0;
                Tango::DevULong64 class_pipe_property_hist_id = get_id("class_pipe", al.get_dch());
                for(l = j + 1; l < j + n_rows + 1; l++)
                {
                    std::string escaped_string = escape_string((*argin)[l + 1]);
                    tmp_count++;
                    snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                    count++;
                    snprintf(count_str, sizeof(count_str), "%d", count);

                    // then insert the new value for this tuple

                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_pipe_class SET class=\'" << cls << "\',pipe=\'" << pipe
                                     << "\',name=\'" << name << "\',count=\'" << tmp_count_str << "\',value=\'"
                                     << "\',name=\'" << name << "\',count=\'" << count_str << "\',value=\'"
                                     << escaped_string << "\',updated=NOW(),accessed=NOW()";
                    DEBUG_STREAM << "DataBase::PutClassPipeProperty(): sql_query " << sql_query_stream.str()
                                 << std::endl;
@@ -8815,7 +8815,7 @@ void DataBase::db_put_class_pipe_property(const Tango::DevVarStringArray *argin)

                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_pipe_class_hist SET class=\'" << cls << "\',pipe=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << tmp_count_str << "\',id=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << count_str << "\',id=\'"
                                     << class_pipe_property_hist_id << "\',value=\'" << escaped_string << "\'";
                    DEBUG_STREAM << "DataBase::PutClassPipeProperty(): sql_query " << sql_query_stream.str()
                                 << std::endl;
@@ -8853,7 +8853,7 @@ void DataBase::db_put_device_pipe_property(const Tango::DevVarStringArray *argin
    /* clang-format on */

    TangoSys_MemStream sql_query_stream;
    char tmp_count_str[256];
    char count_str[256];
    const char *device, *pipe, *name;

    TimeVal before, after;
@@ -8866,7 +8866,7 @@ void DataBase::db_put_device_pipe_property(const Tango::DevVarStringArray *argin
    {
        AutoLock al(this);

        int tmp_count, i, j, k, l, jj;
        int count, i, j, k, l, jj;
        k = 2;
        for(i = 0; i < n_pipes; i++)
        {
@@ -8887,19 +8887,19 @@ void DataBase::db_put_device_pipe_property(const Tango::DevVarStringArray *argin
                simple_query(sql_query_stream.str(), "db_put_device_pipe_property()", al.get_dch());

                const int n_rows = ParseString<int>((*argin)[j + 1]);
                tmp_count = 0;
                count = 0;
                Tango::DevULong64 device_pipe_property_hist_id = get_id("device_pipe", al.get_dch());

                for(l = j + 1; l < j + n_rows + 1; l++)
                {
                    std::string escaped_string = escape_string((*argin)[l + 1]);
                    tmp_count++;
                    snprintf(tmp_count_str, sizeof(tmp_count_str), "%d", tmp_count);
                    count++;
                    snprintf(count_str, sizeof(count_str), "%d", count);

                    // then insert the new value for this tuple
                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_pipe_device SET device=\'" << device << "\',pipe=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << tmp_count_str << "\',value=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << count_str << "\',value=\'"
                                     << escaped_string << "\',updated=NOW(),accessed=NOW()";
                    DEBUG_STREAM << "DataBase::DbPutDevicePipeProperty(): sql_query " << sql_query_stream.str()
                                 << std::endl;
@@ -8908,7 +8908,7 @@ void DataBase::db_put_device_pipe_property(const Tango::DevVarStringArray *argin
                    // then insert the new value into the history table
                    sql_query_stream.str("");
                    sql_query_stream << "INSERT INTO property_pipe_device_hist SET device=\'" << device << "\',pipe=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << tmp_count_str << "\',id=\'"
                                     << pipe << "\',name=\'" << name << "\',count=\'" << count_str << "\',id=\'"
                                     << device_pipe_property_hist_id << "\',value=\'" << escaped_string << "\'";
                    DEBUG_STREAM << "DataBase::DbPutDevicePipeProperty(): sql_query " << sql_query_stream.str()
                                 << std::endl;