Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - deleting/replacing records in a db?

deleting/replacing records in a db?

Discuss PocketC for Palm OS (including Desktop Edition)

Postby Velvis on Tue May 15, 2001 2:54 pm

I would like to open a record in a database, edit it, and resave it. The records are in chronogical order, and I need to keep them that way. (ie I want record 2 saved back in record 2's slot)

However I cant seem to figure out how to delete the old record and resave the new one.

Suggestions?

Thanks
Velvis
 
Posts: 226
Joined: Mon Dec 11, 2000 2:32 am

Postby jstadolnik on Wed May 16, 2001 1:32 am

Try using dberase(). It removes the contents of a record without deleting the record (or it's position).

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby eftomi on Thu May 17, 2001 5:50 pm

If the records are equal in structure, this 'rewritting' technique works just fine:

-------------------------------------------
#define DATAFORMAT "sssiis"
#define DBFORMAT "szszszi4i4sz"

[...]

pointer data;
int record;
data = malloct(1,DATAFORMAT);

dbrec(record);
dbreadx(data, DBFORMAT);

[..data editing statements..]

dbrec(record);
dbwritex(data,DBFORMAT);

[...]
-------------------------------------------

I have here three strings, two integers and then another string. Variable 'record' contains the record number in question

Tomaz



Edited by - eftomi on 05/17/2001 23:44:36
eftomi
 
Posts: 8
Joined: Fri May 11, 2001 3:02 pm
Location: Slovenia

Postby Velvis on Fri May 18, 2001 1:19 pm

Will the different length of strings ever be a problem when replacing a db record?
Velvis
 
Posts: 226
Joined: Mon Dec 11, 2000 2:32 am

Postby eftomi on Fri May 18, 2001 2:30 pm

Using the "sz" in DB format means "zero terminated string", so it should work (and it works for me with dbwritex()), although the official PocketC documentation (<b>for dbwrite()!</b>) says "use caution when writing in the middle of a database with null-terminated strings, as they are of unknown length". I did some tests only with dbwritex() and "sz" and it behaves well in normal circumstances - I don't know the limits. You should experiment a little.

Tomaz
eftomi
 
Posts: 8
Joined: Fri May 11, 2001 3:02 pm
Location: Slovenia


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 1 guest

cron