error while database is on windows file server
"Florent Lejeune" <[email protected]> Fri, 9 Feb 2007 10:51:58 +0100
| Newsgroups | gmane.comp.db.metakit |
|---|---|
| Message-ID | <007e01c74c2f$f03b23d0$6e01a8c0@i3000> |
Hi
We use Metakit to store miscellaneous information for our programe. It =
works on windows,=20
macosx and linux.
It happens that when the database is created on the windows network, we =
have some problem=20
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=20
main program, the Find() function remains in an infinite loop.
It works fine with other plateform combinations : from windows client to =
simple windows=20
sharing, from macosx client to windows file server and from macosx =
client to macosx apple share=20
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]=3D"";
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=3DNULL;
// remove if present
if ((fp=3Dfopen(dbpath,"r"))!=3DNULL)
{
fclose(fp);
unlink(dbpath);
}
// create db
c4_Storage database(dbpath, true);
// add datas
c4_View =
maps=3Ddatabase.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)=3D"A";
mwidth(maprow)=3D10;
mheight(maprow)=3D10;
mpath(maprow)=3D"/home/MapA.vxf";
maps.Add(maprow);
mid(maprow)=3D"B";
mwidth(maprow)=3D20;
mheight(maprow)=3D20;
mpath(maprow)=3D"/home/MapB.vxf";
maps.Add(maprow);
mid(maprow)=3D"C";
mwidth(maprow)=3D30;
mheight(maprow)=3D30;
mpath(maprow)=3D"/home/MapC.vxf";
maps.Add(maprow);
// save
database.Commit();
// add more datas
c4_View datas=3Ddatabase.GetAs("datas[did:S,dmapid:S,dpath:S]");
// add data
c4_StringProp did("did"),dmapid("dmapid"),dpath("dpath");
c4_Row datarow;
did(datarow)=3D"1";
dmapid(datarow)=3D"A";
dpath(datarow)=3D"/home/A1.txt";
datas.Add(datarow);
did(datarow)=3D"2";
dmapid(datarow)=3D"A";
dpath(datarow)=3D"/home/A2.txt";
datas.Add(datarow);
did(datarow)=3D"3";
dmapid(datarow)=3D"B";
dpath(datarow)=3D"/home/B1.txt";
datas.Add(datarow);
did(datarow)=3D"4";
dmapid(datarow)=3D"B";
dpath(datarow)=3D"/home/B2.txt";
datas.Add(datarow);
did(datarow)=3D"5";
dmapid(datarow)=3D"C";
dpath(datarow)=3D"/home/C1.txt";
datas.Add(datarow);
// save
database.Commit();
// Find data
long idxsearch=3D-1;
c4_Row findrow;
dmapid(findrow)=3D"B";
while(1)
{
idxsearch=3Ddatas.Find(findrow,idxsearch+1);
if (idxsearch>=3D0)
printf("DATA %s has dmapid=3D%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=3D"ome/B";
for (int idx=3D0;idx<datas.GetSize();idx++)
{
strdata=3D(const char*)dpath(datas[idx]);
if (strstr(strdata,expr)!=3DNULL)
printf("map %s has the string '%s' in the =
path\n",strdata,expr);
}
}
printf("Test over\n");
getch();
}
--=20
Florent Lejeune
D=E9veloppeur
=20
Articque
Moulin des Roches
37230 Fondettes
France
web =3D http://www.articque.com
tel: +33 02 47 49 90 49
fax: +33 02 47 49 91 49=20
_____________________________________________
Metakit mailing list - [email protected]
http://www.equi4.com/mailman/listinfo/metakit