-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathhammerdbws
More file actions
executable file
·113 lines (109 loc) · 3.46 KB
/
hammerdbws
File metadata and controls
executable file
·113 lines (109 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
#########################################################################
## \
export LD_LIBRARY_PATH="./lib:$LD_LIBRARY_PATH"
## \
export PATH="./bin:$PATH"
## \
exec ./bin/tclsh9.0 "$0" ${1+"$@"}
########################################################################
# HammerDB
# Copyright (C) HammerDB Ltd
# Hosted by the TPC-Council
# Author contact information at: http://www.hammerdb.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; If not, see <https://www.gnu.org/licenses/>
########################################################################
if { $argc eq 0 } {
set argv0 "wait"
} else {
set argv0 [ string tolower [lindex $argv 0 ]]
}
global hdb_version
set hdb_version "v6.0"
if { $argv0 != "gui" } {
puts "HammerDB Web Service $hdb_version"
puts "Copyright \u00A9 HammerDB Ltd hosted by tpc.org 2019-2026"
puts "Type \"help\" for a list of commands"
}
set UserDefaultDir [ file dirname [ info script ] ]
::tcl::tm::path add [zipfs root]app/modules "$UserDefaultDir/modules"
lappend auto_path "[zipfs root]app/lib"
set hdb_path [ zipfs mount ]
if { [ lindex $hdb_path 0 ] eq "[ zipfs root ]app" } {
if [ catch {set cd_path [ file normalize [ file dirname [ lindex $hdb_path 1 ]]]} message ] {
set cd_path [ pwd ]
}
if { [ file isdirectory $cd_path ] } {
catch {cd $cd_path}
}
}
append modulelist { Thread msgcat sqlite3 xml comm tclreadline task wapp rest http huddle jobs pipelines ticklecharts }
for { set modcount 0 } { $modcount < [llength $modulelist] } { incr modcount } {
set m [lindex $modulelist $modcount]
set loadtext $m
if [catch { package require $m }] {
if { $argv0 != "gui" } {
puts stderr "While loading module\
\"$m\"...\n$errorInfo"
}
exit 1
}
}
append loadlist { genvu.tcl genxml.tcl geninitws.tcl genws.tcl genhelp.tcl }
for { set loadcount 0 } { $loadcount < [llength $loadlist] } { incr loadcount } {
set f [lindex $loadlist $loadcount]
set loadtext $f
if [catch {source [ file join $UserDefaultDir src generic $f ]}] {
if { $argv0 != "gui" } {
puts stderr "While loading component file\
\"$f\"...\n$errorInfo"
}
exit 1
}
}
for { set dbsrccount 0 } { $dbsrccount < [llength $dbsrclist] } { incr dbsrccount } {
set f [lindex $dbsrclist $dbsrccount]
set loadtext $f
if [catch {source [ file join $UserDefaultDir src $f ]}] {
if { $argv0 != "gui" } {
puts stderr "Error loading database source files/$f"
}
}
}
switch $argv0 {
"gui" {
start_webservice gui
}
"scgi" {
start_webservice scgi
}
"wait" {
start_webservice wait
}
"nowait" {
start_webservice nowait
TclReadLine::interactws
}
"start" {
start_webservice wait
}
"stop" {
puts "Stopping HammerDB Web Service"
quit
}
default {
puts stderr "Error starting HammerDB Web Service: argument should be start, stop, gui, scgi, wait or nowait"
}
}