|
Home > Archive > Programming with dBASE > February 2006 > CacheUpdates
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Brian Benson 2006-02-28, 8:25 pm |
| I have a small test form which includes two lines,
form.query1.cacheupdates = true
form.query1.abandonupdates()
when I run the form immediately after starting the dBasePlus 2.01 development environment I get an error at the second line,
Database Engine Error : Invalid handle to the function
Usually (but not always) if I re-run the form it does not fail.
I do not understand what is changing, and, more importantly how to stop the error in a real application.
Any suggestions?
| |
| Brian Benson 2006-02-28, 8:25 pm |
| Sorry, I mis-typed the two lines,
the lines causing the error are,
form.query1.database.cacheupdates = true
form.query1.database.abandonupdates()
Suggestioins?
Brian
Brian Benson Wrote:
> I have a small test form which includes two lines,
>
> form.query1.cacheupdates = true
> form.query1.abandonupdates()
>
> when I run the form immediately after starting the dBasePlus 2.01 development environment I get an error at the second line,
>
> Database Engine Error : Invalid handle to the function
>
> Usually (but not always) if I re-run the form it does not fail.
>
> I do not understand what is changing, and, more importantly how to stop the error in a real application.
>
> Any suggestions?
>
>
| |
| Robert Bravery 2006-02-28, 8:25 pm |
| HI,
We need to see more than this., where is this line run from, what is being
initialised, what is not.
The problem is that something might be out of scope, but cominto scope only
after this line of code, re-running the form might work then in that case.
But difficu;lt to tell as we don;t know what else is goiung on
Robert
"Brian Benson" <bb@magenta-netlogic.com> wrote in message
news:cIe%23jw6OGHA.2016@news-server...
> I have a small test form which includes two lines,
>
> form.query1.cacheupdates = true
> form.query1.abandonupdates()
>
> when I run the form immediately after starting the dBasePlus 2.01
development environment I get an error at the second line,
>
> Database Engine Error : Invalid handle to the function
>
> Usually (but not always) if I re-run the form it does not fail.
>
> I do not understand what is changing, and, more importantly how to stop
the error in a real application.
>
> Any suggestions?
>
>
| |
| Brian Benson 2006-02-28, 8:25 pm |
| Robert
Try the following form,
Brian
** END HEADER -- do not remove this line
//
// Generated on 27/02/2006
//
parameter bModal
local f
f = new testformForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class testformForm of FORM
with (this)
height = 16
left = 46.5714
top = 7.0909
width = 40
text = ""
endwith
this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 13
top = 13.5
sql = 'select * from "Fish.dbf"'
active = true
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_O
NCLICK
height = 1.0909
left = 16
top = 9.5
width = 15.2857
text = "Pushbutton1"
endwith
this.rowset = this.fish1.rowset
function PUSHBUTTON1_onClick
form.fish1.database.cacheupdates = true
form.fish1.database.abandonupdates()
return
endclass
| |
| Robert Bravery 2006-02-28, 8:25 pm |
| Hi brian,
You can swap the two lines in the onclick method around
form.fish1.database.abandonupdates()
form.fish1.database.cacheupdates = true
It makes logical sense to aboandon any updates before changeing the
cacheupdates. If it were from true to false, you would want to do something
with the updates that are already cached.
Also you shoud have a proper database object, and not rely on the default,
unless youre absolutley sure that you app is in the same forlder as the
tables.
And, if you want t set the cacheupdates to false when the form opens, you
can do this by setting the cacheupdates of the database to true
** END HEADER -- do not remove this line
//
// Generated on 27/02/2006
//
parameter bModal
local f
f = new testformForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class testformForm of FORM
with (this)
height = 16.0
left = 46.5714
top = 7.0909
width = 40.0
text = ""
endwith
this.DATABASE1 = new DATABASE()
this.DATABASE1.parent = this
with (this.DATABASE1)
left = 2.1429
top = 0.5455
cacheUpdates = true
databaseName = "DBASESAMPLES"
active = true
endwith
this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 13.0
top = 13.5
database = form.database1
sql = 'select * from "Fish.dbf"'
active = true
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_O
NCLICK
height = 1.0909
left = 16.0
top = 9.5
width = 15.2857
text = "Pushbutton1"
endwith
function PUSHBUTTON1_onClick
form.fish1.database.abandonupdates()
form.fish1.database.cacheupdates = true
return
endclass
Robert
"Brian Benson" <bb@magenta-netlogic.com> wrote in message
news:gTiWgn7OGHA.2016@news-server...
> Robert
>
> Try the following form,
>
> Brian
>
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 27/02/2006
> //
> parameter bModal
> local f
> f = new testformForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testformForm of FORM
> with (this)
> height = 16
> left = 46.5714
> top = 7.0909
> width = 40
> text = ""
> endwith
>
> this.FISH1 = new QUERY()
> this.FISH1.parent = this
> with (this.FISH1)
> left = 13
> top = 13.5
> sql = 'select * from "Fish.dbf"'
> active = true
> endwith
>
> this.PUSHBUTTON1 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON1)
> onClick = class::PUSHBUTTON1_O
NCLICK
> height = 1.0909
> left = 16
> top = 9.5
> width = 15.2857
> text = "Pushbutton1"
> endwith
>
> this.rowset = this.fish1.rowset
>
> function PUSHBUTTON1_onClick
>
> form.fish1.database.cacheupdates = true
> form.fish1.database.abandonupdates()
>
>
> return
> endclass
>
| |
| Brian Benson 2006-02-28, 8:25 pm |
| Robert
The order of the lines was a result of the intention to set cacheupdates to true, make some changes, and keep or not depending on results.
I found I could reduce the original application to those two lines, in that order, to expose the error.
Your modified form works even with the two lines in the order,
cacheupdate = true
abandonupdates
BUT if you remove the line in the database definition which sets cacheupdates to true, then the error returns at the abandonupdates line in the pushbutton-onclick.
Try it!
So is it a bug?
Brian
Robert Bravery Wrote:
> Hi brian,
> You can swap the two lines in the onclick method around
> form.fish1.database.abandonupdates()
> form.fish1.database.cacheupdates = true
>
> It makes logical sense to aboandon any updates before changeing the
> cacheupdates. If it were from true to false, you would want to do something
> with the updates that are already cached.
>
> Also you shoud have a proper database object, and not rely on the default,
> unless youre absolutley sure that you app is in the same forlder as the
> tables.
> And, if you want t set the cacheupdates to false when the form opens, you
> can do this by setting the cacheupdates of the database to true
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 27/02/2006
> //
> parameter bModal
> local f
> f = new testformForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testformForm of FORM
> with (this)
> height = 16.0
> left = 46.5714
> top = 7.0909
> width = 40.0
> text = ""
> endwith
>
> this.DATABASE1 = new DATABASE()
> this.DATABASE1.parent = this
> with (this.DATABASE1)
> left = 2.1429
> top = 0.5455
> cacheUpdates = true
> databaseName = "DBASESAMPLES"
> active = true
> endwith
>
> this.FISH1 = new QUERY()
> this.FISH1.parent = this
> with (this.FISH1)
> left = 13.0
> top = 13.5
> database = form.database1
> sql = 'select * from "Fish.dbf"'
> active = true
> endwith
>
> this.PUSHBUTTON1 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON1)
> onClick = class::PUSHBUTTON1_O
NCLICK
> height = 1.0909
> left = 16.0
> top = 9.5
> width = 15.2857
> text = "Pushbutton1"
> endwith
>
>
> function PUSHBUTTON1_onClick
>
>
> form.fish1.database.abandonupdates()
> form.fish1.database.cacheupdates = true
>
> return
>
> endclass
>
>
> Robert
>
>
> "Brian Benson" <bb@magenta-netlogic.com> wrote in message
> news:gTiWgn7OGHA.2016@news-server...
>
>
| |
| Robert Bravery 2006-02-28, 8:25 pm |
| Hi,
I don't know if it is a bug or not. You would have to post it to the bugs
group to find out. I don't know the order and purpose or process. only dbi
would know that. But I would tend to agree that it is a bug, or at least
have some kind of message say, clear cacheupdates befor setting true or
false, or somehing lijke that.
Post it to the bugs group and see what happens.
"Brian Benson" <bb@magenta-netlogic.com> wrote in message
news:6gruqvGPGHA.1152@news-server...
> Robert
>
> The order of the lines was a result of the intention to set cacheupdates
to true, make some changes, and keep or not depending on results.
> I found I could reduce the original application to those two lines, in
that order, to expose the error.
>
> Your modified form works even with the two lines in the order,
>
> cacheupdate = true
> abandonupdates
Well then I would take the cachupdate out of the pushbutton event, and leave
it in the definition. Or put it somewhere else
Robert
|
|
|
|
|