[V4RB] Table working with 1.9.7 but not with 1.9.8

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Sep 13 12:10:29 CDT 2003


on 9/13/03 12:00 PM, Stan Busk at maxprog at mac.com wrote:

> I have a problem with V4RB 1.9.8. My app uses a table to store
> preferences with name 'Preferences'. This table has always been working
> well with 1.9.7 Yesterday I found out that since I upgrade to 1.9.8 the
> table is no longer working, I store strings to it but when I go reading
> it back, they are always empty. I have been checking the whole table
> during hours but everything is correct. Finally I decided to replace
> 1.9.8 with 1.9.7 and the table is working again. I have no explanation
> for this.
> 
>> The table name is boPrefs of type VBaseObject with following fields:
> 
> Sub boPrefs()
>   name = "Preferences"
>   PrefEntryName    = new VvarChar ("PrefEntry_Name",   64, "ASCII",
> kV_Unique + kV_Indexed) 'PrefEntry Name
>   PrefEntryValue   = new VvarChar ("PrefEntry_Value", 256, "ASCII",
> -1)                     'PrefEntry Value
>   PrefEntryRecord  = new VULong   ("PrefEntry_Record", kV_Indexed)
>                     'PrefEntry Record ID
> End Sub
> 
>> The funnction that doesnt work on 1.9.8 but work with 1.9.7 is:
> 
> Sub Update(inRec As Integer, inValue As String)
>   If GotoRecID(inRec) then
>      PrefEntryValue.SetString(inValue) 'Set PrefEntry Value
>      UpdateRecord
>      Flush
>   end if
> End Sub
> 
>> I call this function thru my code this way:
> 
> Sub Prefs_SetValue(inDatabase As DB_Data, inKey As String, inValue As
> String)
>   Dim aCursor as VCursor
>   Dim aResult As String
>   Dim aErr As Boolean
> 
>   aCursor = nil
>   aCursor = inDatabase.SQLselect("Select * from Preferences where
> PrefEntry_Name='"+inKey+"'")
>   if aCursor<>nil then
>      if aCursor.RecordCount>0 then
>         
> inDatabase.mPrefs.Update(aCursor.ULongField("PrefEntry_Record").Value,
> inValue)
>      else
>         inDatabase.mPrefs.Add(inKey, inValue)
>      end if
>   end if
> End Sub
> 
> I have no idea why this table has stopped working on 1.9.8, my app uses
> 22 tables, this one is the only that has stopped working.

Hi Stan,

Am I right that you use here BaseObject API in the mix with Cursor API?
I have warn that this is bad idea.

As I see you try inDatabase.mPrefs.Update()
But in the same time you have made cursor (Select * from Preferences )
On this table. And cursor have set READ LOCKS on its records.

You can try resolve problem if kill cursor before inDatabase.mPrefs.Update()
Todo this at first extract your long value into tmp variable,
Then kill cursor then do inDatabase.mPrefs.Update()

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list