Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

« Predchádzajúce Verzia 4 Ďalej »

%SubTimesLocal function


Function
The function deducts absolute time TimeB from absolute time TimeA. The result is value of Relative time type.

Declaration
REAL %SubTimesLocal(
   TIME in TimeA,
   TIME in TimeB,
   TEXT in timeZone := %GetCurrentTimeZone()
 )
Parameters
TimeAAbsolute time.
TimeBAbsolute time.
timeZone

Name of the time zone used for conversion to local time (e.g. "Europe/London") or definition of fixed offset from UTC using format "(+|-)hh[:mi[:ss]]", where hh defines a number of hours, mi defines a number of minutes, and ss defines a number of seconds. Sign as well as a number of hours are mandatory parts of offset definition, number of minutes and seconds are optional and default to 0 (e.g. "+02:30" defines offset of 2 hours and 30 minutes from UTC). The empty text has the same meaning as function %GetCurrentTimeZone.
Note: For historical reasons, an integer parameter is also accepted. Its interpretation is as follows: 0 - zone "Europe/London", 3600 - zone "Europe/Bratislava", 7200 - zone "Europe/Kiev", 21600 - zone "Asia/Almaty". Usage of integer parameter is deprecated and generates warning into log file!

DB_INSERT and DBS_INSERT actions


Function
The action will insert one or more rows into the table.
Declaration
DB_INSERT handleIdent_Int, rowIdent, retCodeIdent_Int [ORAHINT hintIdent_Str]
 
DBS_INSERT dbObjIdent, rowIdent, retCodeIdent_Int [TRANS transHandle_Int] [ORAHINT hintIdent_Str]
 
or
 
DB_INSERT handleIdent_Int, structIdent, retCodeIdent_Int [ORAHINT hintIdent_Str]
 
DBS_INSERT dbObjIdent, structIdent, retCodeIdent_Int  [TRANS transHandle_Int] [ORAHINT hintIdent_Str]
Parameters
handleIdent_IntinIdentifier (handle) of Int type of the connection with a table (DB_CONNECT).
dbObjIdentinReference to an object of Database table.
rowIdentinOne structure row identifier (row to insert).
structIdentinIdentifier of a whole structure (rows to insert).
retCodeIdent_IntoutReturn value of Int type - action success.
transHandle_IntinIdentifier of the Connection to the database.
hintIdent_StrinExpression of String type that defines Oracle SQL hint. It is used as an instruction for the performance optimizer of SQL command. The value is used without the opening and terminating characters /*+ <orahint> */.
The example is mentioned here.
Return code
The value of the parameter transHandle_Int. See the table of error codes. It is possible to get extended error information.
Description
Table must be opened with the access _DB_MODIFY. There must be the correct structure type of inserted row or structure. Values of all items of every inserted row must be valid.

The advantage of the action DBS_INSERT at work with a table is the possibility to leave out its closing and opening (shorter code).

For D2000 v5.00: an disadvantage of the action DBS_INSERT is in speed. Each DBS_INSERT call results in necessity to open and close the database in DBManager - it can be a time-consuming operation and it is a comparatively nonstandard method in term of databases.
The need to open and close the database may be avoided in the scope of transaction processing so that the command is followed by the parameter

TRANS
.


For D2000 v6.00 and higher: DBManager optimization (connection recycling, predefined connections) causes, that the action DBS_INSERT is executes as quick as the action DB_INSERT and as moreover there is saved a time required for execution of the action DB_CONNECT to open the database.


Related pages:

Description
The function %SubTimesLocal deducts one absolute time from another one. The result will not be influenced by the fact if the time offset was or was not in this interval. For example, the difference between 4:00 and 1:00 a.m. is always three hours.
Example
; =================================================================
;  Using time zone "Europe/Bratislava"
;  Daylight saving time was observed in year 2009, therefore time shifts occured.
;  Winter [B] time was 1 hour ahead of UTC, summer [A] time was 2 hours ahead of UTC.
;  Summer time was from 29th March 2009 to 24th October 2009.
;  A3:00:00 is changed to B2:00:00 on Sunday (25th October 2009).
; =================================================================
 
BEGIN
  TIME _timeA
  TIME _timeB
  TIME _baseTime

  REAL _subLocal1
  REAL _subLocal2

  ; 2009-10-25 00:30:00 UTC
  _timeA := %StrToTimeEx("2009-10-25 A2:30:00", "yyyy-mm-dd hh:mi:ss", "Europe/Bratislava")
  ; 2009-10-25 01:30:00 UTC
  _timeB := %StrToTimeEx("2009-10-25 B2:30:00", "yyyy-mm-dd hh:mi:ss", "Europe/Bratislava")
  ; 2009-10-24 23:30:00 UTC
  _baseTime := %StrToTimeEx("2009-10-25 01:30:00", "yyyy-mm-dd hh:mi:ss", "Europe/Bratislava")
 
  ; difference 1 hour(s) (3600 seconds)
  _subLocal1 := %SubTimesLocal(_timeA, _baseTime, "Europe/Bratislava")
  ; difference 1 hour(s) (3600 seconds)
  _subLocal2 := %SubTimesLocal(_timeB, _baseTime, "Europe/Bratislava")
 
 END
  • Žiadne štítky