Palm OS/C/数据库编程
外观
UInt16 cardNo = 0; LocalID databaseId = DmFindDatabase( cardNo, "YourAppDB"); if ( databaseId) { UInt16 mode = dmModeReadOnly; DmOpenRef database = DmOpenDatabase( cardNo, databaseId, mode); }
if ( database) { Err e = DmCloseDatabase( database); }
UInt16 numRecords = DmNumRecords( database); UInt16 recordIndex; for ( recordIndex = 0; recordIndex < numRecords; ++ recordIndex) { MemHandle record = DmQueryRecord( database, recordIndex); if ( record) { UInt32 recordSize = MemHandleSize( record); char *data = MemHandleLock( record); Err e = MemHandleUnlock( record); } }
sudo apt-get install ruby rubygems sudo gem install --include-dependencies --no-rdoc --no-ri palm
#!/usr/bin/env ruby # require 'rubygems' require 'palm' pdb = Palm::PDB.new pdb.name = 'YourAppDB' pdb.creator = 'Anon' pdb.type = 'DATA' pdb.version = 1 pdb.data << Palm::RawRecord.new( 'Hello') pdb.data << Palm::RawRecord.new( 'World') pdb.write_file 'YourAppDB.pdb'