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

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

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

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[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 - DBsetrec(-1, ...) crash
Page 1 of 1

PostPosted: Sun Aug 24, 2003 2:57 pm
by shurcooL
hey,

i just got to the part in my level editor where i need to append to a Pilot-DB database. so after reading a bit confusing docs on DBsetrec, i went like this:

Code: Select all
string sNewRecord[2];

...

sNewRecord[0] = nViewOffsetX; // an int
sNewRecord[1] = nViewOffsetY;
DBsetrec(-1, sNewRecord);
as soon as the execution reaches DBsetrec line, it crashes (causing me to do a soft reset), giving a "MemoryMgr.c,Line:xxxx Non-word-aligned handle" fatal error.

what could be wrong? i've searched these forums for "DBsetrec(-1," hoping it's been mentioned before, but found nothing.

now, this is weird because it works just fine if i replace -1 with any number that is in the DB already (like 0, etc.).

the only thing i can think of that i could've done wrong is used PocketC arrays (ie. string blah[2] style) as opposed to PToolboxLib arrays (pointer blah = Array(...) style).

anyway, if you could please tell me what i did wrong, i would really appreciate it. :)

thanks,
shurcooL

PostPosted: Sun Aug 24, 2003 3:34 pm
by jstadolnik
What is the record structure? In other words, how many ints, strings, etc.?

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Sun Aug 24, 2003 4:01 pm
by shurcooL
oh, it's just two fields, both are integers. there are over 450 records though. ;\ i'll be adding a 3rd field soon, and it'll be a string.

thanks,
shurcooL

PostPosted: Sun Aug 24, 2003 6:15 pm
by jstadolnik
Make sure that you are using v7.6.1 of the PToolboxLib.

Also what device and OS version are you testing with?

I put together a small testcase which adds 1000 records to a pilot-db database without problems. I'll include this testcase in this post.

If you email me your databases and app and instructions on how to replicate the problem I can take a look at what the library is doing.

Joe

------

//database_demo4.c
library "PToolboxLib"
main() {
pointer p;
string data[2];
string dbName = "testDB";
int i, dbType, numFields;

clear();

//For purpose of demo, delete the database if it already exists.
if(DBopen(dbName)==0) DBrm(-1);

//create & load field information array
p = Array("is,7,2");

p[0][0]=2; //int
p[0][1]="first";

p[1][0]=2; //int
p[1][1]="second";


//Create the database
dbType = 1; //set database type to Pilot-DB
i=DBcreate(dbName,dbType,2,&p[0][0]); // &p[0][0] is pointer to start of array data
if(i==-1) {
alert("HanDBase not installed");
}

i=DBopen(dbName);
if(i != 0) {
alert("Failed to open database");
}

//Get number of fields

for(i=0;i<1000;i++) {
data[0]=random(0x7fffffff);
data[1]=random(0x7fffffff);
//append a record
DBsetrec(-1,data);
}

puts("Number records="+DBinfo(2,0)+"\n");
}




The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Sun Aug 24, 2003 7:18 pm
by shurcooL
ok, sorry for taking so long at getting back to you, i was doing something. ;\

'k, first thing i did was compile your example, and it seems to compile and execute flawlessly. i checked, and there is in fact a 'testDB' database using Pocket-DB DB viewer, which has a 1000 records.

so i guess it must be either a bug in my code, or something i didn't consider while thinking the C++ code in my head, instead of PocketC. i'll debug now, hopefully find the problem fast, and then will, of course, post it here.

sorry about wasting your time, and thanks for help. :P

thanks,
shurcooL

PostPosted: Sun Aug 24, 2003 7:34 pm
by shurcooL
ok, this sure didn't take me long to debug...

<b>aparently, my level DB has <i>THREE</i> fields, last being a string field than i don't remember ever adding.</b>

it's remarkable i haven't had any problems with it earlier, seeing how i replaced existing records all the time, supplying only two strings. i guess that would explain why some records have weird random strings in the 3rd string field. perhaps you should add an error check or something to DBsetrec when replacing an existing record. on the other hand, in most cases it would be useless and would only slow it down (last thing DBs need ;\ ), so don't.

once again, sorry for wasting your time. :P i guess i've learned a lesson today - don't forget about a project for too long, or you might forget what exactly you already did to it. ;)

oh, and if i may add, this was all Pocket-DB DB viewer's (PDA version) fault! it's so messy, and how was i supposed to know that it wouldn't show all fields at the same time? the previous version i had (ie. not the latest) was much better, especially seeing how it actually displayed the DB in high-res.

oh, and just so you know, i've got a grayscale Sony Clie PEG-T415 handheld. my dad works at Sony, and he got it there as a present for something (they gave 'em to all full-time employees, seeing how they don't sell this model anymore anyway). i guess i'm sort of lucky, because i'd never get into PDA programming otherwise. :D

wow, even i'm surprised as to how long i can make a simple reply. ;\ need to work on my straight-to-point skills. ;P

thanks,
shurcooL