Tango database

Hi Manu and Emmanuel,

here it is another patch for your new myisam db version

diff –git a/cppserver/database/DataBase.cpp b/cppserver/database/DataBase.cpp
index 684d622..0dad4e3 100644
— a/cppserver/database/DataBase.cpp
+++ b/cppserver/database/DataBase.cpp
@@ -6516,7 +6516,7 @@ void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin)
 //
 
     stringstream sql_query_stream;
-    sql_query_stream << "UPDATE property_attribute_device SET value=\"" << (*argin)[6]
+    sql_query_stream << "UPDATE property_attribute_device SET value=\"" << escape_string((*argin)[6])
                      << "\" WHERE device=\"" << tmp_device << "\" AND attribute=\"" << tmp_attribute
                      << "\" AND name=\"__value\" AND count=1";
     DEBUG_STREAM << "DataBase::PutAttributeProperty2(): sql_query " << sql_query_stream.str() << endl;

Without it I get the following error:

Failed to query TANGO database (error=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'controllers": {"haso228k:10000/controller/dgg2ctrl/dgg2_exp_02": {"units": {"0":' at line 1)
.The query was: UPDATE property_attribute_device SET value="{"controllers": {"haso228k:10000/controller/dgg2ctrl/dgg2_exp_02": {"units": {"0": {"channels": 
…

Cheers,
Jan
or


@@ -6516,7 +6516,8 @@ void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin)
 //
 
     stringstream sql_query_stream;
-    sql_query_stream << "UPDATE property_attribute_device SET value=\"" << (*argin)[6]
+    string tmp_escaped_string = escape_string((*argin)[6]);
+    sql_query_stream << "UPDATE property_attribute_device SET value=\"" << tmp_escaped_string
                      << "\" WHERE device=\"" << tmp_device << "\" AND attribute=\"" << tmp_attribute
                      << "\" AND name=\"__value\" AND count=1";
     DEBUG_STREAM << "DataBase::PutAttributeProperty2(): sql_query " << sql_query_stream.str() << endl;
Also into the insert query should be added similar modification, i.e.

diff –git a/cppserver/database/DataBase.cpp b/cppserver/database/DataBase.cpp
index 8fea02e..461e866 100644
— a/cppserver/database/DataBase.cpp
+++ b/cppserver/database/DataBase.cpp
@@ -6553,7 +6553,7 @@ void DataBase::create_update_mem_att(const Tango::DevVarStringArray *argin)
         sql_query_stream.str("");
         sql_query_stream << "INSERT INTO property_attribute_device SET device=\'"
                          << tmp_device << "\',attribute=\'" << tmp_attribute
-                         << "\',name=\'__value\',count=1,value=\'" << (*argin)[6] << "\',updated=NULL,accessed=NULL";
+                         << "\',name=\'__value\',count=1,value=\'" << tmp_escaped_string << "\',updated=NULL,accessed=NULL";
         DEBUG_STREAM << "DataBase::PutAttributeProperty(): sql_query " << sql_query_stream.str() << endl;
 
         sql_query = sql_query_stream.str();
Hi,

Just to make some updates. I've noticed that my database is blocked by any extensive disk usage of other
processes (e.g. TSM in my case). I've found the coincidence by making use of
iostat -m -x 1 -t

If such a process has to use the same disk as Tango Database one can consider

renice 10  -p `pidof dsmcad`
ionice -c3 -p `pidof dsmcad`
where dsmcad is an example of the blocking process.

Cheers,
Jan
Hi Jan,

Thank's for the patches you sent some weeks ago. They are now included in trunk.

Cheers

Emmanuel
Good day to everyone,

I'm not sure whether I ask my question in the right topic, but It is related to the TANGO Database. At ELI-ALPS, we'd like to create an application which is able to import to and export from the TANGO database using the available PyTango API. We've seen (and I also tried) Cosylab's very impressive and thorough work with importing records from csv files to the database, which can give us a big hint on how to proceed and what to prepare for such a program. However, before we go too much forward in the development, we'd like to investigate a little bit whether somebody in the TANGO community has created such a work, or just interested in the project. The goal of the application would be to import and export devices in the database along with configuring the Starter devices if its needed, therefore the final result would be a slice of a portable, easily configured TANGO system.

I wish you the bests,
Peter
 
Register or login to create to post a reply.