TSQLFile on WinXP

Hi!

I’ve got a problem with TSQLFiles. Have a look a this test code:

[code] double t_[1] = {4};
TObjString *t = new TObjString(“type”);
TVectorT *type = new TVectorT(1, t_);

double s_[2] = {1, 18};
TObjString *s = new TObjString("size");
TVectorT<double> *size = new TVectorT<double>(1, s_);

TObjString *d = new TObjString("data");
TObjString *data = new TObjString("Dies ist ein Test!");

TMap *v = new TMap();

v->Add(t, type);
v->Add(s, size);
v->Add(d, data);

TFile *f = new TSQLFile("mysql://localhost/root", "update", "***", "***");

Sleep(1000);

if (f == NULL) {mexPrintf("test0\n");}
if (f->IsZombie()) { mexPrintf("test1\n"); }	
if (!f->IsOpen()) { mexPrintf("test2\n"); }	

mexPrintf("%i\n", v->Write("test", TObject::kSingleKey));

f->Close();
rdelete(v);
delete f;[/code]

What’s wrong with it? First I compose my data structure. When writing it to file none of the if-statements is matched. The write-method returns 0. Some tables (not all) are created in the database, but no data is written. Closing the file produces error messages: Some tables are missing or do already exist.

I tested it on WinXP.

Thank you for your help.
Kind regards, Johannes Kissel.

Hi, Johannes

Which version of ROOT you are using? There was an issue with ROOT 5.20 (or later), which is now fixed in repository version. Or try some of 5.18 versions.

I was trying you script on my local installation of current repository version (WinXP Cygwin) - it works with several changes without any problem.

Probably, for first time you should call TSQLFile constructor with “recreate” option. Please also look that you can create tables in your database.

Regards,
Sergey

void test()
{   
   double t_[1] = {4};
   TObjString *t = new TObjString("type");
   TVectorT<double> *type = new TVectorT<double>(1, t_);
   
   double s_[2] = {1, 18};
   TObjString *s = new TObjString("size");
   TVectorT<double> *size = new TVectorT<double>(1, s_);
   
   TObjString *d = new TObjString("data");
   TObjString *data = new TObjString("Dies ist ein Test!");
   
   TMap *v = new TMap();
   
   v->Add(t, type);
   v->Add(s, size);
   v->Add(d, data);
   
   TFile *f = new TSQLFile("mysql://localhost/root", "recreate", "***", "***");
   
//   Sleep(1000);
   
   if (f == NULL) {mexPrintf("test0\n");}
   if (f->IsZombie()) { mexPrintf("test1\n"); }   
   if (!f->IsOpen()) { mexPrintf("test2\n"); }   

//    mexPrintf("res = %d\n", v->Write("test", TObject::kSingleKey));
   
   int res = v->Write("test", TObject::kSingleKey);
   printf("write res = %d\n", res);

   f->Close();
   delete v; v = 0;
   delete f;



   f = new TSQLFile("mysql://localhost/root", "read", "***", "***");

   f->GetObject("test", v);

   printf("read obj = %p\n", v);
   delete f;

}