mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
CORE-6214 - Update outdated tzdata version.
Added documentation and script for update. zipjs.bat is downloaded from https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/zipjs.bat
This commit is contained in:
parent
c6523020b1
commit
64ecbd8dd2
@ -630,13 +630,13 @@ $(IDS): $(SRC_ROOT)/misc/ids.m $(SRC_ROOT)/jrd/relations.h
|
||||
# all the rest we need to build
|
||||
#
|
||||
|
||||
.PHONY: qli message_file gbak_files
|
||||
.PHONY: qli message_file tzdata gbak_files
|
||||
|
||||
FDB_FILES := $(HELP_FDB) $(ROOT)/gen/msg.fdb $(SECURITY_FDB) $(FIREBIRD)/examples/empbuild/employee.fdb
|
||||
GBAK_FILES := $(FDB_FILES:.fdb=.gbak) $(FIREBIRD)/msg.gbak
|
||||
GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES))
|
||||
|
||||
rest: qli message_file
|
||||
rest: qli message_file tzdata
|
||||
|
||||
cross_rest: qli gbak_files
|
||||
$(MAKE) $(BUILD_FILE)
|
||||
@ -656,6 +656,12 @@ $(FIREBIRD_MSG): $(BUILD_FILE) msg.timestamp
|
||||
$(BUILD_FILE) -d msg.fdb -f $@
|
||||
$(CHMOD_6) $@
|
||||
|
||||
tzdata: $(FIREBIRD)/tzdata
|
||||
|
||||
# FIXME: For big-endian, be.zip must be used.
|
||||
$(FIREBIRD)/tzdata: $(ROOT)/tzdata/le.zip
|
||||
unzip -o $(ROOT)/tzdata/le.zip -d $(FIREBIRD)/tzdata
|
||||
|
||||
$(BUILD_FILE): $(BUILD_Objects) $(COMMON_LIB)
|
||||
$(EXE_LINK) $(EXE_LINK_OPTIONS) $(LSB_UNDEF) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,..)
|
||||
|
||||
|
@ -38,6 +38,7 @@ if errorlevel 1 call :ERROR build failed - see make_all_%FB_TARGET_PLATFORM%.log
|
||||
|
||||
@mkdir %FB_OUTPUT_DIR% 2>nul
|
||||
@mkdir %FB_OUTPUT_DIR%\intl 2>nul
|
||||
@mkdir %FB_OUTPUT_DIR%\tzdata 2>nul
|
||||
@mkdir %FB_OUTPUT_DIR%\help 2>nul
|
||||
@mkdir %FB_OUTPUT_DIR%\doc 2>nul
|
||||
@mkdir %FB_OUTPUT_DIR%\doc\sql.extensions 2>nul
|
||||
@ -50,6 +51,7 @@ if errorlevel 1 call :ERROR build failed - see make_all_%FB_TARGET_PLATFORM%.log
|
||||
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\* %FB_OUTPUT_DIR% >nul
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\intl\* %FB_OUTPUT_DIR%\intl >nul
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata\* %FB_OUTPUT_DIR%\tzdata >nul
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\system32\* %FB_OUTPUT_DIR%\system32 >nul
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\*.dll %FB_OUTPUT_DIR%\plugins >nul
|
||||
@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\udr\*.dll %FB_OUTPUT_DIR%\plugins\udr >nul
|
||||
|
@ -10,12 +10,14 @@
|
||||
:: MAIN
|
||||
|
||||
@echo Extracting pre-built ICU
|
||||
|
||||
%FB_ROOT_PATH%\extern\icu\icu.exe -y > make_icu_%FB_TARGET_PLATFORM%.log 2>&1
|
||||
|
||||
if errorlevel 1 call :ERROR build failed - see make_icu_%FB_TARGET_PLATFORM%.log for details
|
||||
@goto :EOF
|
||||
|
||||
@echo Extracting tzdata
|
||||
mkdir %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata
|
||||
call zipjs.bat unzip -source "%FB_LONG_ROOT_PATH%\tzdata\le.zip" -destination %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata -keep yes
|
||||
|
||||
@goto :EOF
|
||||
|
||||
|
||||
:ERROR
|
||||
|
823
builds/win32/zipjs.bat
Normal file
823
builds/win32/zipjs.bat
Normal file
@ -0,0 +1,823 @@
|
||||
@if (@X)==(@Y) @end /* JScript comment
|
||||
@echo off
|
||||
|
||||
rem :: the first argument is the script name as it will be used for proper help message
|
||||
cscript //E:JScript //nologo "%~f0" "%~nx0" %*
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
@if (@X)==(@Y) @end JScript comment */
|
||||
|
||||
|
||||
/*
|
||||
Compression/uncompression command-line tool that uses Shell.Application and WSH/Jscript -
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/bb774085(v=vs.85).aspx
|
||||
|
||||
Some resources That I've used:
|
||||
http://www.robvanderwoude.com/vbstech_files_zip.php
|
||||
https://code.google.com/p/jsxt/source/browse/trunk/js/win32/ZipFile.js?r=161
|
||||
|
||||
|
||||
|
||||
|
||||
UPDATE *17-03-15*
|
||||
|
||||
Devnullius Plussed noticed a bug in ZipDirItems and ZipItem functions (now fixed)
|
||||
And also following issues (at the moment not handled by the script):
|
||||
- if there's not enough space on the system drive (usually C:\) the script could produce various errors , most often the script halts.
|
||||
- Folders and files that contain unicode symbols cannot be handled by Shell.Application object.
|
||||
|
||||
UPDATE *24-03-15*
|
||||
|
||||
Error messages are caught in waitforcount method and if shuch pops-up the script is stopped.
|
||||
As I don't know hoe to check the content of the pop-up the exact reason for the failure is not given
|
||||
but only the possible reasons.
|
||||
|
||||
UPDATE *22-02-16*
|
||||
|
||||
Javid Pack(https://github.com/JavidPack) has found two bugs in zipItem command and in ZipItem function.Now fixed.
|
||||
|
||||
------
|
||||
It's possible to be ported for C#,Powershell and JScript.net so I'm planning to do it at some time.
|
||||
|
||||
For sure there's a lot of room for improvements and optimization and I'm absolutely sure there are some bugs
|
||||
as the script is big enough to not have.
|
||||
|
||||
|
||||
|
||||
!!!
|
||||
For suggestions contact me at - npocmaka@gmail.com
|
||||
!!!
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// CONSTANTS
|
||||
|
||||
// TODO - Shell.Application and Scripting.FileSystemObject objects could be set as global variables to avoid theit creation
|
||||
// in every method.
|
||||
|
||||
//empty zip character sequense
|
||||
var ZIP_DATA= "PK" + String.fromCharCode(5) + String.fromCharCode(6) + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
|
||||
var SLEEP_INTERVAL=200;
|
||||
|
||||
//copy option(s) used by Shell.Application.CopyHere/MoveHere
|
||||
var NO_PROGRESS_BAR=4;
|
||||
|
||||
|
||||
//oprions used for zip/unzip
|
||||
var force=true;
|
||||
var move=false;
|
||||
|
||||
//option used for listing content of archive
|
||||
var flat=false;
|
||||
|
||||
var source="";
|
||||
var destination="";
|
||||
|
||||
var ARGS = WScript.Arguments;
|
||||
var scriptName=ARGS.Item(0);
|
||||
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////
|
||||
// ADODB.Stream extensions
|
||||
|
||||
if ( ! this.ADODB ) {
|
||||
var ADODB = {};
|
||||
}
|
||||
|
||||
if ( ! ADODB.Stream ) {
|
||||
ADODB.Stream = {};
|
||||
}
|
||||
|
||||
// writes a binary data to a file
|
||||
if ( ! ADODB.Stream.writeFile ) {
|
||||
ADODB.Stream.writeFile = function(filename, bindata)
|
||||
{
|
||||
var stream = new ActiveXObject("ADODB.Stream");
|
||||
stream.Type = 2;
|
||||
stream.Mode = 3;
|
||||
stream.Charset ="ASCII";
|
||||
stream.Open();
|
||||
stream.Position = 0;
|
||||
stream.WriteText(bindata);
|
||||
stream.SaveToFile(filename, 2);
|
||||
stream.Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////
|
||||
// common
|
||||
|
||||
if ( ! this.Common ) {
|
||||
var Common = {};
|
||||
}
|
||||
|
||||
if ( ! Common.WaitForCount ) {
|
||||
Common.WaitForCount = function(folderObject,targetCount,countFunction){
|
||||
var shell = new ActiveXObject("Wscript.Shell");
|
||||
while (countFunction(folderObject) < targetCount ){
|
||||
WScript.Sleep(SLEEP_INTERVAL);
|
||||
//checks if a pop-up with error message appears while zipping
|
||||
//at the moment I have no idea how to read the pop-up content
|
||||
// to give the exact reason for failing
|
||||
if (shell.AppActivate("Compressed (zipped) Folders Error")) {
|
||||
WScript.Echo("Error While zipping");
|
||||
WScript.Echo("");
|
||||
WScript.Echo("Possible reasons:");
|
||||
WScript.Echo(" -source contains filename(s) with unicode characters");
|
||||
WScript.Echo(" -produces zip exceeds 8gb size (or 2,5 gb for XP and 2003)");
|
||||
WScript.Echo(" -not enough space on system drive (usually C:\\)");
|
||||
WScript.Quit(432);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Common.getParent ) {
|
||||
Common.getParent = function(path){
|
||||
var splitted=path.split("\\");
|
||||
var result="";
|
||||
for (var s=0;s<splitted.length-1;s++){
|
||||
if (s==0) {
|
||||
result=splitted[s];
|
||||
} else {
|
||||
result=result+"\\"+splitted[s];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Common.getName ) {
|
||||
Common.getName = function(path){
|
||||
var splitted=path.split("\\");
|
||||
return splitted[splitted.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
//file system object has a problem to create a folder with slashes at the end
|
||||
if ( ! Common.stripTrailingSlash ) {
|
||||
Common.stripTrailingSlash = function(path){
|
||||
while (path.substr(path.length - 1,path.length) == '\\') {
|
||||
path=path.substr(0, path.length - 1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////
|
||||
// Scripting.FileSystemObject extensions
|
||||
|
||||
if (! this.Scripting) {
|
||||
var Scripting={};
|
||||
}
|
||||
|
||||
if (! Scripting.FileSystemObject) {
|
||||
Scripting.FileSystemObject={};
|
||||
}
|
||||
|
||||
if ( ! Scripting.FileSystemObject.DeleteItem ) {
|
||||
Scripting.FileSystemObject.DeleteItem = function (item)
|
||||
{
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
if (FSOObj.FileExists(item)){
|
||||
FSOObj.DeleteFile(item);
|
||||
return true;
|
||||
} else if (FSOObj.FolderExists(item) ) {
|
||||
FSOObj.DeleteFolder(Common.stripTrailingSlash(item));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! Scripting.FileSystemObject.ExistsFile ) {
|
||||
Scripting.FileSystemObject.ExistsFile = function (path)
|
||||
{
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
return FSOObj.FileExists(path);
|
||||
}
|
||||
}
|
||||
if ( !Scripting.FileSystemObject.ExistsFolder ) {
|
||||
Scripting.FileSystemObject.ExistsFolder = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
return FSOObj.FolderExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Scripting.FileSystemObject.isFolder ) {
|
||||
Scripting.FileSystemObject.isFolder = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
return FSOObj.FolderExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ! Scripting.FileSystemObject.isEmptyFolder ) {
|
||||
Scripting.FileSystemObject.isEmptyFolder = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
if(FSOObj.FileExists(path)){
|
||||
return false;
|
||||
}else if (FSOObj.FolderExists(path)){
|
||||
var folderObj=FSOObj.GetFolder(path);
|
||||
if ((folderObj.Files.Count+folderObj.SubFolders.Count)==0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( ! Scripting.FileSystemObject.CreateFolder) {
|
||||
Scripting.FileSystemObject.CreateFolder = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
FSOObj.CreateFolder(path);
|
||||
return FSOObj.FolderExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Scripting.FileSystemObject.ExistsItem) {
|
||||
Scripting.FileSystemObject.ExistsItem = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
return FSOObj.FolderExists(path)||FSOObj.FileExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Scripting.FileSystemObject.getFullPath) {
|
||||
Scripting.FileSystemObject.getFullPath = function (path){
|
||||
var FSOObj= new ActiveXObject("Scripting.FileSystemObject");
|
||||
return FSOObj.GetAbsolutePathName(path);
|
||||
}
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////
|
||||
// Shell.Application extensions
|
||||
if ( ! this.Shell ) {
|
||||
var Shell = {};
|
||||
}
|
||||
|
||||
if (! Shell.Application ) {
|
||||
Shell.Application={};
|
||||
}
|
||||
|
||||
if ( ! Shell.Application.ExistsFolder ) {
|
||||
Shell.Application.ExistsFolder = function(path){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var targetObject = new Object;
|
||||
var targetObject=ShellObj.NameSpace(path);
|
||||
if (typeof targetObject === 'undefined' || targetObject == null ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Shell.Application.ExistsSubItem ) {
|
||||
Shell.Application.ExistsSubItem = function(path){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var targetObject = new Object;
|
||||
var targetObject=ShellObj.NameSpace(Common.getParent(path));
|
||||
if (typeof targetObject === 'undefined' || targetObject == null ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var subItem=targetObject.ParseName(Common.getName(path));
|
||||
if(subItem === 'undefined' || subItem == null ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! Shell.Application.ItemCounterL1 ) {
|
||||
Shell.Application.ItemCounterL1 = function(path){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var targetObject = new Object;
|
||||
var targetObject=ShellObj.NameSpace(path);
|
||||
if (targetObject != null ){
|
||||
return targetObject.Items().Count;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// shell application item.size returns the size of uncompressed state of the file.
|
||||
if ( ! Shell.Application.getSize ) {
|
||||
Shell.Application.getSize = function(path){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var targetObject = new Object;
|
||||
var targetObject=ShellObj.NameSpace(path);
|
||||
if (! Shell.Application.ExistsFolder (path)){
|
||||
WScript.Echo(path + "does not exists or the file is incorrect type.Be sure you are using full path to the file");
|
||||
return 0;
|
||||
}
|
||||
if (typeof size === 'undefined'){
|
||||
var size=0;
|
||||
}
|
||||
if (targetObject != null ){
|
||||
|
||||
for (var i=0; i<targetObject.Items().Count;i++){
|
||||
if(!targetObject.Items().Item(i).IsFolder){
|
||||
size=size+targetObject.Items().Item(i).Size;
|
||||
} else if (targetObject.Items().Item(i).Count!=0){
|
||||
size=size+Shell.Application.getSize(targetObject.Items().Item(i).Path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
if ( ! Shell.Application.TakeAction ) {
|
||||
Shell.Application.TakeAction = function(destination,item, move ,option){
|
||||
if(typeof destination != 'undefined' && move){
|
||||
destination.MoveHere(item,option);
|
||||
} else if(typeof destination != 'undefined') {
|
||||
destination.CopyHere(item,option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ProcessItem and ProcessSubItems can be used both for zipping and unzipping
|
||||
// When an item is zipped another process is ran and the control is released
|
||||
// but when the script stops also the copying to the zipped file stops.
|
||||
// Though the zipping is transactional so a zipped files will be visible only after the zipping is done
|
||||
// and we can rely on items count when zip operation is performed.
|
||||
// Also is impossible to compress an empty folders.
|
||||
// So when it comes to zipping two additional checks are added - for empty folders and for count of items at the
|
||||
// destination.
|
||||
|
||||
if ( ! Shell.Application.ProcessItem ) {
|
||||
Shell.Application.ProcessItem = function(toProcess, destination , move ,isZipping,option){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
destinationObj=ShellObj.NameSpace(destination);
|
||||
|
||||
if (destinationObj!= null ){
|
||||
if (isZipping && Scripting.FileSystemObject.isEmptyFolder(toProcess)) {
|
||||
WScript.Echo(toProcess +" is an empty folder and will be not processed");
|
||||
return;
|
||||
}
|
||||
Shell.Application.TakeAction(destinationObj,toProcess, move ,option);
|
||||
var destinationCount=Shell.Application.ItemCounterL1(destination);
|
||||
var final_destination=destination + "\\" + Common.getName(toProcess);
|
||||
|
||||
if (isZipping && !Shell.Application.ExistsSubItem(final_destination)) {
|
||||
Common.WaitForCount(destination
|
||||
,destinationCount+1,Shell.Application.ItemCounterL1);
|
||||
} else if (isZipping && Shell.Application.ExistsSubItem(final_destination)){
|
||||
WScript.Echo(final_destination + " already exists and task cannot be completed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ! Shell.Application.ProcessSubItems ) {
|
||||
Shell.Application.ProcessSubItems = function(toProcess, destination , move ,isZipping ,option){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var destinationObj=ShellObj.NameSpace(destination);
|
||||
var toItemsToProcess=new Object;
|
||||
toItemsToProcess=ShellObj.NameSpace(toProcess).Items();
|
||||
|
||||
if (destinationObj!= null ){
|
||||
|
||||
for (var i=0;i<toItemsToProcess.Count;i++) {
|
||||
|
||||
if (isZipping && Scripting.FileSystemObject.isEmptyFolder(toItemsToProcess.Item(i).Path)){
|
||||
|
||||
WScript.Echo("");
|
||||
WScript.Echo(toItemsToProcess.Item(i).Path + " is empty and will be not processed");
|
||||
WScript.Echo("");
|
||||
|
||||
} else {
|
||||
Shell.Application.TakeAction(destinationObj,toItemsToProcess.Item(i),move,option);
|
||||
var destinationCount=Shell.Application.ItemCounterL1(destination);
|
||||
if (isZipping) {
|
||||
Common.WaitForCount(destination,destinationCount+1,Shell.Application.ItemCounterL1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Shell.Application.ListItems ) {
|
||||
Shell.Application.ListItems = function(parrentObject){
|
||||
var ShellObj=new ActiveXObject("Shell.Application");
|
||||
var targetObject = new Object;
|
||||
var targetObject=ShellObj.NameSpace(parrentObject);
|
||||
|
||||
if (! Shell.Application.ExistsFolder (parrentObject)){
|
||||
WScript.Echo(parrentObject + "does not exists or the file is incorrect type.Be sure the full path the path is used");
|
||||
return;
|
||||
}
|
||||
if (typeof initialSCount == 'undefined') {
|
||||
initialSCount=(parrentObject.split("\\").length-1);
|
||||
WScript.Echo(parrentObject);
|
||||
}
|
||||
|
||||
var spaces=function(path){
|
||||
var SCount=(path.split("\\").length-1)-initialSCount;
|
||||
var s="";
|
||||
for (var i=0;i<=SCount;i++) {
|
||||
s=" "+s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
var printP = function (item,end){
|
||||
if (flat) {
|
||||
WScript.Echo(targetObject.Items().Item(i).Path+end);
|
||||
}else{
|
||||
WScript.Echo( spaces(targetObject.Items().Item(i).Path)+targetObject.Items().Item(i).Name+end);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetObject != null ){
|
||||
var folderPath="";
|
||||
|
||||
for (var i=0; i<targetObject.Items().Count;i++) {
|
||||
if(targetObject.Items().Item(i).IsFolder && targetObject.Items().Item(i).Count==0 ){
|
||||
printP(targetObject.Items().Item(i),"\\");
|
||||
} else if (targetObject.Items().Item(i).IsFolder){
|
||||
folderPath=parrentObject+"\\"+targetObject.Items().Item(i).Name;
|
||||
printP(targetObject.Items().Item(i),"\\")
|
||||
Shell.Application.ListItems(folderPath);
|
||||
|
||||
} else {
|
||||
printP(targetObject.Items().Item(i),"")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// ZIP Utils
|
||||
|
||||
if ( ! this.ZIPUtils ) {
|
||||
var ZIPUtils = {};
|
||||
}
|
||||
|
||||
|
||||
if ( ! this.ZIPUtils.ZipItem) {
|
||||
ZIPUtils.ZipItem = function(source, destination ) {
|
||||
if (!Scripting.FileSystemObject.ExistsItem(source)) {
|
||||
WScript.Echo("");
|
||||
WScript.Echo("file " + source +" does not exist");
|
||||
WScript.Quit(2);
|
||||
}
|
||||
|
||||
if (Scripting.FileSystemObject.ExistsFile(destination) && force ) {
|
||||
Scripting.FileSystemObject.DeleteItem(destination);
|
||||
ADODB.Stream.writeFile(destination,ZIP_DATA);
|
||||
} else if (!Scripting.FileSystemObject.ExistsFile(destination)) {
|
||||
ADODB.Stream.writeFile(destination,ZIP_DATA);
|
||||
} else {
|
||||
WScript.Echo("Destination "+destination+" already exists.Operation will be aborted");
|
||||
WScript.Quit(15);
|
||||
}
|
||||
source=Scripting.FileSystemObject.getFullPath(source);
|
||||
destination=Scripting.FileSystemObject.getFullPath(destination);
|
||||
|
||||
Shell.Application.ProcessItem(source,destination,move,true ,NO_PROGRESS_BAR);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! this.ZIPUtils.ZipDirItems) {
|
||||
ZIPUtils.ZipDirItems = function(source, destination ) {
|
||||
if (!Scripting.FileSystemObject.ExistsFolder(source)) {
|
||||
WScript.Echo();
|
||||
WScript.Echo("file " + source +" does not exist");
|
||||
WScript.Quit(2);
|
||||
}
|
||||
if (Scripting.FileSystemObject.ExistsFile(destination) && force ) {
|
||||
Scripting.FileSystemObject.DeleteItem(destination);
|
||||
ADODB.Stream.writeFile(destination,ZIP_DATA);
|
||||
} else if (!Scripting.FileSystemObject.ExistsFile(destination)) {
|
||||
ADODB.Stream.writeFile(destination,ZIP_DATA);
|
||||
} else {
|
||||
WScript.Echo("Destination "+destination+" already exists.Operation will be aborted");
|
||||
WScript.Quit(15);
|
||||
}
|
||||
|
||||
source=Scripting.FileSystemObject.getFullPath(source);
|
||||
destination=Scripting.FileSystemObject.getFullPath(destination);
|
||||
|
||||
Shell.Application.ProcessSubItems(source, destination, move ,true,NO_PROGRESS_BAR);
|
||||
|
||||
if (move){
|
||||
Scripting.FileSystemObject.DeleteItem(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! this.ZIPUtils.Unzip) {
|
||||
ZIPUtils.Unzip = function(source, destination ) {
|
||||
if(!Shell.Application.ExistsFolder(source) ){
|
||||
WScript.Echo("Either the target does not exist or is not a correct type");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Scripting.FileSystemObject.ExistsItem(destination) && force ) {
|
||||
Scripting.FileSystemObject.DeleteItem(destination);
|
||||
} else if (Scripting.FileSystemObject.ExistsItem(destination)){
|
||||
WScript.Echo("Destination " + destination + " already exists");
|
||||
return;
|
||||
}
|
||||
Scripting.FileSystemObject.CreateFolder(destination);
|
||||
source=Scripting.FileSystemObject.getFullPath(source);
|
||||
destination=Scripting.FileSystemObject.getFullPath(destination);
|
||||
Shell.Application.ProcessSubItems(source, destination, move ,false,NO_PROGRESS_BAR);
|
||||
|
||||
if (move){
|
||||
Scripting.FileSystemObject.DeleteItem(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! this.ZIPUtils.AddToZip) {
|
||||
ZIPUtils.AddToZip = function(source, destination ) {
|
||||
if(!Shell.Application.ExistsFolder(destination)) {
|
||||
WScript.Echo(destination +" is not valid path to/within zip.Be sure you are not using relative paths");
|
||||
Wscript.Exit("101");
|
||||
}
|
||||
if(!Scripting.FileSystemObject.ExistsItem(source)){
|
||||
WScript.Echo(source +" does not exist");
|
||||
Wscript.Exit("102");
|
||||
}
|
||||
source=Scripting.FileSystemObject.getFullPath(source);
|
||||
Shell.Application.ProcessItem(source,destination,move,true ,NO_PROGRESS_BAR);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! this.ZIPUtils.UnzipItem) {
|
||||
ZIPUtils.UnzipItem = function(source, destination ) {
|
||||
|
||||
if(!Shell.Application.ExistsSubItem(source)){
|
||||
WScript.Echo(source + ":Either the target does not exist or is not a correct type");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Scripting.FileSystemObject.ExistsItem(destination) && force ) {
|
||||
Scripting.FileSystemObject.DeleteItem(destination);
|
||||
} else if (Scripting.FileSystemObject.ExistsItem(destination)){
|
||||
WScript.Echo(destination+" - Destination already exists");
|
||||
return;
|
||||
}
|
||||
|
||||
Scripting.FileSystemObject.CreateFolder(destination);
|
||||
destination=Scripting.FileSystemObject.getFullPath(destination);
|
||||
Shell.Application.ProcessItem(source, destination, move ,false,NO_PROGRESS_BAR);
|
||||
|
||||
}
|
||||
}
|
||||
if ( ! this.ZIPUtils.getSize) {
|
||||
ZIPUtils.getSize = function(path) {
|
||||
// first getting a full path to the file is attempted
|
||||
// as it's required by shell.application
|
||||
// otherwise is assumed that a file within a zip
|
||||
// is aimed
|
||||
|
||||
//TODO - find full path even if the path points to internal for the
|
||||
// zip directory
|
||||
|
||||
if (Scripting.FileSystemObject.ExistsFile(path)){
|
||||
path=Scripting.FileSystemObject.getFullPath(path);
|
||||
}
|
||||
WScript.Echo(Shell.Application.getSize(path));
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! this.ZIPUtils.list) {
|
||||
ZIPUtils.list = function(path) {
|
||||
// first getting a full path to the file is attempted
|
||||
// as it's required by shell.application
|
||||
// otherwise is assumed that a file within a zip
|
||||
// is aimed
|
||||
|
||||
//TODO - find full path even if the path points to internal for the
|
||||
// zip directory
|
||||
|
||||
// TODO - optional printing of each file uncompressed size
|
||||
|
||||
if (Scripting.FileSystemObject.ExistsFile(path)){
|
||||
path=Scripting.FileSystemObject.getFullPath(path);
|
||||
}
|
||||
Shell.Application.ListItems(path);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////
|
||||
// parsing'n'running
|
||||
function printHelp(){
|
||||
|
||||
WScript.Echo( scriptName + " list -source zipFile [-flat yes|no]");
|
||||
WScript.Echo( " list the content of a zip file");
|
||||
WScript.Echo( " zipFile - absolute path to the zip file");
|
||||
WScript.Echo( " could be also a directory or a directory inside a zip file or");
|
||||
WScript.Echo( " or a .cab file or an .iso file");
|
||||
WScript.Echo( " -flat - indicates if the structure of the zip will be printed as tree");
|
||||
WScript.Echo( " or with absolute paths (-flat yes).Default is yes.");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " list -source C:\\myZip.zip -flat no" );
|
||||
WScript.Echo( " " + scriptName + " list -source C:\\myZip.zip\\inZipDir -flat yes" );
|
||||
|
||||
WScript.Echo( scriptName + " getSize -source zipFile");
|
||||
WScript.Echo( " prints uncompressed size of the zipped file in bytes");
|
||||
WScript.Echo( " zipFile - absolute path to the zip file");
|
||||
WScript.Echo( " could be also a directory or a directory inside a zip file or");
|
||||
WScript.Echo( " or a .cab file or an .iso file");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " getSize -source C:\\myZip.zip" );
|
||||
|
||||
WScript.Echo( scriptName + " zipDirItems -source source_dir -destination destination.zip [-force yes|no] [-keep yes|no]");
|
||||
WScript.Echo( " zips the content of given folder without the folder itself ");
|
||||
WScript.Echo( " source_dir - path to directory which content will be compressed");
|
||||
WScript.Echo( " Empty folders in the source directory will be ignored");
|
||||
WScript.Echo( " destination.zip - path/name of the zip file that will be created");
|
||||
WScript.Echo( " -force - indicates if the destination will be overwritten if already exists.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( " -keep - indicates if the source content will be moved or just copied/kept.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " zipDirItems -source C:\\myDir\\ -destination C:\\MyZip.zip -keep yes -force no" );
|
||||
|
||||
WScript.Echo( scriptName + " zipItem -source item -destination destination.zip [-force yes|no] [-keep yes|no]");
|
||||
WScript.Echo( " zips file or directory to a destination.zip file ");
|
||||
WScript.Echo( " item - path to file or directory which content will be compressed");
|
||||
WScript.Echo( " If points to an empty folder it will be ignored");
|
||||
WScript.Echo( " If points to a folder it also will be included in the zip file alike zipdiritems command");
|
||||
WScript.Echo( " Eventually zipping a folder in this way will be faster as it does not process every element one by one");
|
||||
WScript.Echo( " destination.zip - path/name of the zip file that will be created");
|
||||
WScript.Echo( " -force - indicates if the destination will be overwritten if already exists.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( " -keep - indicates if the source content will be moved or just copied/kept.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " zipItem -source C:\\myDir\\myFile.txt -destination C:\\MyZip.zip -keep yes -force no" );
|
||||
|
||||
WScript.Echo( scriptName + " unzip -source source.zip -destination destination_dir [-force yes|no] [-keep yes|no]");
|
||||
WScript.Echo( " unzips the content of a zip file to a given directory ");
|
||||
WScript.Echo( " source - path to the zip file that will be expanded");
|
||||
WScript.Echo( " Eventually .iso , .cab or even an ordinary directory can be used as a source");
|
||||
WScript.Echo( " destination_dir - path to directory where unzipped items will be stored");
|
||||
WScript.Echo( " -force - indicates if the destination will be overwritten if already exists.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( " -keep - indicates if the source content will be moved or just copied/kept.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " unzip -source C:\\myDir\\myZip.zip -destination C:\\MyDir -keep no -force no" );
|
||||
|
||||
WScript.Echo( scriptName + " unZipItem -source source.zip -destination destination_dir [-force yes|no] [-keep yes|no]");
|
||||
WScript.Echo( " unzips a single within a given zip file to a destination directory");
|
||||
WScript.Echo( " source - path to the file/folcer within a zip that will be expanded");
|
||||
WScript.Echo( " Eventually .iso , .cab or even an ordinary directory can be used as a source");
|
||||
WScript.Echo( " destination_dir - path to directory where unzipped item will be stored");
|
||||
WScript.Echo( " -force - indicates if the destination directory will be overwritten if already exists.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( " -keep - indicates if the source content will be moved or just copied/kept.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " unZipItem -source C:\\myDir\\myZip.zip\\InzipDir\\InzipFile -destination C:\\OtherDir -keep no -force yes" );
|
||||
WScript.Echo( " " + scriptName + " unZipItem -source C:\\myDir\\myZip.zip\\InzipDir -destination C:\\OtherDir " );
|
||||
|
||||
WScript.Echo( scriptName + " addToZip -source sourceItem -destination destination.zip [-keep yes|no]");
|
||||
WScript.Echo( " adds file or folder to already exist zip file");
|
||||
WScript.Echo( " source - path to the item that will be processed");
|
||||
WScript.Echo( " destination_zip - path to the zip where the item will be added");
|
||||
WScript.Echo( " -keep - indicates if the source content will be moved or just copied/kept.");
|
||||
WScript.Echo( " default is yes");
|
||||
WScript.Echo( "Example:");
|
||||
WScript.Echo( " " + scriptName + " addToZip -source C:\\some_file -destination C:\\myDir\\myZip.zip\\InzipDir -keep no " );
|
||||
WScript.Echo( " " + scriptName + " addToZip -source C:\\some_file -destination C:\\myDir\\myZip.zip " );
|
||||
|
||||
WScript.Echo( " by Vasil \"npocmaka\" Arnaudov - npocmaka@gmail.com" );
|
||||
WScript.Echo( " ver 0.1.2 " );
|
||||
WScript.Echo( " latest version could be found here https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/zipjs.bat" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function parseArguments(){
|
||||
if (WScript.Arguments.Length==1 || WScript.Arguments.Length==2 || ARGS.Item(1).toLowerCase() == "-help" || ARGS.Item(1).toLowerCase() == "-h" ) {
|
||||
printHelp();
|
||||
WScript.Quit(0);
|
||||
}
|
||||
|
||||
//all arguments are key-value pairs plus one for script name and action taken - need to be even number
|
||||
if (WScript.Arguments.Length % 2 == 1 ) {
|
||||
WScript.Echo("Illegal arguments ");
|
||||
printHelp();
|
||||
WScript.Quit(1);
|
||||
}
|
||||
|
||||
//ARGS
|
||||
for(var arg = 2 ; arg<ARGS.Length-1;arg=arg+2) {
|
||||
if (ARGS.Item(arg) == "-source") {
|
||||
source = ARGS.Item(arg +1);
|
||||
}
|
||||
if (ARGS.Item(arg) == "-destination") {
|
||||
destination = ARGS.Item(arg +1);
|
||||
}
|
||||
if (ARGS.Item(arg).toLowerCase() == "-keep" && ARGS.Item(arg +1).toLowerCase() == "no") {
|
||||
move=true;
|
||||
}
|
||||
if (ARGS.Item(arg).toLowerCase() == "-force" && ARGS.Item(arg +1).toLowerCase() == "no") {
|
||||
force=false;
|
||||
}
|
||||
if (ARGS.Item(arg).toLowerCase() == "-flat" && ARGS.Item(arg +1).toLowerCase() == "yes") {
|
||||
flat=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (source == ""){
|
||||
WScript.Echo("Source not given");
|
||||
printHelp();
|
||||
WScript.Quit(59);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var checkDestination=function(){
|
||||
if (destination == ""){
|
||||
WScript.Echo("Destination not given");
|
||||
printHelp();
|
||||
WScript.Quit(65);
|
||||
}
|
||||
}
|
||||
|
||||
var main=function(){
|
||||
parseArguments();
|
||||
switch (ARGS.Item(1).toLowerCase()) {
|
||||
case "list":
|
||||
ZIPUtils.list(source);
|
||||
break;
|
||||
case "getsize":
|
||||
ZIPUtils.getSize(source);
|
||||
break;
|
||||
case "zipdiritems":
|
||||
checkDestination();
|
||||
ZIPUtils.ZipDirItems(source,destination);
|
||||
break;
|
||||
case "zipitem":
|
||||
checkDestination();
|
||||
ZIPUtils.ZipItem(source,destination);
|
||||
break;
|
||||
case "unzip":
|
||||
checkDestination();
|
||||
ZIPUtils.Unzip(source,destination);
|
||||
break;
|
||||
case "unzipitem":
|
||||
checkDestination();
|
||||
ZIPUtils.UnzipItem(source,destination);
|
||||
break;
|
||||
case "addtozip":
|
||||
checkDestination();
|
||||
ZIPUtils.AddToZip(source,destination);
|
||||
break;
|
||||
default:
|
||||
WScript.Echo("No valid switch has been passed");
|
||||
printHelp();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
main();
|
||||
//
|
||||
//////////////////////////////////////
|
@ -301,13 +301,17 @@ Returns:
|
||||
|
||||
# Updating the time zone database
|
||||
|
||||
Time zones are often changed and when this happen it's convenient to update the time zone database as soon as possible.
|
||||
Firebird uses the [IANA time zone database](http://www.iana.org/time-zones) through the ICU library.
|
||||
|
||||
Firebird stores `WITH TIME ZONE` values translated to UTC time. If a value is created with one time zone database and later that database is updated and the update changes the information in the range of a stored value, when reading that value it will be returned as a different than the one initially stored.
|
||||
When a Firebird version is released it's released with the most up-to-date time zone database but with the time it may become outdated.
|
||||
|
||||
Firebird uses the [IANA time zone database](http://www.iana.org/time-zones) through the ICU library. ICU library present in Firebird kit (Windows) or present in OS (Linux, POSIX) sometimes has outdated time zone database.
|
||||
An updated database can be found in [this Firebird's github page](https://github.com/FirebirdSQL/firebird/tree/master/tzdata). `le.zip` stands for little-endian and is the necessary file for most computer architectures (Intel/AMD compatible x86 or x64). `be.zip` stands for big-endian architectures.
|
||||
|
||||
Update procedure is described in that [ICU page](http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data). The easiest way to update is downloading the `*.res` files in a directory and set `ICU_TIMEZONE_FILES_DIR` environment variable pointing to it.
|
||||
The content of the zip file must be extracted in the `tzdata` subdirectory of Firebird's root, overwriting the others `*.res` files of the old database.
|
||||
|
||||
Note: `<firebird root>/tzdata` is the default directory where Firebird looks for the database. It could be overriden with the `ICU_TIMEZONE_FILES_DIR` environment variable.
|
||||
|
||||
Important note: Firebird stores `WITH TIME ZONE` values translated to UTC time. If a value is created with one time zone database and later that database is updated and the update changes the information in the range of a stored value, when reading that value it will be returned as a different value than the one initially stored.
|
||||
|
||||
|
||||
# Appendix: time zone regions
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "../common/classes/timestamp.h"
|
||||
#include "../common/classes/GenericMap.h"
|
||||
#include "../common/config/config.h"
|
||||
#include "../common/os/path_utils.h"
|
||||
#include "unicode/ucal.h"
|
||||
|
||||
#ifdef TZ_UPDATE
|
||||
@ -190,6 +191,21 @@ static InitInstance<TimeZoneStartup> timeZoneStartup;
|
||||
//-------------------------------------
|
||||
|
||||
const char TimeZoneUtil::GMT_FALLBACK[5] = "GMT*";
|
||||
InitInstance<PathName> TimeZoneUtil::tzDataPath;
|
||||
|
||||
void TimeZoneUtil::initTimeZoneEnv()
|
||||
{
|
||||
PathName path;
|
||||
PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata");
|
||||
|
||||
if (fb_utils::setenv("ICU_TIMEZONE_FILES_DIR", path.c_str(), false))
|
||||
tzDataPath() = path;
|
||||
}
|
||||
|
||||
const PathName& TimeZoneUtil::getTzDataPath()
|
||||
{
|
||||
return tzDataPath();
|
||||
}
|
||||
|
||||
// Return the current user's time zone.
|
||||
USHORT TimeZoneUtil::getSystemTimeZone()
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
static const unsigned MAX_LEN = 32;
|
||||
static const unsigned MAX_SIZE = MAX_LEN + 1;
|
||||
|
||||
private:
|
||||
static InitInstance<PathName> tzDataPath;
|
||||
|
||||
public:
|
||||
static UDate ticksToIcuDate(SINT64 ticks)
|
||||
{
|
||||
@ -76,6 +79,9 @@ public:
|
||||
return (SINT64(icuDate) * 10) + (TimeStamp::UNIX_DATE * TimeStamp::ISC_TICKS_PER_DAY);
|
||||
}
|
||||
|
||||
static void initTimeZoneEnv();
|
||||
static const PathName& getTzDataPath();
|
||||
|
||||
static USHORT getSystemTimeZone();
|
||||
|
||||
static void getDatabaseVersion(Firebird::string& str);
|
||||
|
@ -31,12 +31,14 @@
|
||||
#include "../common/isc_proto.h"
|
||||
#include "../common/CharSet.h"
|
||||
#include "../common/IntlUtil.h"
|
||||
#include "../common/TimeZoneUtil.h"
|
||||
#include "../common/gdsassert.h"
|
||||
#include "../common/classes/auto.h"
|
||||
#include "../common/classes/GenericMap.h"
|
||||
#include "../common/classes/init.h"
|
||||
#include "../common/classes/objects_array.h"
|
||||
#include "../common/classes/rwlock.h"
|
||||
#include "../common/config/config.h"
|
||||
#include "../common/StatusHolder.h"
|
||||
#include "../common/os/path_utils.h"
|
||||
|
||||
@ -126,9 +128,11 @@ public:
|
||||
void BaseICU::initialize(ModuleLoader::Module* module)
|
||||
{
|
||||
void (U_EXPORT2 *uInit)(UErrorCode* status);
|
||||
void (U_EXPORT2 *uSetTimeZoneFilesDirectory)(const char* path, UErrorCode* status);
|
||||
void (U_EXPORT2 *uSetDataDirectory)(const char* directory);
|
||||
|
||||
getEntryPoint("u_init", module, uInit, true);
|
||||
getEntryPoint("u_setTimeZoneFilesDirectory", module, uSetTimeZoneFilesDirectory, true);
|
||||
getEntryPoint("u_setDataDirectory", module, uSetDataDirectory, true);
|
||||
|
||||
#if defined(WIN_NT) || defined(DARWIN)
|
||||
@ -166,6 +170,15 @@ void BaseICU::initialize(ModuleLoader::Module* module)
|
||||
(Arg::Gds(isc_random) << diag).raise();
|
||||
}
|
||||
}
|
||||
|
||||
// ICU's u_setTimeZoneFilesDirectory is an internal API, but we try to use
|
||||
// it because internally set ICU_TIMEZONE_FILES_DIR envvar in Windows is not
|
||||
// safe. See comments in fb_utils::setenv.
|
||||
if (uSetTimeZoneFilesDirectory && TimeZoneUtil::getTzDataPath().hasData())
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
uSetTimeZoneFilesDirectory(TimeZoneUtil::getTzDataPath().c_str(), &status);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../common/gdsassert.h"
|
||||
@ -303,6 +304,35 @@ bool readenv(const char* env_name, Firebird::PathName& env_value)
|
||||
}
|
||||
|
||||
|
||||
bool setenv(const char* name, const char* value, bool overwrite)
|
||||
{
|
||||
#ifdef WIN_NT
|
||||
int errcode = 0;
|
||||
|
||||
if (!overwrite)
|
||||
{
|
||||
size_t envsize = 0;
|
||||
errcode = getenv_s(&envsize, NULL, 0, name);
|
||||
if (errcode || envsize)
|
||||
return false;
|
||||
}
|
||||
|
||||
// In Windows, _putenv_s sets only the environment data in the CRT.
|
||||
// Each DLL (for example ICU) may use a different CRT which different data
|
||||
// or use Win32's GetEnvironmentVariable, so we also use SetEnvironmentVariable.
|
||||
// This is a mess and is not guarenteed to work correctly in all situations.
|
||||
if (SetEnvironmentVariable(name, value))
|
||||
{
|
||||
_putenv_s(name, value);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
#else
|
||||
return ::setenv(name, value, (int) overwrite) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************
|
||||
// s n p r i n t f
|
||||
// ***************
|
||||
|
@ -55,6 +55,7 @@ namespace fb_utils
|
||||
int name_length_limit(const TEXT* const name, size_t bufsize);
|
||||
bool readenv(const char* env_name, Firebird::string& env_value);
|
||||
bool readenv(const char* env_name, Firebird::PathName& env_value);
|
||||
bool setenv(const char* name, const char* value, bool overwrite);
|
||||
int snprintf(char* buffer, size_t count, const char* format...);
|
||||
char* cleanup_passwd(char* arg);
|
||||
inline char* get_passwd(char* arg)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "../common/StatementMetadata.h"
|
||||
#include "../common/StatusHolder.h"
|
||||
#include "../common/ThreadStart.h"
|
||||
#include "../common/TimeZoneUtil.h"
|
||||
#include "../common/isc_proto.h"
|
||||
#include "../common/isc_f_proto.h"
|
||||
#include "../common/utils_proto.h"
|
||||
@ -737,6 +738,19 @@ RefPtr<T> translateHandle(GlobalPtr<GenericMap<Pair<NonPooled<FB_API_HANDLE, T*>
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
class TimeZoneDataInit
|
||||
{
|
||||
public:
|
||||
explicit TimeZoneDataInit(MemoryPool&)
|
||||
{
|
||||
TimeZoneUtil::initTimeZoneEnv();
|
||||
}
|
||||
};
|
||||
|
||||
static GlobalPtr<TimeZoneDataInit> timeZoneDataInit;
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
const int SHUTDOWN_TIMEOUT = 5000; // 5 sec
|
||||
|
||||
class ShutdownInit
|
||||
|
BIN
tzdata/be.zip
Normal file
BIN
tzdata/be.zip
Normal file
Binary file not shown.
BIN
tzdata/le.zip
Normal file
BIN
tzdata/le.zip
Normal file
Binary file not shown.
32
tzdata/update.sh
Executable file
32
tzdata/update.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Change version.txt before run this script.
|
||||
|
||||
THIS_DIR=`readlink -f $0`
|
||||
THIS_DIR=`dirname $THIS_DIR`
|
||||
|
||||
TMP_DIR=`mktemp -d`
|
||||
VERSION=`cat $THIS_DIR/version.txt`
|
||||
BASE_URL=https://github.com/unicode-org/icu-data/raw/master/tzdata/icunew/$VERSION/44
|
||||
|
||||
echo Downloading and updating little-endian files...
|
||||
mkdir $TMP_DIR/le
|
||||
cd $TMP_DIR/le
|
||||
curl -OLs $BASE_URL/le/metaZones.res
|
||||
curl -OLs $BASE_URL/le/timezoneTypes.res
|
||||
curl -OLs $BASE_URL/le/windowsZones.res
|
||||
curl -OLs $BASE_URL/le/zoneinfo64.res
|
||||
rm $THIS_DIR/le.zip
|
||||
zip $THIS_DIR/le.zip *.res
|
||||
|
||||
echo Downloading and updating big-endian files...
|
||||
mkdir $TMP_DIR/be
|
||||
cd $TMP_DIR/be
|
||||
curl -OLs $BASE_URL/be/metaZones.res
|
||||
curl -OLs $BASE_URL/be/timezoneTypes.res
|
||||
curl -OLs $BASE_URL/be/windowsZones.res
|
||||
curl -OLs $BASE_URL/be/zoneinfo64.res
|
||||
rm $THIS_DIR/be.zip
|
||||
zip $THIS_DIR/be.zip *.res
|
||||
|
||||
rm -r $TMP_DIR
|
1
tzdata/version.txt
Normal file
1
tzdata/version.txt
Normal file
@ -0,0 +1 @@
|
||||
2019c
|
Loading…
Reference in New Issue
Block a user