[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldsync-hackers] p5-Palm insert Record



On Sat, Sep 29, 2001 at 01:50:48PM -0400, John-David Smith wrote:
> What I'm interested in specifically is the atP "pointer to an index", and the
> statement that subsequent record's indices are "shifted down" upon insertion.  I
> haven't found an equivalent field in the Palm/PDB documentation (I'm pretty sure
> it's not "offset"), and I'm not sure if it's trivially changeable.  
> 
> I'd like to be able to replicate such an insertion action which can be performed
> on the Palm, by crafting a new PDB function "insert_Record()", which takes such
> an index.  Inserting directly into or sorting the perl array @{$self->{records}}
> doesn't seem to accomplish this.

	Just use new_Record() to create the record, then insert it
into the list by hand, e.g.:

	# @{$pdb->{records}} contains A, B, C.

	$record = new_Record();
	# Initialize $record...

	splice @{$pdb->{records}}, 1, 0, $record;
	# @{$pdb->{records}} now contains A, New, B, C.

(this is pretty much all that append_Record() does). Of course, since
you're modifying the master list of records, all the usual caveats
apply: if you do this inside a
	for (@{$pdb->{records}})
loop, the loop may not execute the way you want. But other than that,
it's safe. Once you write the database, the order of the records
should be the one specified.
	So I'm not sure what you mean when you say that inserting
directly into the array doesn't accomplish what you want.

	It also occurs to me that perhaps you're trying to change the
order of the records as they're stored on the Palm. If so, then the
above probably won't help.
	If you just add the new record on the desktop and rely on a
sync to upload it, then it probably won't get inserted where you want,
since ColdSync and other sync tools shouldn't care about the order of
records. You can delete the database on the Palm, then upload it from
the desktop, but I don't know whether that'll work.
	Databases also have a "sort block." I gather that this allows
you to specify the order in which the records are displayed on the
Palm, but I've never actually run across a database with a sort block,
so I don't know.

	Does this help?

-- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
			Reunite Gondwanaland!
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.