Wrong database version number

Keith DeLong delong at redcort.com
Fri Apr 8 14:07:15 CDT 2005


>>> I need to get the schemaVersion without doing a db.open(f). If the
>>>  Database Version Number was updated with the version of the engine
>>>  that modified it last, that would be satisfactory...
>> 
>> Jon, we change FORMAT version, only when we change format itself.
>> Change of format means that older engine will not be able open newer format.
>> This is different things.
>> 
> 
> OK, I understand. Even more so, then, it would be very handy to be
> able to get the schemaVersion without having to open the database.
> 
> Jon

Hey Jon,
I've not started using v2 yet, but I crossed this bridge a long time ago in
V1. Perhaps Ruslan call tell us if the file header info remains the same in
v2.

Keith DeLong


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.LittleEndian = (nativeOS = kWindows)
  m.Long(0) = b.ReadLong
  b.close
  b = nil
  
  'msgBox str(NativeOS)
  
  if nativeOS = 1 then //Mac
    schema = m.UShort(0)
  end
  
  if nativeOS = 2 then //Win32
    schema = m.UShort(2)
  end
  
  Return schema
End Function




More information about the Valentina-beta mailing list