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

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 - Checking Database Existence

Checking Database Existence

Discuss OrbForms Designer and PocketC Architect

Postby bigjoejo on Thu Mar 30, 2006 2:03 am

I have a function that, as a user types in a filename, checks existing databases to ensure the user does not use a filename already existing on the palm. The function works fine, but only once.

My function is as follows;

DatabaseMgr mgr;
bool found;
string n;
found = false;

n = mgr.dbenum(true,"Cast",kCreator);
if (n == fldDBname.text) found = true;
while (n != "") {
n = mgr.dbenum(false,"Cast",kCreator);
if (n == fldDBname.text) found = true;
}

return found

I call this function the user triggers the onchange handler of a field. The first time I type in a file name and it matches an existing database, my function returns 1. My code then clears out the field and gives the user another shot at picking a filename.

Now if I go back to the field and type the exact same thing, this function no longer returns 1. I've narrowed it down to the
if (n == fldDBname.text) line. Even with I manually check that n and the field text are exactly the same, this if statement will not be executed.

Does anyone have any ideas as to what could be going on here? I've been banging my head against the wall here for awhile on this one.

Thanks!
bigjoejo
 
Posts: 25
Joined: Sun Jan 11, 2004 8:08 pm

Postby FrankG on Thu Mar 30, 2006 10:22 am

I don't know why your code isn't working. I suspect the problem might be in the surrounding code -- like what you're doing in the onchange handler or what you do with the field.text value in between. I used your code changing only the filetype from Cast to data, changing fldName to txtA, and initializing the kCreator to my app's creator and it worked.

Here's what I have:
<font face="Courier New">
bool Look() {
DatabaseMgr mgr;
bool found;
string n;
found = false;

n = mgr.dbenum(true,"data",kCreator);
if (n == txtA.text) found = true;
while (n != "") {
n = mgr.dbenum(false,"data",kCreator);
if (n == txtA.text) found = true;
}

return found;
}

handler mainForm.onopen() {
// TODO: handle onopen event
}


handler txtA.onchange() {
beep(0);
if (Look())
alert("Found it!");

}

handler button1002.onselect() {
txtA.text="";
txtA.visible = true;
}</font id="Courier New">

Also.... an eaiser scheme might be:

<font face="Courier New">
Database db;

if (db.open(fldname.text,false)) {
db.close();
return true;
}
return false;
</font id="Courier New">

Good luck with it,
Frank
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby fredoak on Mon Apr 03, 2006 2:13 pm

I do it out of a a short intialize routine as follows:

It bascially checks to see if the Db can be opened, if it can't it trys to create it.

void init_db()
{
if(!db.opentc("DATA","BilD",false))
{
if(!db.create("DATA","DATA","BilD",false))
{
alert("Unable to create database BilD");
return;
}
else
{
db.close();
if(!db.opentc("DATA","BilD",false))
{
alert("Unable to open database BilD");
return;
}
}
}
}
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA

Postby bigjoejo on Tue Apr 04, 2006 3:58 am

Finally figured it out. Thanks for your help!

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by FrankG</i>
<br />I don't know why your code isn't working. I suspect the problem might be in the surrounding code -- like what you're doing in the onchange handler or what you do with the field.text value in between. I used your code changing only the filetype from Cast to data, changing fldName to txtA, and initializing the kCreator to my app's creator and it worked.

Here's what I have:
<font face="Courier New">
bool Look() {
DatabaseMgr mgr;
bool found;
string n;
found = false;

n = mgr.dbenum(true,"data",kCreator);
if (n == txtA.text) found = true;
while (n != "") {
n = mgr.dbenum(false,"data",kCreator);
if (n == txtA.text) found = true;
}

return found;
}

handler mainForm.onopen() {
// TODO: handle onopen event
}


handler txtA.onchange() {
beep(0);
if (Look())
alert("Found it!");

}

handler button1002.onselect() {
txtA.text="";
txtA.visible = true;
}</font id="Courier New">

Also.... an eaiser scheme might be:

<font face="Courier New">
Database db;

if (db.open(fldname.text,false)) {
db.close();
return true;
}
return false;
</font id="Courier New">

Good luck with it,
Frank
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
bigjoejo
 
Posts: 25
Joined: Sun Jan 11, 2004 8:08 pm


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron