Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Programming for Palm OS/C/Databases

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

to open a database UInt16 cardNo = 0; LocalID databaseId = DmFindDatabase( cardNo, "YourAppDB"); if ( databaseId) { UInt16 mode = dmModeReadOnly; DmOpenRef database = DmOpenDatabase( cardNo, databaseId, mode); } to close a database if ( database) { Err e = DmCloseDatabase( database); } to walk the records of a 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); } } to create databases on your workstation 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'