exporting a database

Discuss OrbForms Designer and PocketC Architect

Postby johncraw on Tue Nov 08, 2005 7:03 pm

I am trying to export a database to a volume. I am using the following code:
=====================================================
handler mnuDBExport.onselect()
{
VolumeMgr volMgr;
Volume vol;
Directory dir;
bool first;
int ret;

first = true;
if (!volMgr.enumerate(first, vol))
fldToward.text = "No volumes found";
else
{
ret = vol.openDir(Path,dir); //Open the directory

if (ret != 0)
{
fldToward.text = "Error [" + ret + "] opening path[" + Path + "]";
}
else
{
ret = vol.export(DRTableName,Path);
if (ret != 0)
{
fldToward.text = "Error [" + ret + "] exporting [" + DRTableName + "]";
}
else
{
ret = vol.export(IRTableName,Path);
if (ret != 0)
{
fldToward.text = "Error [" + ret + "] exporting [" + IRTableName + "]";
}
}
}
}
}
=====================================================
I think that all I need to do is open the directory, and then export the table. I am getting a return code of 10754 (vfsErrFileGeneric), which doesn't help me.
Is the problem that I am trying to do this in the emulator, or are there any other steps I need to go through.
Any help would be appreciated.
Thanks
John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada

Postby dewey on Wed Nov 09, 2005 3:08 am

You are using "Path" for opendir, and export twice. path for export should include the name of the file as well. As writter, the code is trying to export to a file with the same name as a directory, which won't work. However, I would have expected a more interesting error message.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby johncraw on Wed Nov 09, 2005 11:00 am

Dewey:
OK. The problem is with the documentation. According to the writeup on export:
name name of database
path ath to exported file

DRTableName and IRTabeName are the "name" of the database
and Path is, as you say, the path.

So should the Path include the file AND extension, or will the extension be added automatically?

One other question, do I need to open the directory, or will the export open it (there will only be one volume available in the implementation)?

Thanks.
John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada

Postby johncraw on Wed Nov 09, 2005 11:26 am

Dewey:
I must still be doing something wrong. I still get the same error

- I changed the export to: ret = vol.export(DRTableName,Path + "DYFile.pdb"); //I also tried it without the extension.

- I changed the error message to: fldInstruction.text = "Error [" + ret + "] (vfsErrFileGeneric) exporting [" + DRTableName + "] to [" + Path + "DYFile.pdb]" ;

The resulting message is: Error [10754] (vfsErrFileGeneric) exporting [DayRecs] to [e:\orbdata\Travel~1\DYFile.pdb]

I also tried not opening the directory. Still the same message.

Thanks
John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada

Postby dewey on Wed Nov 09, 2005 2:21 pm

Here are a few other things which I think could cause a problem:
Is the database open when you try to export it?
Is the database larger than available space of the volume?
Are you specifying the correct name for the source database?
Is there already a file by that name in the dir?
Is the emulated volume/dir read-only?
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby johncraw on Wed Nov 09, 2005 4:35 pm

Dewey:
Here are the answers to your questions.
Is the database open when you try to export it? - No.
Is the database larger than available space of the volume? - No. The 'volume' is on the pc, and has about 6gb available
Are you specifying the correct name for the source database? - Yes. These are constant values that are used throughout the program
Is there already a file by that name in the dir? - No.
Is the emulated volume/dir read-only? - Should not be, unless there is something that needs to be set up in the emulator. But shouldn't that give me a vfsErrCardReadOnly error?

Anyway later this week I will try it on an actual device, and see if I get a different result.

John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada

Postby johncraw on Thu Nov 10, 2005 12:36 pm

Whatever I am not doing on the emulator works on a volume on the pda. Since the process works, and I will never need to test the code again, I will not be concerned about it not working on the emulator. It is probably either a setting, or something that I am not quite understanding about how the emulator looks at the volume.
I do think, however, that the documantation needs to be changed to reflect that a Path sometimes means path AND filename. It is not currently clear.
John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron