1. Claudius Sailer
  2. Valentina Database ADK
  3. Wednesday, November 08 2017, 08:28 PM
  4.  Subscribe via email
I use following coding for initializing my database in my Tojo Project.


If PrefDic.value("DatabaseCache")>1 then
Valentina.Init(PrefDic.value("DatabaseCache")*1024*1024,VC,"")
else
Valentina.Init(DatabaseMinimumCache*1024*1024,VC,"")
end if

Valentina.SetExtensions("", "", "", "ind")


this is called only once a time when App (OpenDocument Event in App) is started. But it seems this is called more often. I know I have to check this in my code. My question is an other.

How can I check whether valentina is already initialized and check this before the code is passed again and throws the error?

Can I check valentina=NIL or something else?

Thanks for help
Attachments (1)
Comment
There are no comments made yet.
Claudius Sailer Accepted Answer
I use following coding for initializing my database in my Xojo Project.


If PrefDic.value("DatabaseCache")>1 then
Valentina.Init(PrefDic.value("DatabaseCache")*1024*1024,VC,"")
else
Valentina.Init(DatabaseMinimumCache*1024*1024,VC,"")
end if

Valentina.SetExtensions("", "", "", "ind")


this is called only once a time when App (OpenDocument Event in App) is started. But it seems this is called more often. I know I have to check this in my code. My question is an other.

How can I check whether valentina is already initialized and check this before the code is passed again and throws the error?

Can I check valentina=NIL or something else?

Thanks for help
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
Ivan Smahin Accepted Answer
Hi Claudius,

Currently, there is no such a feature. The only way is to catch an error on double init attempt.
Something like this one:


try
If PrefDic.value("DatabaseCache")>1 then
Valentina.Init(PrefDic.value("DatabaseCache")*1024*1024,VC,"")
else
Valentina.Init(DatabaseMinimumCache*1024*1024,VC,"")
end if

Valentina.SetExtensions("", "", "", "ind")
Exception err1 as VException
if err1.ErrorNumber = 603396 then
' Silently ignore double Init attempt.
else
Raise err1
end if
end
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 2
Ruslan Zasukhin Accepted Answer
Ivan,

let me correct you. Wiki page

**Note:** You should not call this method second time before Valentina.ShutDown(). Otherwise you will get an error. This is like with file.open() file.close() methods. You can use Valentina.CacheSize property to check if Valentina is initialized already.


For C++ devlopers: it needs to use Valentina.Init(0) to get the current cache size.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 3
Claudius Sailer Accepted Answer
this is now my new code....
thanks for help :-)


if Valentina.CacheSize=0 then //ist der wert nicht 0, dann ist Valentina bereits initialisiert und es würde zu einer Fehlermeldung kommen

If PrefDic.value("DatabaseCache")>1 then
Valentina.Init(PrefDic.value("DatabaseCache")*1024*1024,VC,"")
else
Valentina.Init(DatabaseMinimumCache*1024*1024,VC,"")
end if

Valentina.SetExtensions("", "", "", "ind")

if CheckLeer(VC) then
t=new TestTimer
t.period=540000
t.mode=2
end if

if Valentina.CacheSize=0 then
MsgBox "Valentina konnte nicht initialisiert werden !!! Error: " + Str(Err)
end if

end if
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.