...
Timezone
...
마크베이스는 각 클라이언트의 타임존은 세션 단위에서 유효한 것으로 가정한다.
...
of Machbase
Machbase assumes that each client's Timezone is valid in each session.
In general, a time zone is specified as a string representing a specific time.
Code Block |
---|
"YYYY-MM-DD HH24:MI:SS ZZZ(타임존스트링Timezone String)" 예Example) "12:06:56.568+01:00" "2006.07.10 at 15:08:56 -05:00" "09 AM, GMT+09:00" |
그러나, 위의 방식은 특정 시간을 매번 타임존을 기준으로 지정해야 하는 불편함이 있을 뿐만 아니라, 대량의 데이터에 대해서 모두 타임존의 값이 포함된 경우 데이터 전송량이 선형적으로 늘어나는 문제가 있다.
따라서, 마크베이스에서는 클라이언트와 서버가 연결된 세션에 대해 타임존 속성을 지정하는 방식을 지원한다.
다음은, 마크베이스에서 제공하는 타임존이 동작에 대한 단계적 설명이다.
서버는 그 서버가 설치된 운영체제에서 제공하는 기본 타임존을 기준으로 동작한다.
즉, 아무런 설정을 하지 않았을 경우 마크베이스는 해당 운영체제가 동작하는 타임존을 읽어서 활용한다.클라이언트 프로그램에서 타임존 설정없이 서버로 접속하면 해당 클라이언트의 타임존의 서버의 타임존으로 설정된다.
즉, 서버에서 설정된 TIMEZONE이 KST이라면, 클라이언트 역시 KST로 동작한다는 뜻이다.클라이언트 프로그램에서 타임존을 명시적으로 설정한 경우에는 해당 서버의 해당 세션은 클라이언트에서 지정한 타임존으로 동작한다.
즉, 서버에서 설정된 TIMEZONE이 KST이라 하더라도, 만일 클라이언트가 접속시 EDT로 타임존을 설정한 경우에는 해당 세션은 EDT로 동작한다.
마크베이스의 Timezone 지원 형식
마크베이스는 사용상의 편의성 증진과 복잡성을 제거하기 위해 5자리의 문자로 구성된 단 한가지 포맷만을 제공한다.
즉, 첫번째 캐틱터는 + 혹은 -의 기호로 시간의 부호를 나타내고, 이어지는 두개의 문자는 00에서 23 사이의 값을 가진다. 그리고, 마지막 두개의 문제는 00에서 59까지의 시간을 가지는 것으로 한다.
아래는 마크베이스에서 지원하는 TIMEZONE의 형식을 나타낸 것이다However, the above method not only has the inconvenience of having to designate a specific time based on the time zone every time, but also has a problem in that the amount of data transmission increases linearly when the time zone value is included for a large amount of data.
Therefore, Machbase supports the method of specifying the time zone property for the session in which the client and server are connected.
The following is a step-by-step explanation of the time zone operation provided by Machbase.
The server operates based on the default time zone provided by the operating system in which the server is installed.
In other words, if no setting is made, Machbase reads and uses the time zone in which the OS operates.If the client program connects to the server without setting the time zone, the client's time zone is set to the server's time zone.
That is, if the TIMEZONE set in the server is KST, it means that the client also operates in KST.If the time zone is explicitly set in the client program, the corresponding session of the server operates in the time zone designated by the client.
That is, even if the TIMEZONE set in the server is KST, if the client sets the time zone as EDT when connecting, the session operates as EDT.
Timezone Format in Machbase
Machbase provides only one format consisting of 5 characters to increase ease of use and remove complexity.
That is, the first character is a + or - sign indicating the sign of time, and the following two characters have a value between 00 and 23. And, it is assumed that the last two characters have a time from 00 to 59.
The following shows the format of TIMEZONE supported by Machbase.
Code Block |
---|
ex) TIMEZONE=+0900 TIMEZONE=-0900 |
machsql
machsql은 구동시 아래와 같은 옵션을 통해 동작할 타임존을 설정할 수 있다When machsql is started, you can set the time zone to operate through the following options.
Code Block |
---|
-z, --timezone=+-HHMM |
SHOW TIMEZONE 명령을 통해 현재 자신이 설정된 타임존을 확인할 수 있다You can check the currently set time zone through the SHOW TIMEZONE command.
Code Block |
---|
SHOW TIMEZONE; Mach> show timezone; Timezone : +0900 |
machloader
machloader는 구동시 아래와 같은 옵션을 통해 동작할 타임존을 설정할 수 있다When running machloader, you can set the time zone to operate through the following options.
Code Block |
---|
-z, --timezone=+-HHMM |
지정된 타임존으로 접속하고, 시간 연산도 해당 타임존을 기준으로 동작한다It connects to the designated time zone and time calculation operates based on the corresponding time zone.
SDK
연결스트링에 TIMEZONE이 추가되었으며, 해당 세션에 대한 타임존을 지정할 수 있다.
만일 연결스트링에 TIMEZONE을 지정하지 않을 경우에는 서버의 타임존을 기준으로 동작한다.
이는 TIMEZONE has been added to the connection string, and the time zone for the session can be specified.
If TIMEZONE is not specified in the connection string, it operates based on the time zone of the server.
This is the same for CLI, ODBC, JDBC, and DOTNET 모두 동일한다.
연결 string 예제Connection String Example
Code Block |
---|
SERVER=127.0.0.1;UID=SYS;PWD=MANAGER;CONNTYPE=1;NLS_USE=UTF8;PORT_NO=5656;TIMEZONE=+0300 |
Rest API
Rest API는 동작 요청시 HTTP 프로토콜의 HEADER에서 지정된 타임존을 기준으로 동작한다.그 헤더의 이름은 API operates based on the time zone specified in the HTTP protocol HEADER when requesting an operation.
The header is named The-Timezone-Machbase으로 명명되었으며, 사용법은 아래와 같다Machbase, and the usage is as follows.
Code Block |
---|
Authorization: Basic XXXXXXXXXXXXXXXXXXX ................... The-Timezone-Machbase: +0900 ............... |
앞에서 기술한 바와 같이 원하는 타임존 스트링을 지정하면 된다.
타임존을 지정하지 않았을 경우에는 서버의 타임존으로 동작한다.
요청 예제 : UTC로 설정As described above, you can specify the desired Timezone string.
If the Timezone is not specified, it operates as the Timezone of the server.
Request example: set to UTC
Code Block |
---|
curl -H "The-Timezone-Machbase: +0000" -G "http://127.0.0.1:${ITF_HTTP_PORT}/machbase" --data-urlencode 'q=select * from test_table order by c4 asc'; { "error_code": 0, "error_message": "", "columns": [ { "name": "C1", "type": 4, "length": 6 }, { "name": "C2", "type": 8, "length": 11 }, { "name": "C3", "type": 5, "length": 20 }, { "name": "C4", "type": 6, "length": 31 }, { "name": "C5", "type": 32, "length": 15 } ], "timezone": "+0000", "data": [ { "C1": 1, "C2": 2, "C3": "test1", "C4": "1999-09-09 00:09:09 000:000:000", "C5": "127.0.0.1" }, ] } |
결과 JSON에 The time zone value set in the "timezone" 항목에 설정된 타임존 값이 되돌아온다item is returned to the resulting JSON.