[missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync

Scott Gruby sgruby at markspace.com
Thu Jun 2 08:32:51 PDT 2005


On Jun 2, 2005, at 12:34 AM, Dan Fletcher wrote:

> I'm having some problems with conduits when they try and create  
> databases
> on the Palm.
>
> First some background:
> I'm trying to port the NoteStudio conduit from Windows to Mac. This is
> quite a complicated conduit, that can sync multiple networked  
> computers,
> and uses multiple databases on the Palm. These database names are
> dynamically named, so their names aren't known at compile time.
>
> I'm using XTools 1.5, installed on an iBook g4 with OSX 10.3.9,  
> using the
> Cocoa MemoPad demo provided on the MarkSpace website, linking  
> against the
> 10.2.8 SDK and Palm CDK 4.0.3, and I'm using Missing Sync version  
> 4.0.5
> (v63)
>
> Fortunately the conduit was initially designed on windows with the  
> sync
> logic and the setup separated, so I thought porting it should be quite
> easy. The first thing I tried was just retrofitting the demo  
> conduit with
> our code. It compiled and linked ok, but whenever it tried to create a
> database, a "funny" database would be created instead. It would  
> have the
> correct creatorID, but everything else would be wrong. The name  
> would be
> rubbish(Looking at the filename in a hex editor, it would be ascii  
> code
> 08), the type field would contain rubbish, etc.
>
> So I tried just doing the create DB code in the demo conduit. Same  
> effect.
> So I tried copy and pasting the create db code from the demo  
> itself, just
> to make it create the file. Same effect!
>
> The original code compiled on windows, and the other code came from  
> the
> demo, so I don't think the code is the problem. But just in case,  
> the code
> is like this (Pasted in the demo just above: // Grab the memo pad  
> data for
> the current user.)
>
>         CDbCreateDB createInfo;
>         createInfo.m_FileHandle = 0;
>         createInfo.m_Creator = 'DMWI';
>         createInfo.m_Flags = (eDbFlags) (eRecord | eBackupDB);
>         createInfo.m_CardNo = 0;
>         memset(createInfo.m_Name,SYNC_DB_NAMELEN,0);
>         strcpy(createInfo.m_Name, "aa_dan");
>         createInfo.m_Type = 'DATA';
>         createInfo.m_Version = 0;
>         createInfo.m_dwReserved = 0;
>         syncErr = [mSyncMgr createDB:createInfo];
>         if (syncErr == SYNCERR_NONE)
>         {
>                 syncErr = [mSyncMgr closeDB:mDbHandle];
>         }
>         return 0;
>
>
> It looks like everything else works, just not creating databases.  
> Any ideas
> about what I could be doing wrong?
>

Yes. You're closing mDbHandle that is never set. You need to do:

          if (syncErr == SYNCERR_NONE)
         {
             mDbHandle = createInfo.m_FileHandle;
             syncErr = [mSyncMgr closeDB:mDbHandle];
         }

The database is created at the time of close, but you must pass a  
valid database handle.


> I'm copying the created plugin files into /Library/Application  
> Support/Palm
> HotSync/Conduit directory. I know the conduit is being run correctly,
> because Log statements I add are shown in the Hot Sync log.
>
> A few other questions that came up whilst I was doing this.
> 1) Is it a requirement to link against the 10.2.8 SDK?

No. However, whatever SDK you link against is the minimum requirement  
for your conduit (more or less).

> I didn't have this
> at first, so I was linking against the current OS SDK. Since then I've
> downloaded the 10.2.8 SDK, and link against that instead, but it  
> doesn't
> seem to make any difference.
>
> 2) Do the original Palm CDK API calls still work? Can I call  
> SyncCreateDB,
> or should I call [mSyncManager createDB] ? I've tried both, with no
> apparent change. I'd rather call SyncCreateDB if I can, because it  
> won't
> require any code changes...
>

Yes you can make calls using the Palm CDK APIs.

> 3) What exactly is the Remote Database Names list in the  
> ConduitInfo.plist
> file used for? Can the conduit create databases NOT in that list?  
> There is
> no way for us to know all the database names at compile time, so  
> hopefully
> this isn't a requirement.

Please check the Palm CDK documentation for an explanation; it is the  
same as what is contained in the CInf resource. You can create  
databases not in the list; the list is a convenience list.

--
Scott Gruby
Lead Engineer
Mark/Space, Inc.
<http://www.markspace.com/>

Please visit <http://www.markspace.com/support/> for assistance with  
Mark/Space products.



More information about the missing-sync-palmos-dev-talk mailing list