[V4RB] Opening modified databases

Francois Van Lerberghe fvanlerberghe at freegates.be
Mon Dec 1 10:30:53 CST 2003


le 30-11-03 22:15, Ruslan Zasukhin <sunshine at public.kherson.ua> a écrit :

> on 11/30/03 9:18 PM, Robert Brenstein at rjb at rz.uni-potsdam.de wrote:
> 
>>> 
>>> I think must be
>>> 
>>> db.GetVersion()
>>> 
>>> For db files without opening.
>> 
>> Would you add it to other products as well? I presume that it would
>> work without actually opening the db (and possibly updating file
>> format).
> 
> Yes of course, Robert.

Mmmh, isn't it already a method to do that ?

With V4RB, to read the schema version without opening, I use the example
posted by Keith DeLong, downloaded with V4RB in the 3d party project and
named "vFileInfo1.2"

The concerned method is this :

Function vSchema(dbFolderitem as folderitem) As integer
   dim b as BinaryStream
   dim schema as Integer
   dim nativeOS as Integer
   dim m as MemoryBlock
   Const kWindows = 2
   
   b= dbFolderItem.OpenAsBinaryFile(false)
   If b = nil then
      Return -1 //not ideal...
   End if
   
   b.position = 1
   nativeOS = b.ReadByte
   b.LittleEndian = (nativeOS = kWindows)
   b.position = 4
   m =NewMemoryBlock(4)
   m.Long(0) = b.ReadLong
   b.close
   b = nil
   
   #if targetMacOS then
   schema = m.UShort(0)
   #endif
   
   #if targetWin32 then
   schema = m.UShort(2)
   #endif
   
   Return schema
End Function


Best regards

François Van Lerberghe
Thier Monty, 15A
B-4570 Marchin
Belgique



More information about the Valentina mailing list