[Metakit] error while database is on windows file server

Florent Lejeune flejeune at articque.com
Fri Feb 9 10:51:58 CET 2007


Hi

We use Metakit to store miscellaneous information for our programe. It works on windows, 
macosx and linux.
It happens that when the database is created on the windows network, we have some problem 
with the windows application (we use metakit-2.4.9.6).

Below you will find a program that creates a file, adds rows, and retrieves information.

The Find function doesn't return anything and a manuel search also gives no result. In our 
main program, the Find() function remains in an infinite loop.
It works fine with other plateform combinations : from windows client to simple windows 
sharing, from macosx client to windows file server and from macosx client to macosx apple share 
file server.

Thanks for any suggestion about this.

PS: our windows file server is a macosx with Samba. we compile with visual studio 2005

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <mk4.h>


void main(int argc, char **argv)
{
   char dbpath[100]="";
   printf("Choose a db destination :\n\n");
   printf("1 -  Local\n");
   printf("2 -  Network : Windows file server\n");
   printf("3 -  Network : Windows sharing\n\n");

   switch (getche())
   {
     case '1':
       strcpy(dbpath,"c:\\zdrop\\metakit_tutorial.db");
       break;
     case '2':
       strcpy(dbpath,"\\\\Noe\\Developpement\\metakit_tutorial.db");
       break;
     case '3':
       strcpy(dbpath,"\\\\Ordiludovic\\partageArticque\\metakit_tutorial.db");
       break;
     default:
       break;
   }
   printf("\n");
   if (strlen(dbpath)>0)
   {
     fflush(stdin);
     FILE *fp=NULL;
     // remove if present
     if ((fp=fopen(dbpath,"r"))!=NULL)
     {
       fclose(fp);
       unlink(dbpath);
     }
     // create db
     c4_Storage database(dbpath, true);
     // add datas
     c4_View maps=database.GetAs("maps[mid:S,mwidth:I,mheight:I,mpath:S]");
     c4_StringProp mid("mid"),mpath("mpath");
     c4_IntProp mwidth("mwidth"),mheight("mheight");
     c4_Row maprow;
     mid(maprow)="A";
     mwidth(maprow)=10;
     mheight(maprow)=10;
     mpath(maprow)="/home/MapA.vxf";
     maps.Add(maprow);
     mid(maprow)="B";
     mwidth(maprow)=20;
     mheight(maprow)=20;
     mpath(maprow)="/home/MapB.vxf";
     maps.Add(maprow);
     mid(maprow)="C";
     mwidth(maprow)=30;
     mheight(maprow)=30;
     mpath(maprow)="/home/MapC.vxf";
     maps.Add(maprow);
     // save
     database.Commit();

     // add more datas
     c4_View datas=database.GetAs("datas[did:S,dmapid:S,dpath:S]");
     // add data
     c4_StringProp did("did"),dmapid("dmapid"),dpath("dpath");
     c4_Row  datarow;
     did(datarow)="1";
     dmapid(datarow)="A";
     dpath(datarow)="/home/A1.txt";
     datas.Add(datarow);
     did(datarow)="2";
     dmapid(datarow)="A";
     dpath(datarow)="/home/A2.txt";
     datas.Add(datarow);
     did(datarow)="3";
     dmapid(datarow)="B";
     dpath(datarow)="/home/B1.txt";
     datas.Add(datarow);
     did(datarow)="4";
     dmapid(datarow)="B";
     dpath(datarow)="/home/B2.txt";
     datas.Add(datarow);
     did(datarow)="5";
     dmapid(datarow)="C";
     dpath(datarow)="/home/C1.txt";
     datas.Add(datarow);
     // save
     database.Commit();
     // Find data
     long idxsearch=-1;
     c4_Row findrow;
     dmapid(findrow)="B";
     while(1)
     {
       idxsearch=datas.Find(findrow,idxsearch+1);
       if (idxsearch>=0)
         printf("DATA %s has dmapid=%s\n",
           (const char*)dpath(datas[idxsearch]),
           (const char*)dmapid(datas[idxsearch]));
       else
         break;
     }
     // manuel search
     c4_Row strrow;
     const char*strdata;
     const char*expr="ome/B";
     for (int idx=0;idx<datas.GetSize();idx++)
     {
       strdata=(const char*)dpath(datas[idx]);
       if (strstr(strdata,expr)!=NULL)
         printf("map %s has the string '%s' in the path\n",strdata,expr);
     }


   }
   printf("Test over\n");
   getch();
}


-- 
Florent Lejeune
Développeur
 
Articque
Moulin des Roches
37230 Fondettes
France
web = http://www.articque.com
tel: +33 02 47 49 90 49
fax: +33 02 47 49 91 49 


More information about the Metakit mailing list