Switch to: V12V11V10V9V8V7V6V5

VDatabase class: Properties

VDatabase.CenturyBound

Declaration:

CenturyBound as Integer

Description:

This value specifies how Valentina handles auto-correction of dates that are ambivalent (century information missing).The default value is 20.

Example:

db.DateFormat = EVDateFormat.kMDY
db.CenturyBound = 20
 
tblPerson.fldBirthDate.SetString( "03/20/20" ) => 20 Mar 1920
tblPerson.fldBirthDate.SetString( "03/20/99" ) => 20 Mar 1999
tblPerson.fldBirthDate.SetString( "03/20/00" ) => 20 Mar 2000
tblPerson.fldBirthDate.SetString( "03/20/01" ) => 20 Mar 2001
tblPerson.fldBirthDate.SetString( "03/20/19" ) => 20 Mar 2019

VDatabase.CollationAttribute

Declaration:

CollationAttribute(
	inColAttribute as EVColAttribute ) as EVColAttributeValue
 
CollationAttribute( 
	inColAttribute as EVColAttribute,
	inColAttributeValue as EVColAttributeValue )

Description:

Set/Get the value of the specified collation attribute for this database.

Example:

v = database.CollationAttribute( kStrength )
database.CollationAttribute( kStrength ) = kPrimary

VDatabase.ConnectionVariable

Declaration:

ConnectionVariable(
    inConnVariableName as EVConnectionVariable ) as Integer
 
ConnectionVariable( 
    inConnVariableName as EVConnectionVariable,
    inConnVariableNameValue as EVConnectionVariableValue )

Description:

Get/Set the value of the connection variable by its name.

Example:

dim i as integer
 
i = database.ConnectionVariable(EVConnectionVariable.kFilesTransferMode)
 
database.ConnectionVariable(EVConnectionVariable.kFilesTransferMode) = 
	EVConnectionVariableValue.kNetwork

VDatabase.Creator

Declaration:

Creator as String

Description:

Mac creator signature. Makes sense for Mac OS only.

Example:

db.Creator = "VALA"

VDatabase.DateFormat

Declaration:

DateFormat as EVDateFormat

Description:

Specifies the date format for strings that contain date values. You can set format to one of the following values: kYMD, kDMY, kMDY

NOTE: you should specify this property after VDatabase.Create(), VDatabase.Open() or VConnection.Open(), because this property is not saved into database on the disk.

Example:

db.Open()
db.DateFormat = EVDateTimeFormat.kDMY

VDatabase.DateSep

Declaration:

DateSep as String

Description:

The string which is used as a separator in the date string. On default, it is “/”.

Example:

dts = db.DateSep

VDatabase.ErrNumber

Declaration:

ErrNumber as Integer

Description:

You can examine this property to see if the last operation was successful. Since this is a property of the database, each opened database has its own “last error” number.

There are 2 kinds of errors: OS-relative errors and Valentina-specific errors. OS-based errors are negative numbers. You can find their description in your OS documentation. Valentina specific errors correspond to the positive numbers.

NOTE: this style of “LAST ERROR” is used usually in Valentina ADKs for procedural languages. For OO languages mechanism of exceptions is used with help of VException class.

Example:

errnumber = db.ErrNumber

VDatabase.ErrString

Declaration:

ErrString as String

Description:

Returns the string which describes the last error.

Example:

errstr = db.ErrString

VDatabase.IndexCount

Declaration:

 

Description:

Returns the count of indexes in all tables of this database. It is used just for statistics.

Example:

count = db.IndexCount

VDatabase.IsEncrypted

Declaration:

IsEncrypted as Boolean (r\o)

Description:

Returns TRUE if this database is encrypted.

Example:

encrypted = db.isEncrypted

VDatabase.IsJournaled

[NEW in v5.0]

Declaration:

IsJournaled as Boolean (r\w)

Description:

Returns TRUE if this database is Journaled. By default, starting from v5.0, journaling is ON.

You can assign this property to FALSE at runtime for an opened database. You may want to disable it to get even better speed (+20%), but avoid this, because this reduces safety.

