Table of Contents
Valentina Class: Initialization Methods
Before you start to work with a Valentina ADK component, you must initialized it.
A Valentina ADK contains three major components:
- Valentina Local DB Engine - to create and use local Valentina DB files;
- Valentina Local Report Engine - to use Valentina Project files and generate reports designed in Valentina Studio;
- Valentina Client - to talk with a [remote] Valentina DB/Report Server;
For each component exists its own Init function (as well as shutdown one):
- Valentina.Init( inCacheSize, inMacSerial, inWinSerial, inLinSerial )
- Valentina.InitReports( inMacRepSerial, inWinRepSerial, inLinRepSerial )
- Valentina.InitClient( inCacheSize )
Order of Calls
Your application may use only one of components or few. In the last case, please note, that orders of calls of Init methods should be as
- Valentina.Init() – init vkernel.dll and ICU strings.
- Valentina.InitReports() – init vreport.dll. IF vkernel was not inited before, then init it also for own usage.
- Valentina.InitClient() – init vclient.dll. IF vkernel was inited before then uses UTF16 encoding for strings. Otherwise uses IOEncoding as specified.
Shutdown methods call in the reverse order.
Note, that InitClient() do not have serials. This underlines the fact that each and any Valentina Client is free. In other words, if you have some Valentina Server running, then you can use any existing Valentina ADK to connect to it.
For local DB and Report engines you need to have a serial for each OS, where you want to run your application.
IMPORTANT: If you do not have serial for some platform, the position should be empty, or nil. For example, if you are only developing on the Windows platform, then the inMacSerial and inLinuxSerial will both appear as “” (empty). This would appear as the example below.
Valentina.Init( 10*1024*1024, "", "WinSerial", "" )
TIP: You may want to split your serial to few small strings or even encrypt to better hide from easy hacking from your application binary.
TIP: If you are upgrading from a previous version of Valentina, it is a good idea that you upgrade all of our components at the same time, and that all serial codes are for the same version. Otherwise, if you update your components and one of them becomes out of date, it could interfere with initialization.
Init( inCacheSize as Integer = 10 * 1024 * 1024, inMacSerialNumber as String = "", inWinSerialNumber as String = "", inLinSerialNumber as String = "" )
- inCacheSize The size of the cache in bytes.
- inMacSerialNumber The serial for Mac OS.
- inWinSerialNumber The serial for Windows.
- inLinSerialNumber The serial for Linux.
To improve disk access, Valentina uses a cache mechanism. Using the Valentina.Init() method, you must define the size of the cache. It should be 1MB if the database is tiny, or it can be several megabytes if the database is large.
TIP: By default, it is a good idea to allocate not more than half of available computer memory to the cache. Usually 10-50Mb is enough.
Only registered users are allowed to build and deploy Valentina-based applications, except for testing purposes. If you are a registered user, you can specify either the MacOS or the Windows OS serial number, or both. If Valentina receives an empty string, it will work in the time limited, demonstration mode. After ten minutes in demonstration mode, any request to the database will be ignored and Valentina will respond with three beeps.
Note: You should not call this method second time before Valentina.ShutDown(). Otherwise you will get error. This is like with file.open() file.close() methods. You can use Valentina.CacheSize property to check if Valentina is initialized already.
Note: You must use your own security methods to ensure that you do not expose your serial numbers in your built applications.
err = Valentina.Init( 10 * 1024 * 1024 ) // demo
InitClient( inCacheSize as Integer = 10 * 1024 * 1024 )
- inCacheSize The size of the cache in bytes.
Initializes the Valentina Client for work.
- VClient uses this cache only for server-side cursors.
- Each server-side cursor keeps the list of cached records. When cursors dies it destroy cache buffers also.
- Also exists list of usage history. If cache limit reached then older buffers are released.
Valentina.InitClient() or Valentina.InitClient( 15 * 1024 * 1024 ) // 15 Mb max to cache data on cliet side
[NEW in 4.0]
InitReports( inMacSerial as String, inWinSerial as String, inLinSerial as String )
- inMacSerial - The serial for MAC OS.
- inWinSerial - The serial for Windows OS.
- inLinSerial - The serial for Linux OS.
Initialize the work with Valentina reports for your application.
If you not specify serials for Valentina Reports then generated reports will have DEMO watermark.
Valentina.InitReports( "MySerial", "", "" )