Example:

db.isJournaled = false

VDatabase.IsReadOnly

Declaration:

IsReadOnly as Boolean (r/o)

Description:

Returns TRUE if the dabase is opened.

Example:

res = db.IsReadOnly

VDatabase.IsOpen

Declaration:

IsOpen as Boolean (r\o)

Description:

Returns TRUE if this database is opened now.

Example:

res = db.IsOpen

VDatabase.KeyValueCount

Declaration:

KeyValueCount as Integer (r\o)

Description:

Returns the count of KeyValues in the database. This property is indirectly changed when you create/drop a KeyValue object.

Example:

count = db.KeyValueCount

VDatabase.LastInsertedRecID

Declaration:

LastInsertedRecID as integer (r/o) 

Description:

Returns the last inserted RecID in the database. Returns 0 as invalid RecID, for example, if there were no INSERTs.

This function is useful mainly if you execute

db.SqlExecute( "INSERT INTO T ..." )

because it allows you to get RecID of just inserted record. You should call this function right after SqlExecute() call. Actually, any other INSERT into this database will change the result of this function.

Function VTable.AddRecord() also affects the result of this function.

Note, that if you use this function with Valentina Server then its result does not depend on work of other users.

Example:

recid = db.LastInsertedRecID

VDatabase.LinkCount

Declaration:

LinkCount as Integer (r\o)

Description:

Returns the count of links in the database. This property is indirectly changed when you create/drop a link, or when you establish a FOREIGN KEY constraint, or when you create an ObjectPtr field.

Example:

count = db.LinkCount

VDatabase.LocaleName

Declaration:

LocaleName as String

Description:

Define the LocaleName string for this database. Tables and fields of this database will inherit this parameter by default.

Example:

LocaleName = db. LocaleName 
db. LocaleName = "en_US"

VDatabase.Mode

Declaration:

Mode as EVDbMode (r\o)

Description:

Returns the mode of this database. Using this you can define how much disk files have databases.

Example:

mode = db.Mode

VDatabase.Name

Declaration:

Name as String  (r\o)

Description:

The name of database.

Example:

name = db.Name

VDatabase.Path

Declaration:

Path as String (r\o)

Description:

The full path to the description volume of this database.

Example:

path = db.Path

VDatabase.ResponseTimeOut

Declaration:

ResponseTimeOut as Integer

Description:

This property affects only Valentina Client. It specifies the time (in seconds), which client will wait for the response of a server on a query. If during this time server does not respond then the client will disconnect.

By default, this property is 60 seconds. You may wish to set this value bigger if you have a long-time query and you know that the server will take a longer time to resolve it.

Example:

db.ResponseTimeOut = 100

VDatabase.SchemaVersion

Declaration:

SchemaVersion as Integer

Description:

The number of version of a database schema. The initial value is 1. It can be used if you want to change a database structure in the new version of your application.

Example:

ver = db.SchemaVersion

VDatabase.Size

Declaration:

Size as Integer

Description:

The size of this database in bytes. It counts all db volumes.

Example:

size = db.Size

VDatabase.StorageEncoding

Declaration:

StorageEncoding as String

Description:

Defines how strings will be stored in the disk files. By default it is UTF-16. You can change it by any other encoding.

IMPORTANT: you can assign encoding to VDatabase object only before call the Vdatabase.Create() function. You cannot change the encoding of existed db files using this property.

Example:

encoding = db.StorageEncoding

VDatabase.TableCount

Declaration:

TableCount as Integer (r\o)

Description:

Returns the count of custom tables in the database (it does not count the system tables). This property is indirectly changed when you create/drop a Table.

Example:

count = db.TableCount 

VDatabase.TimeSep

Declaration:

TimeSep as String

Description:

The string which is used as a separator in the time string. On default it is “:”.

Example:

tms = db.TimeSep

VDatabase.TypeCount

[NEW in v5.0]

Declaration:

TypeCount as Integer (r\o)

Description:

Returns the count of custom Types to the database. This property is indirectly changed when you create/drop a Type.

Example:

count = db.TypeCount 

See also: