mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge remote-tracking branch 'upstream/master' into 1271_share_zero
This commit is contained in:
commit
341afe65ef
@ -5,6 +5,7 @@
|
||||
* **Graph**: Thresholds for Right Y axis [#7107](https://github.com/grafana/grafana/issues/7107), thx [@ilgizar](https://github.com/ilgizar)
|
||||
* **Graph**: Support multiple series stacking in histogram mode [#8151](https://github.com/grafana/grafana/issues/8151), thx [@mtanda](https://github.com/mtanda)
|
||||
* **Alerting**: Pausing/un alerts now updates new_state_date [#10942](https://github.com/grafana/grafana/pull/10942)
|
||||
* **Alerting**: Support Pagerduty notification channel using Pagerduty V2 API [#10531](https://github.com/grafana/grafana/issues/10531), thx [@jbaublitz](https://github.com/jbaublitz)
|
||||
* **Templating**: Add comma templating format [#10632](https://github.com/grafana/grafana/issues/10632), thx [@mtanda](https://github.com/mtanda)
|
||||
* **Prometheus**: Support POST for query and query_range [#9859](https://github.com/grafana/grafana/pull/9859), thx [@mtanda](https://github.com/mtanda)
|
||||
|
||||
@ -15,6 +16,9 @@
|
||||
* **Units**: Second to HH:mm:ss formatter [#11107](https://github.com/grafana/grafana/issues/11107), thx [@gladdiologist](https://github.com/gladdiologist)
|
||||
* **Singlestat**: Add color to prefix and postfix in singlestat panel [#11143](https://github.com/grafana/grafana/pull/11143), thx [@ApsOps](https://github.com/ApsOps)
|
||||
|
||||
# 5.0.3 (2018-03-16)
|
||||
* **Mysql**: Mysql panic occurring occasionally upon Grafana dashboard access (a bigger patch than the one in 5.0.2) [#11155](https://github.com/grafana/grafana/issues/11155)
|
||||
|
||||
# 5.0.2 (2018-03-14)
|
||||
* **Mysql**: Mysql panic occurring occasionally upon Grafana dashboard access [#11155](https://github.com/grafana/grafana/issues/11155)
|
||||
* **Dashboards**: Should be possible to browse dashboard using only uid [#11231](https://github.com/grafana/grafana/issues/11231)
|
||||
|
15
Gopkg.lock
generated
15
Gopkg.lock
generated
@ -103,6 +103,14 @@
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/denisenkom/go-mssqldb"
|
||||
packages = [
|
||||
".",
|
||||
"internal/cp"
|
||||
]
|
||||
revision = "270bc3860bb94dd3a3ffd047377d746c5e276726"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fatih/color"
|
||||
packages = ["."]
|
||||
@ -462,7 +470,10 @@
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["pbkdf2"]
|
||||
packages = [
|
||||
"md4",
|
||||
"pbkdf2"
|
||||
]
|
||||
revision = "3d37316aaa6bd9929127ac9a527abf408178ea7b"
|
||||
|
||||
[[projects]]
|
||||
@ -631,6 +642,6 @@
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "4de68f1342ba98a637ec8ca7496aeeae2021bf9e4c7c80db7924e14709151a62"
|
||||
inputs-digest = "5e65aeace832f1b4be17e7ff5d5714513c40f31b94b885f64f98f2332968d7c6"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
@ -197,3 +197,7 @@ ignored = [
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/teris-io/shortid"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/denisenkom/go-mssqldb"
|
||||
revision = "270bc3860bb94dd3a3ffd047377d746c5e276726"
|
||||
|
@ -9,9 +9,6 @@ Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.
|
||||
|
||||

|
||||
|
||||
## Grafana v5 Alpha Preview
|
||||
Grafana master is now v5.0 alpha. This is going to be the biggest and most foundational release Grafana has ever had, coming with a ton of UX improvements, a new dashboard grid engine, dashboard folders, user teams and permissions. Checkout out this [video preview](https://www.youtube.com/watch?v=BC_YRNpqj5k) of Grafana v5.
|
||||
|
||||
## Installation
|
||||
Head to [docs.grafana.org](http://docs.grafana.org/installation/) and [download](https://grafana.com/get)
|
||||
the latest release.
|
||||
@ -27,7 +24,7 @@ the latest master builds [here](https://grafana.com/grafana/download)
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Go 1.9
|
||||
- Go 1.10
|
||||
- NodeJS LTS
|
||||
|
||||
### Building the backend
|
||||
|
@ -6,18 +6,21 @@ But it will give you an idea of our current vision and plan.
|
||||
### Short term (1-2 months)
|
||||
|
||||
- v5.1
|
||||
- Crossplatform builds & build speed improvements
|
||||
- Build speed improvements & integration test execution
|
||||
- Kubernetes friendly docker container
|
||||
- Enterprise LDAP
|
||||
- Provisioning workflow
|
||||
- First login registration view
|
||||
- IFQL Initial support
|
||||
- MSSQL datasource
|
||||
|
||||
### Mid term (2-4 months)
|
||||
|
||||
- v5.2
|
||||
- Azure monitor backend rewrite
|
||||
- Elasticsearch alerting
|
||||
- First login registration view
|
||||
- Backend plugins? (alert notifiers, auth)
|
||||
- Crossplatform builds
|
||||
- IFQL Initial support
|
||||
|
||||
### Long term (4 - 8 months)
|
||||
|
||||
|
4
build.go
4
build.go
@ -79,6 +79,10 @@ func main() {
|
||||
case "setup":
|
||||
setup()
|
||||
|
||||
case "build-srv":
|
||||
clean()
|
||||
build("grafana-server", "./pkg/cmd/grafana-server", []string{})
|
||||
|
||||
case "build-cli":
|
||||
clean()
|
||||
build("grafana-cli", "./pkg/cmd/grafana-cli", []string{})
|
||||
|
@ -4,10 +4,10 @@
|
||||
# change
|
||||
|
||||
# possible values : production, development
|
||||
; app_mode = production
|
||||
;app_mode = production
|
||||
|
||||
# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
|
||||
; instance_name = ${HOSTNAME}
|
||||
;instance_name = ${HOSTNAME}
|
||||
|
||||
#################################### Paths ####################################
|
||||
[paths]
|
||||
@ -21,7 +21,7 @@
|
||||
;plugins = /var/lib/grafana/plugins
|
||||
|
||||
# folder that contains provisioning config files that grafana will apply on startup and while running.
|
||||
; provisioning = conf/provisioning
|
||||
;provisioning = conf/provisioning
|
||||
|
||||
#################################### Server ####################################
|
||||
[server]
|
||||
@ -121,7 +121,6 @@ log_queries =
|
||||
# This enables data proxy logging, default is false
|
||||
;logging = false
|
||||
|
||||
|
||||
#################################### Analytics ####################################
|
||||
[analytics]
|
||||
# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
|
||||
@ -323,7 +322,6 @@ log_queries =
|
||||
# optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug
|
||||
;filters =
|
||||
|
||||
|
||||
# For "console" mode only
|
||||
[log.console]
|
||||
;level =
|
||||
@ -369,7 +367,6 @@ log_queries =
|
||||
# Syslog tag. By default, the process' argv[0] is used.
|
||||
;tag =
|
||||
|
||||
|
||||
#################################### Alerting ############################
|
||||
[alerting]
|
||||
# Disable alerting engine & UI features
|
||||
|
@ -6,3 +6,10 @@
|
||||
- "9300:9300"
|
||||
volumes:
|
||||
- ./blocks/elastic/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
|
||||
fake-elastic-data:
|
||||
image: grafana/fake-data-gen
|
||||
network_mode: bridge
|
||||
environment:
|
||||
FD_DATASOURCE: elasticsearch
|
||||
FD_PORT: 9200
|
||||
|
@ -6,3 +6,10 @@
|
||||
ports:
|
||||
- "10200:9200"
|
||||
- "10300:9300"
|
||||
|
||||
fake-elastic5-data:
|
||||
image: grafana/fake-data-gen
|
||||
network_mode: bridge
|
||||
environment:
|
||||
FD_DATASOURCE: elasticsearch
|
||||
FD_PORT: 10200
|
||||
|
1161
docker/blocks/graphite1/big-dashboard.json
Normal file
1161
docker/blocks/graphite1/big-dashboard.json
Normal file
File diff suppressed because it is too large
Load Diff
1179
docker/blocks/graphite11/big-dashboard.json
Normal file
1179
docker/blocks/graphite11/big-dashboard.json
Normal file
File diff suppressed because it is too large
Load Diff
18
docker/blocks/graphite11/docker-compose.yaml
Normal file
18
docker/blocks/graphite11/docker-compose.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
graphite11:
|
||||
image: graphiteapp/graphite-statsd
|
||||
ports:
|
||||
- "8180:80"
|
||||
- "2103-2104:2003-2004"
|
||||
- "2123-2124:2023-2024"
|
||||
- "8225:8125/udp"
|
||||
- "8226:8126"
|
||||
|
||||
fake-graphite11-data:
|
||||
image: grafana/fake-data-gen
|
||||
network_mode: bridge
|
||||
environment:
|
||||
FD_DATASOURCE: graphite
|
||||
FD_PORT: 2103
|
||||
FD_GRAPHITE_VERSION: 1.1
|
||||
depends_on:
|
||||
- graphite11
|
5
docker/blocks/mssql/build/Dockerfile
Normal file
5
docker/blocks/mssql/build/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM microsoft/mssql-server-linux:2017-CU4
|
||||
WORKDIR /usr/setup
|
||||
COPY . /usr/setup
|
||||
RUN chmod +x /usr/setup/setup.sh
|
||||
CMD /bin/bash ./entrypoint.sh
|
2
docker/blocks/mssql/build/entrypoint.sh
Normal file
2
docker/blocks/mssql/build/entrypoint.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#start SQL Server and run setup script
|
||||
/usr/setup/setup.sh & /opt/mssql/bin/sqlservr
|
12
docker/blocks/mssql/build/setup.sh
Executable file
12
docker/blocks/mssql/build/setup.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#/bin/bash
|
||||
|
||||
#wait for the SQL Server to come up
|
||||
sleep 15s
|
||||
|
||||
cat /usr/setup/setup.sql.template | awk '{
|
||||
gsub(/%%DB%%/,"'$MSSQL_DATABASE'");
|
||||
gsub(/%%USER%%/,"'$MSSQL_USER'");
|
||||
gsub(/%%PWD%%/,"'$MSSQL_PASSWORD'")
|
||||
}1' > /usr/setup/setup.sql
|
||||
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $MSSQL_SA_PASSWORD -d master -i /usr/setup/setup.sql
|
14
docker/blocks/mssql/build/setup.sql.template
Normal file
14
docker/blocks/mssql/build/setup.sql.template
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE LOGIN %%USER%% WITH PASSWORD = '%%PWD%%'
|
||||
GO
|
||||
|
||||
CREATE DATABASE %%DB%%;
|
||||
GO
|
||||
|
||||
USE %%DB%%;
|
||||
GO
|
||||
|
||||
CREATE USER %%USER%% FOR LOGIN %%USER%%;
|
||||
GO
|
||||
|
||||
EXEC sp_addrolemember 'db_owner', '%%USER%%';
|
||||
GO
|
539
docker/blocks/mssql/dashboard.json
Normal file
539
docker/blocks/mssql/dashboard.json
Normal file
@ -0,0 +1,539 @@
|
||||
{
|
||||
"__inputs": [
|
||||
{
|
||||
"name": "DS_MSSQL",
|
||||
"label": "MSSQL",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "mssql",
|
||||
"pluginName": "MSSQL"
|
||||
}
|
||||
],
|
||||
"__requires": [
|
||||
{
|
||||
"type": "grafana",
|
||||
"id": "grafana",
|
||||
"name": "Grafana",
|
||||
"version": "5.0.0"
|
||||
},
|
||||
{
|
||||
"type": "panel",
|
||||
"id": "graph",
|
||||
"name": "Graph",
|
||||
"version": "5.0.0"
|
||||
},
|
||||
{
|
||||
"type": "datasource",
|
||||
"id": "mssql",
|
||||
"name": "MSSQL",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"type": "panel",
|
||||
"id": "table",
|
||||
"name": "Table",
|
||||
"version": "5.0.0"
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": "A dashboard visualizing data generated from grafana/fake-data-gen",
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"iteration": 1520976748896,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"aliasColors": {
|
||||
"total avg": "#6ed0e0"
|
||||
},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"fill": 2,
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 2,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "null",
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [
|
||||
{
|
||||
"alias": "total avg",
|
||||
"fill": 0,
|
||||
"pointradius": 3,
|
||||
"points": true
|
||||
}
|
||||
],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "",
|
||||
"format": "time_series",
|
||||
"rawSql": "SELECT\n $__timeGroup(createdAt,'$summarize') as time,\n avg(value) as value,\n hostname as metric\nFROM \n grafana_metric\nWHERE\n $__timeFilter(createdAt) AND\n measurement = 'logins.count' AND\n hostname IN($host)\nGROUP BY $__timeGroup(createdAt,'$summarize'), hostname\nORDER BY 1",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"alias": "",
|
||||
"format": "time_series",
|
||||
"rawSql": "SELECT\n $__timeGroup(createdAt,'$summarize') as time,\n min(value) as value,\n 'total avg' as metric\nFROM \n grafana_metric\nWHERE\n $__timeFilter(createdAt) AND\n measurement = 'logins.count'\nGROUP BY $__timeGroup(createdAt,'$summarize')\nORDER BY 1",
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeShift": null,
|
||||
"title": "Average logins / $summarize",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"decimals": null,
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"fill": 2,
|
||||
"gridPos": {
|
||||
"h": 18,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
},
|
||||
"id": 8,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "null",
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "",
|
||||
"format": "time_series",
|
||||
"rawSql": "SELECT\n $__timeGroup(createdAt,'$summarize') as time,\n avg(value) as value,\n 'started' as metric\nFROM \n grafana_metric\nWHERE\n $__timeFilter(createdAt) AND\n measurement = 'payment.started'\nGROUP BY $__timeGroup(createdAt,'$summarize')\nORDER BY 1",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"alias": "",
|
||||
"format": "time_series",
|
||||
"rawSql": "SELECT\n $__timeGroup(createdAt,'$summarize') as time,\n avg(value) as value,\n 'ended' as \"metric\"\nFROM \n grafana_metric\nWHERE\n $__timeFilter(createdAt) AND\n measurement = 'payment.ended'\nGROUP BY $__timeGroup(createdAt,'$summarize')\nORDER BY 1",
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeShift": null,
|
||||
"title": "Average payments started/ended / $summarize",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"fill": 2,
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 9
|
||||
},
|
||||
"id": 6,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "null",
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "",
|
||||
"format": "time_series",
|
||||
"rawSql": "SELECT\n $__timeGroup(createdAt,'$summarize') as time,\n max(value) as value,\n hostname as metric\nFROM \n grafana_metric\nWHERE\n $__timeFilter(createdAt) AND\n measurement = 'cpu' AND\n hostname IN($host)\nGROUP BY $__timeGroup(createdAt,'$summarize'), hostname\nORDER BY 1",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeShift": null,
|
||||
"title": "Max CPU / $summarize",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"columns": [],
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"fontSize": "100%",
|
||||
"gridPos": {
|
||||
"h": 10,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 18
|
||||
},
|
||||
"id": 4,
|
||||
"links": [],
|
||||
"pageSize": null,
|
||||
"scroll": true,
|
||||
"showHeader": true,
|
||||
"sort": {
|
||||
"col": 0,
|
||||
"desc": true
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
"alias": "Time",
|
||||
"dateFormat": "YYYY-MM-DD HH:mm:ss",
|
||||
"pattern": "Time",
|
||||
"type": "date"
|
||||
},
|
||||
{
|
||||
"alias": "",
|
||||
"colorMode": null,
|
||||
"colors": [
|
||||
"rgba(245, 54, 54, 0.9)",
|
||||
"rgba(237, 129, 40, 0.89)",
|
||||
"rgba(50, 172, 45, 0.97)"
|
||||
],
|
||||
"decimals": 2,
|
||||
"pattern": "/.*/",
|
||||
"thresholds": [],
|
||||
"type": "number",
|
||||
"unit": "short"
|
||||
}
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"alias": "",
|
||||
"format": "table",
|
||||
"rawSql": "SELECT createdAt as Time, source, datacenter, hostname, value FROM grafana_metric WHERE hostname in($host)",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Values",
|
||||
"transform": "table",
|
||||
"type": "table"
|
||||
}
|
||||
],
|
||||
"schemaVersion": 16,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"allValue": null,
|
||||
"current": {},
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"label": "Datacenter",
|
||||
"multi": false,
|
||||
"name": "datacenter",
|
||||
"options": [],
|
||||
"query": "SELECT DISTINCT datacenter FROM grafana_metric",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"sort": 1,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": null,
|
||||
"current": {},
|
||||
"datasource": "${DS_MSSQL}",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"label": "Hostname",
|
||||
"multi": true,
|
||||
"name": "host",
|
||||
"options": [],
|
||||
"query": "SELECT DISTINCT hostname FROM grafana_metric WHERE datacenter='$datacenter'",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"sort": 1,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"auto": false,
|
||||
"auto_count": 30,
|
||||
"auto_min": "10s",
|
||||
"current": {
|
||||
"text": "1m",
|
||||
"value": "1m"
|
||||
},
|
||||
"hide": 0,
|
||||
"label": "Summarize",
|
||||
"name": "summarize",
|
||||
"options": [
|
||||
{
|
||||
"selected": false,
|
||||
"text": "1s",
|
||||
"value": "1s"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "10s",
|
||||
"value": "10s"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "30s",
|
||||
"value": "30s"
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "1m",
|
||||
"value": "1m"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "5m",
|
||||
"value": "5m"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "10m",
|
||||
"value": "10m"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "30m",
|
||||
"value": "30m"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "1h",
|
||||
"value": "1h"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "6h",
|
||||
"value": "6h"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "12h",
|
||||
"value": "12h"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "1d",
|
||||
"value": "1d"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "7d",
|
||||
"value": "7d"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "14d",
|
||||
"value": "14d"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "30d",
|
||||
"value": "30d"
|
||||
}
|
||||
],
|
||||
"query": "1s,10s,30s,1m,5m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
|
||||
"refresh": 2,
|
||||
"type": "interval"
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
"30s",
|
||||
"1m",
|
||||
"5m",
|
||||
"15m",
|
||||
"30m",
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Grafana Fake Data Gen - MSSQL",
|
||||
"uid": "86Js1xRmk",
|
||||
"version": 11
|
||||
}
|
19
docker/blocks/mssql/docker-compose.yaml
Normal file
19
docker/blocks/mssql/docker-compose.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
mssql:
|
||||
build:
|
||||
context: blocks/mssql/build
|
||||
environment:
|
||||
ACCEPT_EULA: Y
|
||||
MSSQL_SA_PASSWORD: Password!
|
||||
MSSQL_PID: Express
|
||||
MSSQL_DATABASE: grafana
|
||||
MSSQL_USER: grafana
|
||||
MSSQL_PASSWORD: Password!
|
||||
ports:
|
||||
- "1433:1433"
|
||||
|
||||
fake-mssql-data:
|
||||
image: grafana/fake-data-gen
|
||||
network_mode: bridge
|
||||
environment:
|
||||
FD_DATASOURCE: mssql
|
||||
FD_PORT: 1433
|
2242
docker/blocks/mssql_tests/dashboard.json
Normal file
2242
docker/blocks/mssql_tests/dashboard.json
Normal file
File diff suppressed because it is too large
Load Diff
12
docker/blocks/mssql_tests/docker-compose.yaml
Normal file
12
docker/blocks/mssql_tests/docker-compose.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
mssqltests:
|
||||
build:
|
||||
context: blocks/mssql/build
|
||||
environment:
|
||||
ACCEPT_EULA: Y
|
||||
MSSQL_SA_PASSWORD: Password!
|
||||
MSSQL_PID: Express
|
||||
MSSQL_DATABASE: grafanatest
|
||||
MSSQL_USER: grafana
|
||||
MSSQL_PASSWORD: Password!
|
||||
ports:
|
||||
- "1433:1433"
|
@ -28,4 +28,4 @@
|
||||
build: blocks/prometheus_random_data
|
||||
network_mode: host
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8081:8080"
|
||||
|
@ -36,4 +36,4 @@ scrape_configs:
|
||||
|
||||
- job_name: 'prometheus-random-data'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:8080']
|
||||
- targets: ['127.0.0.1:8081']
|
||||
|
@ -28,4 +28,4 @@
|
||||
build: blocks/prometheus_random_data
|
||||
network_mode: host
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8081:8080"
|
||||
|
@ -36,4 +36,4 @@ scrape_configs:
|
||||
|
||||
- job_name: 'prometheus-random-data'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:8080']
|
||||
- targets: ['127.0.0.1:8081']
|
||||
|
@ -15,7 +15,7 @@ weight = 1
|
||||
|
||||
Description | Download
|
||||
------------ | -------------
|
||||
Stable for Debian-based Linux | [grafana_5.0.2_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.2_amd64.deb)
|
||||
Stable for Debian-based Linux | [grafana_5.0.3_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.3_amd64.deb)
|
||||
|
||||
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
|
||||
installation.
|
||||
@ -24,9 +24,9 @@ installation.
|
||||
|
||||
|
||||
```bash
|
||||
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.2_amd64.deb
|
||||
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.3_amd64.deb
|
||||
sudo apt-get install -y adduser libfontconfig
|
||||
sudo dpkg -i grafana_5.0.2_amd64.deb
|
||||
sudo dpkg -i grafana_5.0.3_amd64.deb
|
||||
```
|
||||
|
||||
## APT Repository
|
||||
|
@ -15,7 +15,7 @@ weight = 2
|
||||
|
||||
Description | Download
|
||||
------------ | -------------
|
||||
Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.2 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.2-1.x86_64.rpm)
|
||||
Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.3 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.3-1.x86_64.rpm)
|
||||
|
||||
|
||||
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
|
||||
@ -26,7 +26,7 @@ installation.
|
||||
You can install Grafana using Yum directly.
|
||||
|
||||
```bash
|
||||
$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.2-1.x86_64.rpm
|
||||
$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.3-1.x86_64.rpm
|
||||
```
|
||||
|
||||
Or install manually using `rpm`.
|
||||
@ -34,15 +34,15 @@ Or install manually using `rpm`.
|
||||
#### On CentOS / Fedora / Redhat:
|
||||
|
||||
```bash
|
||||
$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.2-1.x86_64.rpm
|
||||
$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.3-1.x86_64.rpm
|
||||
$ sudo yum install initscripts fontconfig
|
||||
$ sudo rpm -Uvh grafana-5.0.2-1.x86_64.rpm
|
||||
$ sudo rpm -Uvh grafana-5.0.3-1.x86_64.rpm
|
||||
```
|
||||
|
||||
#### On OpenSuse:
|
||||
|
||||
```bash
|
||||
$ sudo rpm -i --nodeps grafana-5.0.2-1.x86_64.rpm
|
||||
$ sudo rpm -i --nodeps grafana-5.0.3-1.x86_64.rpm
|
||||
```
|
||||
|
||||
## Install via YUM Repository
|
||||
|
@ -13,7 +13,7 @@ weight = 3
|
||||
|
||||
Description | Download
|
||||
------------ | -------------
|
||||
Latest stable package for Windows | [grafana-5.0.2.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.2.windows-x64.zip)
|
||||
Latest stable package for Windows | [grafana-5.0.3.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.3.windows-x64.zip)
|
||||
|
||||
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
|
||||
installation.
|
||||
|
@ -9,30 +9,38 @@ weight = 10
|
||||
|
||||
# How to setup Grafana for high availability
|
||||
|
||||
> Alerting does not support high availability yet.
|
||||
|
||||
Setting up Grafana for high availability is fairly simple. It comes down to two things:
|
||||
|
||||
* Use a shared database for multiple grafana instances.
|
||||
* Consider how user sessions are stored.
|
||||
1. Use a shared database for storing dashboard, users, and other persistent data
|
||||
2. Decide how to store session data.
|
||||
|
||||
<div class="text-center">
|
||||
<img src="/img/docs/tutorials/grafana-high-availability.png" max-width= "800px" class="center"></img>
|
||||
</div>
|
||||
|
||||
## Configure multiple servers to use the same database
|
||||
|
||||
First you need to do is to setup mysql or postgres on another server and configure Grafana to use that database.
|
||||
First, you need to do is to setup MySQL or Postgres on another server and configure Grafana to use that database.
|
||||
You can find the configuration for doing that in the [[database]]({{< relref "configuration.md" >}}#database) section in the grafana config.
|
||||
Grafana will now persist all long term data in the database.
|
||||
It also worth considering how to setup the database for high availability but thats outside the scope of this guide.
|
||||
Grafana will now persist all long term data in the database. How to configure the database for high availability is out of scope for this guide. We recommend finding an expert on for the database your using.
|
||||
|
||||
## User sessions
|
||||
|
||||
The second thing to consider is how to deal with user sessions and how to balance the load between servers.
|
||||
By default Grafana stores user sessions on disk which works fine if you use `sticky sessions` in your load balancer.
|
||||
Grafana also supports storing the session data in the database, redis or memcache which makes it possible to use round robin in your load balancer.
|
||||
If you use mysql/postgres for session storage you first need a table to store the session data in. More details about that in [[sessions]]({{< relref "configuration.md" >}}#session)
|
||||
The second thing to consider is how to deal with user sessions and how to configure your load balancer infront of Grafana.
|
||||
Grafana support two says of storing session data locally on disk or in a database/cache-server.
|
||||
If you want to store sessions on disk you can use `sticky sessions` in your load balanacer. If you prefer to store session data in a database/cache-server
|
||||
you can use any stateless routing strategy in your load balancer (ex round robin or least connections).
|
||||
|
||||
For Grafana itself it doesn't really matter if you store your sessions on disk or database/redis/memcache.
|
||||
But we suggest that you store the session in redis/memcache since it makes it easier to add/remote instances from the group.
|
||||
### Sticky sessions
|
||||
Using sticky sessions, all traffic for one user will always be sent to the same server. Which means that session related data can be
|
||||
stored on disk rather than on a shared database. This is the default behavior for Grafana and if only want multiple servers for fail over this is a good solution since it requires the least amount of work.
|
||||
|
||||
### Stateless sessions
|
||||
You can also choose to store session data in a Redis/Memcache/Postgres/MySQL which means that the load balancer can send a user to any Grafana server without having to log in on each server. This requires a little bit more work from the operator but enables you to remove/add grafana servers without impacting the user experience.
|
||||
If you use MySQL/Postgres for session storage, you first need a table to store the session data in. More details about that in [[sessions]]({{< relref "configuration.md" >}}#session)
|
||||
|
||||
For Grafana itself it doesn't really matter if you store the session data on disk or database/redis/memcache. But we recommend using a database/redis/memcache since it makes it easier manage the grafana servers.
|
||||
|
||||
## Alerting
|
||||
|
||||
Currently alerting supports a limited form of high availability. Since v4.2.0 of Grafana, alert notifications are deduped when running multiple servers. This means all alerts are executed on every server but no duplicate alert notifications are sent due to the deduping logic. Proper load balancing of alerts will be introduced in the future.
|
||||
Currently alerting supports a limited form of high availability. Since v4.2.0, alert notifications are deduped when running multiple servers. This means all alerts are executed on every server but alert notifications are only sent once per alert. Grafana does not support distributing the alert rule execution between servers. That might be added in the future but right now prefer to keep it simple.
|
||||
|
@ -118,7 +118,7 @@
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"*.go": [
|
||||
"*pkg/**/*.go": [
|
||||
"gofmt -w -s",
|
||||
"git add"
|
||||
]
|
||||
|
@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
@ -21,6 +22,14 @@ func AdminGetSettings(c *m.ReqContext) {
|
||||
if strings.Contains(keyName, "secret") || strings.Contains(keyName, "password") || (strings.Contains(keyName, "provider_config")) {
|
||||
value = "************"
|
||||
}
|
||||
if strings.Contains(keyName, "url") {
|
||||
var rgx = regexp.MustCompile(`.*:\/\/([^:]*):([^@]*)@.*?$`)
|
||||
var subs = rgx.FindAllSubmatch([]byte(value), -1)
|
||||
if subs != nil && len(subs[0]) == 3 {
|
||||
value = strings.Replace(value, string(subs[0][1]), "******", 1)
|
||||
value = strings.Replace(value, string(subs[0][2]), "******", 1)
|
||||
}
|
||||
}
|
||||
|
||||
jsonSec[keyName] = value
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ const (
|
||||
DS_PROMETHEUS = "prometheus"
|
||||
DS_POSTGRES = "postgres"
|
||||
DS_MYSQL = "mysql"
|
||||
DS_MSSQL = "mssql"
|
||||
DS_ACCESS_DIRECT = "direct"
|
||||
DS_ACCESS_PROXY = "proxy"
|
||||
)
|
||||
@ -68,6 +69,7 @@ var knownDatasourcePlugins map[string]bool = map[string]bool{
|
||||
DS_OPENTSDB: true,
|
||||
DS_POSTGRES: true,
|
||||
DS_MYSQL: true,
|
||||
DS_MSSQL: true,
|
||||
"opennms": true,
|
||||
"abhisant-druid-datasource": true,
|
||||
"dalmatinerdb-datasource": true,
|
||||
|
@ -46,25 +46,49 @@ type AlertmanagerNotifier struct {
|
||||
}
|
||||
|
||||
func (this *AlertmanagerNotifier) ShouldNotify(evalContext *alerting.EvalContext) bool {
|
||||
this.log.Debug("Should notify", "ruleId", evalContext.Rule.Id, "state", evalContext.Rule.State, "previousState", evalContext.PrevAlertState)
|
||||
|
||||
// Do not notify when we become OK for the first time.
|
||||
if (evalContext.PrevAlertState == m.AlertStatePending) && (evalContext.Rule.State == m.AlertStateOK) {
|
||||
return false
|
||||
}
|
||||
// Notify on Alerting -> OK to resolve before alertmanager timeout.
|
||||
if (evalContext.PrevAlertState == m.AlertStateAlerting) && (evalContext.Rule.State == m.AlertStateOK) {
|
||||
return true
|
||||
}
|
||||
return evalContext.Rule.State == m.AlertStateAlerting
|
||||
}
|
||||
|
||||
func (this *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
func (this *AlertmanagerNotifier) createAlert(evalContext *alerting.EvalContext, match *alerting.EvalMatch, ruleUrl string) *simplejson.Json {
|
||||
alertJSON := simplejson.New()
|
||||
alertJSON.Set("startsAt", evalContext.StartTime.UTC().Format(time.RFC3339))
|
||||
if evalContext.Rule.State == m.AlertStateOK {
|
||||
alertJSON.Set("endsAt", time.Now().UTC().Format(time.RFC3339))
|
||||
}
|
||||
alertJSON.Set("generatorURL", ruleUrl)
|
||||
|
||||
alerts := make([]interface{}, 0)
|
||||
for _, match := range evalContext.EvalMatches {
|
||||
alertJSON := simplejson.New()
|
||||
alertJSON.Set("startsAt", evalContext.StartTime.UTC().Format(time.RFC3339))
|
||||
|
||||
if ruleUrl, err := evalContext.GetRuleUrl(); err == nil {
|
||||
alertJSON.Set("generatorURL", ruleUrl)
|
||||
// Annotations (summary and description are very commonly used).
|
||||
alertJSON.SetPath([]string{"annotations", "summary"}, evalContext.Rule.Name)
|
||||
description := ""
|
||||
if evalContext.Rule.Message != "" {
|
||||
description += evalContext.Rule.Message
|
||||
}
|
||||
if evalContext.Error != nil {
|
||||
if description != "" {
|
||||
description += "\n"
|
||||
}
|
||||
description += "Error: " + evalContext.Error.Error()
|
||||
}
|
||||
if description != "" {
|
||||
alertJSON.SetPath([]string{"annotations", "description"}, description)
|
||||
}
|
||||
if evalContext.ImagePublicUrl != "" {
|
||||
alertJSON.SetPath([]string{"annotations", "image"}, evalContext.ImagePublicUrl)
|
||||
}
|
||||
|
||||
if evalContext.Rule.Message != "" {
|
||||
alertJSON.SetPath([]string{"annotations", "description"}, evalContext.Rule.Message)
|
||||
}
|
||||
|
||||
tags := make(map[string]string)
|
||||
// Labels (from metrics tags + mandatory alertname).
|
||||
tags := make(map[string]string)
|
||||
if match != nil {
|
||||
if len(match.Tags) == 0 {
|
||||
tags["metric"] = match.Metric
|
||||
} else {
|
||||
@ -72,10 +96,32 @@ func (this *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) erro
|
||||
tags[k] = v
|
||||
}
|
||||
}
|
||||
tags["alertname"] = evalContext.Rule.Name
|
||||
alertJSON.Set("labels", tags)
|
||||
}
|
||||
tags["alertname"] = evalContext.Rule.Name
|
||||
alertJSON.Set("labels", tags)
|
||||
return alertJSON
|
||||
}
|
||||
|
||||
alerts = append(alerts, alertJSON)
|
||||
func (this *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Sending Alertmanager alert", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
||||
ruleUrl, err := evalContext.GetRuleUrl()
|
||||
if err != nil {
|
||||
this.log.Error("Failed get rule link", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Send one alert per matching series.
|
||||
alerts := make([]interface{}, 0)
|
||||
for _, match := range evalContext.EvalMatches {
|
||||
alert := this.createAlert(evalContext, match, ruleUrl)
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
|
||||
// This happens on ExecutionError or NoData
|
||||
if len(alerts) == 0 {
|
||||
alert := this.createAlert(evalContext, nil, ruleUrl)
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
|
||||
bodyJSON := simplejson.NewFromAny(alerts)
|
||||
|
@ -27,15 +27,21 @@ func NewNotifierBase(id int64, isDefault bool, name, notifierType string, model
|
||||
}
|
||||
|
||||
func defaultShouldNotify(context *alerting.EvalContext) bool {
|
||||
// Only notify on state change.
|
||||
if context.PrevAlertState == context.Rule.State {
|
||||
return false
|
||||
}
|
||||
// Do not notify when we become OK for the first time.
|
||||
if (context.PrevAlertState == m.AlertStatePending) && (context.Rule.State == m.AlertStateOK) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (n *NotifierBase) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (n *NotifierBase) GetType() string {
|
||||
return n.Type
|
||||
}
|
||||
|
@ -38,10 +38,6 @@ func NewDingDingNotifier(model *m.AlertNotification) (alerting.Notifier, error)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (this *DingDingNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
type DingDingNotifier struct {
|
||||
NotifierBase
|
||||
Url string
|
||||
|
@ -58,10 +58,6 @@ func NewEmailNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (this *EmailNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *EmailNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Sending alert notification to", "addresses", this.Addresses)
|
||||
|
||||
|
@ -75,10 +75,6 @@ type HipChatNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *HipChatNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *HipChatNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Executing hipchat notification", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
||||
|
@ -57,10 +57,6 @@ type KafkaNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *KafkaNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *KafkaNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
state := evalContext.Rule.State
|
||||
|
@ -51,10 +51,6 @@ type LineNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *LineNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *LineNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Executing line notification", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
||||
|
@ -72,10 +72,6 @@ type OpsGenieNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *OpsGenieNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *OpsGenieNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
var err error
|
||||
|
@ -65,10 +65,6 @@ type PagerdutyNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *PagerdutyNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
if evalContext.Rule.State == m.AlertStateOK && !this.AutoResolve {
|
||||
|
@ -123,10 +123,6 @@ type PushoverNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *PushoverNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *PushoverNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
ruleUrl, err := evalContext.GetRuleUrl()
|
||||
if err != nil {
|
||||
|
@ -71,10 +71,6 @@ type SensuNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *SensuNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *SensuNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Sending sensu result")
|
||||
|
||||
|
@ -98,10 +98,6 @@ type SlackNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *SlackNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Executing slack notification", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
||||
|
@ -47,10 +47,6 @@ type TeamsNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *TeamsNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Executing teams notification", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
||||
|
@ -208,6 +208,7 @@ func generateImageCaption(evalContext *alerting.EvalContext, ruleUrl string, met
|
||||
|
||||
return message
|
||||
}
|
||||
|
||||
func appendIfPossible(message string, extra string, sizeLimit int) string {
|
||||
if len(extra)+len(message) <= sizeLimit {
|
||||
return message + extra
|
||||
@ -216,10 +217,6 @@ func appendIfPossible(message string, extra string, sizeLimit int) string {
|
||||
return message
|
||||
}
|
||||
|
||||
func (this *TelegramNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *TelegramNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
var cmd *m.SendWebhookSync
|
||||
if evalContext.ImagePublicUrl == "" && this.UploadImage == true {
|
||||
|
@ -114,10 +114,6 @@ func NewThreemaNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (this *ThreemaNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (notifier *ThreemaNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
notifier.log.Info("Sending alert notification from", "threema_id", notifier.GatewayID)
|
||||
notifier.log.Info("Sending alert notification to", "threema_id", notifier.RecipientID)
|
||||
|
@ -68,10 +68,6 @@ type VictoropsNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *VictoropsNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
// Notify sends notification to Victorops via POST to URL endpoint
|
||||
func (this *VictoropsNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Executing victorops notification", "ruleId", evalContext.Rule.Id, "notification", this.Name)
|
||||
|
@ -65,10 +65,6 @@ type WebhookNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (this *WebhookNotifier) ShouldNotify(context *alerting.EvalContext) bool {
|
||||
return defaultShouldNotify(context)
|
||||
}
|
||||
|
||||
func (this *WebhookNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Info("Sending webhook")
|
||||
|
||||
|
@ -23,6 +23,8 @@ import (
|
||||
"github.com/go-xorm/xorm"
|
||||
_ "github.com/lib/pq"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
_ "github.com/grafana/grafana/pkg/tsdb/mssql"
|
||||
)
|
||||
|
||||
type DatabaseConfig struct {
|
||||
|
@ -14,6 +14,7 @@ type TestDB struct {
|
||||
var TestDB_Sqlite3 = TestDB{DriverName: "sqlite3", ConnStr: ":memory:"}
|
||||
var TestDB_Mysql = TestDB{DriverName: "mysql", ConnStr: "grafana:password@tcp(localhost:3306)/grafana_tests?collation=utf8mb4_unicode_ci"}
|
||||
var TestDB_Postgres = TestDB{DriverName: "postgres", ConnStr: "user=grafanatest password=grafanatest host=localhost port=5432 dbname=grafanatest sslmode=disable"}
|
||||
var TestDB_Mssql = TestDB{DriverName: "mssql", ConnStr: "server=localhost;port=1433;database=grafanatest;user id=grafana;password=Password!"}
|
||||
|
||||
func CleanDB(x *xorm.Engine) {
|
||||
if x.DriverName() == "postgres" {
|
||||
|
129
pkg/tsdb/mssql/macros.go
Normal file
129
pkg/tsdb/mssql/macros.go
Normal file
@ -0,0 +1,129 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb"
|
||||
)
|
||||
|
||||
const rsIdentifier = `([_a-zA-Z0-9]+)`
|
||||
const sExpr = `\$` + rsIdentifier + `\(([^\)]*)\)`
|
||||
|
||||
type MsSqlMacroEngine struct {
|
||||
TimeRange *tsdb.TimeRange
|
||||
Query *tsdb.Query
|
||||
}
|
||||
|
||||
func NewMssqlMacroEngine() tsdb.SqlMacroEngine {
|
||||
return &MsSqlMacroEngine{}
|
||||
}
|
||||
|
||||
func (m *MsSqlMacroEngine) Interpolate(query *tsdb.Query, timeRange *tsdb.TimeRange, sql string) (string, error) {
|
||||
m.TimeRange = timeRange
|
||||
m.Query = query
|
||||
rExp, _ := regexp.Compile(sExpr)
|
||||
var macroError error
|
||||
|
||||
sql = replaceAllStringSubmatchFunc(rExp, sql, func(groups []string) string {
|
||||
args := strings.Split(groups[2], ",")
|
||||
for i, arg := range args {
|
||||
args[i] = strings.Trim(arg, " ")
|
||||
}
|
||||
res, err := m.evaluateMacro(groups[1], args)
|
||||
if err != nil && macroError == nil {
|
||||
macroError = err
|
||||
return "macro_error()"
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
||||
if macroError != nil {
|
||||
return "", macroError
|
||||
}
|
||||
|
||||
return sql, nil
|
||||
}
|
||||
|
||||
func replaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string {
|
||||
result := ""
|
||||
lastIndex := 0
|
||||
|
||||
for _, v := range re.FindAllSubmatchIndex([]byte(str), -1) {
|
||||
groups := []string{}
|
||||
for i := 0; i < len(v); i += 2 {
|
||||
groups = append(groups, str[v[i]:v[i+1]])
|
||||
}
|
||||
|
||||
result += str[lastIndex:v[0]] + repl(groups)
|
||||
lastIndex = v[1]
|
||||
}
|
||||
|
||||
return result + str[lastIndex:]
|
||||
}
|
||||
|
||||
func (m *MsSqlMacroEngine) evaluateMacro(name string, args []string) (string, error) {
|
||||
switch name {
|
||||
case "__time":
|
||||
if len(args) == 0 {
|
||||
return "", fmt.Errorf("missing time column argument for macro %v", name)
|
||||
}
|
||||
return fmt.Sprintf("%s AS time", args[0]), nil
|
||||
case "__utcTime":
|
||||
if len(args) == 0 {
|
||||
return "", fmt.Errorf("missing time column argument for macro %v", name)
|
||||
}
|
||||
return fmt.Sprintf("DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), %s) AS time", args[0]), nil
|
||||
case "__timeEpoch":
|
||||
if len(args) == 0 {
|
||||
return "", fmt.Errorf("missing time column argument for macro %v", name)
|
||||
}
|
||||
return fmt.Sprintf("DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), %s) ) AS time", args[0]), nil
|
||||
case "__timeFilter":
|
||||
if len(args) == 0 {
|
||||
return "", fmt.Errorf("missing time column argument for macro %v", name)
|
||||
}
|
||||
return fmt.Sprintf("%s >= DATEADD(s, %d+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01') AND %s <= DATEADD(s, %d+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')", args[0], uint64(m.TimeRange.GetFromAsMsEpoch()/1000), args[0], uint64(m.TimeRange.GetToAsMsEpoch()/1000)), nil
|
||||
case "__timeFrom":
|
||||
return fmt.Sprintf("DATEADD(second, %d+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')", uint64(m.TimeRange.GetFromAsMsEpoch()/1000)), nil
|
||||
case "__timeTo":
|
||||
return fmt.Sprintf("DATEADD(second, %d+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')", uint64(m.TimeRange.GetToAsMsEpoch()/1000)), nil
|
||||
case "__timeGroup":
|
||||
if len(args) < 2 {
|
||||
return "", fmt.Errorf("macro %v needs time column and interval", name)
|
||||
}
|
||||
interval, err := time.ParseDuration(strings.Trim(args[1], `'"`))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error parsing interval %v", args[1])
|
||||
}
|
||||
if len(args) == 3 {
|
||||
m.Query.Model.Set("fill", true)
|
||||
m.Query.Model.Set("fillInterval", interval.Seconds())
|
||||
if args[2] == "NULL" {
|
||||
m.Query.Model.Set("fillNull", true)
|
||||
} else {
|
||||
floatVal, err := strconv.ParseFloat(args[2], 64)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error parsing fill value %v", args[2])
|
||||
}
|
||||
m.Query.Model.Set("fillValue", floatVal)
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), %s))/%.0f as int)*%.0f as int)", args[0], interval.Seconds(), interval.Seconds()), nil
|
||||
case "__unixEpochFilter":
|
||||
if len(args) == 0 {
|
||||
return "", fmt.Errorf("missing time column argument for macro %v", name)
|
||||
}
|
||||
return fmt.Sprintf("%s >= %d AND %s <= %d", args[0], uint64(m.TimeRange.GetFromAsMsEpoch()/1000), args[0], uint64(m.TimeRange.GetToAsMsEpoch()/1000)), nil
|
||||
case "__unixEpochFrom":
|
||||
return fmt.Sprintf("%d", uint64(m.TimeRange.GetFromAsMsEpoch()/1000)), nil
|
||||
case "__unixEpochTo":
|
||||
return fmt.Sprintf("%d", uint64(m.TimeRange.GetToAsMsEpoch()/1000)), nil
|
||||
default:
|
||||
return "", fmt.Errorf("Unknown macro %v", name)
|
||||
}
|
||||
}
|
131
pkg/tsdb/mssql/macros_test.go
Normal file
131
pkg/tsdb/mssql/macros_test.go
Normal file
@ -0,0 +1,131 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/tsdb"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func TestMacroEngine(t *testing.T) {
|
||||
Convey("MacroEngine", t, func() {
|
||||
engine := &MsSqlMacroEngine{}
|
||||
timeRange := &tsdb.TimeRange{From: "5m", To: "now"}
|
||||
query := &tsdb.Query{
|
||||
Model: simplejson.New(),
|
||||
}
|
||||
|
||||
Convey("interpolate __time function", func() {
|
||||
sql, err := engine.Interpolate(query, nil, "select $__time(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select time_column AS time")
|
||||
})
|
||||
|
||||
Convey("interpolate __utcTime function", func() {
|
||||
sql, err := engine.Interpolate(query, nil, "select $__utcTime(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time_column) AS time")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeEpoch function", func() {
|
||||
sql, err := engine.Interpolate(query, nil, "select $__timeEpoch(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time_column) ) AS time")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeEpoch function wrapped in aggregation", func() {
|
||||
sql, err := engine.Interpolate(query, nil, "select min($__timeEpoch(time_column))")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select min(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time_column) ) AS time)")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeFilter function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "WHERE $__timeFilter(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "WHERE time_column >= DATEADD(s, 18446744066914186738+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01') AND time_column <= DATEADD(s, 18446744066914187038+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeGroup function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column,'5m')")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "GROUP BY cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time_column))/300 as int)*300 as int)")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeGroup function with spaces around arguments", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column , '5m')")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "GROUP BY cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time_column))/300 as int)*300 as int)")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeGroup function with fill (value = NULL)", func() {
|
||||
_, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column,'5m', NULL)")
|
||||
|
||||
fill := query.Model.Get("fill").MustBool()
|
||||
fillNull := query.Model.Get("fillNull").MustBool()
|
||||
fillInterval := query.Model.Get("fillInterval").MustInt()
|
||||
|
||||
So(err, ShouldBeNil)
|
||||
So(fill, ShouldBeTrue)
|
||||
So(fillNull, ShouldBeTrue)
|
||||
So(fillInterval, ShouldEqual, 5*time.Minute.Seconds())
|
||||
})
|
||||
|
||||
Convey("interpolate __timeGroup function with fill (value = float)", func() {
|
||||
_, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column,'5m', 1.5)")
|
||||
|
||||
fill := query.Model.Get("fill").MustBool()
|
||||
fillValue := query.Model.Get("fillValue").MustFloat64()
|
||||
fillInterval := query.Model.Get("fillInterval").MustInt()
|
||||
|
||||
So(err, ShouldBeNil)
|
||||
So(fill, ShouldBeTrue)
|
||||
So(fillValue, ShouldEqual, 1.5)
|
||||
So(fillInterval, ShouldEqual, 5*time.Minute.Seconds())
|
||||
})
|
||||
|
||||
Convey("interpolate __timeFrom function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "select $__timeFrom(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select DATEADD(second, 18446744066914186738+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')")
|
||||
})
|
||||
|
||||
Convey("interpolate __timeTo function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "select $__timeTo(time_column)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select DATEADD(second, 18446744066914187038+DATEDIFF(second,GETUTCDATE(),GETDATE()), '1970-01-01')")
|
||||
})
|
||||
|
||||
Convey("interpolate __unixEpochFilter function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochFilter(18446744066914186738)")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select 18446744066914186738 >= 18446744066914186738 AND 18446744066914186738 <= 18446744066914187038")
|
||||
})
|
||||
|
||||
Convey("interpolate __unixEpochFrom function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochFrom()")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select 18446744066914186738")
|
||||
})
|
||||
|
||||
Convey("interpolate __unixEpochTo function", func() {
|
||||
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochTo()")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(sql, ShouldEqual, "select 18446744066914187038")
|
||||
})
|
||||
})
|
||||
}
|
328
pkg/tsdb/mssql/mssql.go
Normal file
328
pkg/tsdb/mssql/mssql.go
Normal file
@ -0,0 +1,328 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"time"
|
||||
|
||||
"math"
|
||||
|
||||
_ "github.com/denisenkom/go-mssqldb"
|
||||
"github.com/go-xorm/core"
|
||||
"github.com/grafana/grafana/pkg/components/null"
|
||||
"github.com/grafana/grafana/pkg/log"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/tsdb"
|
||||
)
|
||||
|
||||
type MssqlQueryEndpoint struct {
|
||||
sqlEngine tsdb.SqlEngine
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func init() {
|
||||
tsdb.RegisterTsdbQueryEndpoint("mssql", NewMssqlQueryEndpoint)
|
||||
}
|
||||
|
||||
func NewMssqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoint, error) {
|
||||
endpoint := &MssqlQueryEndpoint{
|
||||
log: log.New("tsdb.mssql"),
|
||||
}
|
||||
|
||||
endpoint.sqlEngine = &tsdb.DefaultSqlEngine{
|
||||
MacroEngine: NewMssqlMacroEngine(),
|
||||
}
|
||||
|
||||
cnnstr := generateConnectionString(datasource)
|
||||
endpoint.log.Debug("getEngine", "connection", cnnstr)
|
||||
|
||||
if err := endpoint.sqlEngine.InitEngine("mssql", datasource, cnnstr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return endpoint, nil
|
||||
}
|
||||
|
||||
func generateConnectionString(datasource *models.DataSource) string {
|
||||
password := ""
|
||||
for key, value := range datasource.SecureJsonData.Decrypt() {
|
||||
if key == "password" {
|
||||
password = value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
hostParts := strings.Split(datasource.Url, ":")
|
||||
if len(hostParts) < 2 {
|
||||
hostParts = append(hostParts, "1433")
|
||||
}
|
||||
|
||||
server, port := hostParts[0], hostParts[1]
|
||||
return fmt.Sprintf("server=%s;port=%s;database=%s;user id=%s;password=%s;",
|
||||
server,
|
||||
port,
|
||||
datasource.Database,
|
||||
datasource.User,
|
||||
password,
|
||||
)
|
||||
}
|
||||
|
||||
// Query is the main function for the MssqlQueryEndpoint
|
||||
func (e *MssqlQueryEndpoint) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {
|
||||
return e.sqlEngine.Query(ctx, dsInfo, tsdbQuery, e.transformToTimeSeries, e.transformToTable)
|
||||
}
|
||||
|
||||
func (e MssqlQueryEndpoint) transformToTable(query *tsdb.Query, rows *core.Rows, result *tsdb.QueryResult, tsdbQuery *tsdb.TsdbQuery) error {
|
||||
columnNames, err := rows.Columns()
|
||||
columnCount := len(columnNames)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rowLimit := 1000000
|
||||
rowCount := 0
|
||||
timeIndex := -1
|
||||
|
||||
table := &tsdb.Table{
|
||||
Columns: make([]tsdb.TableColumn, columnCount),
|
||||
Rows: make([]tsdb.RowValues, 0),
|
||||
}
|
||||
|
||||
for i, name := range columnNames {
|
||||
table.Columns[i].Text = name
|
||||
|
||||
// check if there is a column named time
|
||||
switch name {
|
||||
case "time":
|
||||
timeIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
columnTypes, err := rows.ColumnTypes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for ; rows.Next(); rowCount++ {
|
||||
if rowCount > rowLimit {
|
||||
return fmt.Errorf("MsSQL query row limit exceeded, limit %d", rowLimit)
|
||||
}
|
||||
|
||||
values, err := e.getTypedRowData(columnTypes, rows)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// convert column named time to unix timestamp to make
|
||||
// native datetime mssql types work in annotation queries
|
||||
if timeIndex != -1 {
|
||||
switch value := values[timeIndex].(type) {
|
||||
case time.Time:
|
||||
values[timeIndex] = float64(value.Unix())
|
||||
}
|
||||
}
|
||||
|
||||
table.Rows = append(table.Rows, values)
|
||||
}
|
||||
|
||||
result.Tables = append(result.Tables, table)
|
||||
result.Meta.Set("rowCount", rowCount)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e MssqlQueryEndpoint) getTypedRowData(types []*sql.ColumnType, rows *core.Rows) (tsdb.RowValues, error) {
|
||||
values := make([]interface{}, len(types))
|
||||
valuePtrs := make([]interface{}, len(types))
|
||||
|
||||
for i, stype := range types {
|
||||
e.log.Debug("type", "type", stype)
|
||||
valuePtrs[i] = &values[i]
|
||||
}
|
||||
|
||||
if err := rows.Scan(valuePtrs...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// convert types not handled by denisenkom/go-mssqldb
|
||||
// unhandled types are returned as []byte
|
||||
for i := 0; i < len(types); i++ {
|
||||
if value, ok := values[i].([]byte); ok == true {
|
||||
switch types[i].DatabaseTypeName() {
|
||||
case "MONEY", "SMALLMONEY", "DECIMAL":
|
||||
if v, err := strconv.ParseFloat(string(value), 64); err == nil {
|
||||
values[i] = v
|
||||
} else {
|
||||
e.log.Debug("Rows", "Error converting numeric to float", value)
|
||||
}
|
||||
default:
|
||||
e.log.Debug("Rows", "Unknown database type", types[i].DatabaseTypeName(), "value", value)
|
||||
values[i] = string(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return values, nil
|
||||
}
|
||||
|
||||
func (e MssqlQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *core.Rows, result *tsdb.QueryResult, tsdbQuery *tsdb.TsdbQuery) error {
|
||||
pointsBySeries := make(map[string]*tsdb.TimeSeries)
|
||||
seriesByQueryOrder := list.New()
|
||||
|
||||
columnNames, err := rows.Columns()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
columnTypes, err := rows.ColumnTypes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rowLimit := 1000000
|
||||
rowCount := 0
|
||||
timeIndex := -1
|
||||
metricIndex := -1
|
||||
|
||||
// check columns of resultset: a column named time is mandatory
|
||||
// the first text column is treated as metric name unless a column named metric is present
|
||||
for i, col := range columnNames {
|
||||
switch col {
|
||||
case "time":
|
||||
timeIndex = i
|
||||
case "metric":
|
||||
metricIndex = i
|
||||
default:
|
||||
if metricIndex == -1 {
|
||||
switch columnTypes[i].DatabaseTypeName() {
|
||||
case "VARCHAR", "CHAR", "NVARCHAR", "NCHAR":
|
||||
metricIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if timeIndex == -1 {
|
||||
return fmt.Errorf("Found no column named time")
|
||||
}
|
||||
|
||||
fillMissing := query.Model.Get("fill").MustBool(false)
|
||||
var fillInterval float64
|
||||
fillValue := null.Float{}
|
||||
if fillMissing {
|
||||
fillInterval = query.Model.Get("fillInterval").MustFloat64() * 1000
|
||||
if query.Model.Get("fillNull").MustBool(false) == false {
|
||||
fillValue.Float64 = query.Model.Get("fillValue").MustFloat64()
|
||||
fillValue.Valid = true
|
||||
}
|
||||
}
|
||||
|
||||
for rows.Next() {
|
||||
var timestamp float64
|
||||
var value null.Float
|
||||
var metric string
|
||||
|
||||
if rowCount > rowLimit {
|
||||
return fmt.Errorf("MSSQL query row limit exceeded, limit %d", rowLimit)
|
||||
}
|
||||
|
||||
values, err := e.getTypedRowData(columnTypes, rows)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch columnValue := values[timeIndex].(type) {
|
||||
case int64:
|
||||
timestamp = float64(columnValue * 1000)
|
||||
case float64:
|
||||
timestamp = columnValue * 1000
|
||||
case time.Time:
|
||||
timestamp = (float64(columnValue.Unix()) * 1000) + float64(columnValue.Nanosecond()/1e6) // in case someone is trying to map times beyond 2262 :D
|
||||
default:
|
||||
return fmt.Errorf("Invalid type for column time, must be of type timestamp or unix timestamp")
|
||||
}
|
||||
|
||||
if metricIndex >= 0 {
|
||||
if columnValue, ok := values[metricIndex].(string); ok == true {
|
||||
metric = columnValue
|
||||
} else {
|
||||
return fmt.Errorf("Column metric must be of type CHAR, VARCHAR, NCHAR or NVARCHAR. metric column name: %s type: %s but datatype is %T", columnNames[metricIndex], columnTypes[metricIndex].DatabaseTypeName(), values[metricIndex])
|
||||
}
|
||||
}
|
||||
|
||||
for i, col := range columnNames {
|
||||
if i == timeIndex || i == metricIndex {
|
||||
continue
|
||||
}
|
||||
|
||||
switch columnValue := values[i].(type) {
|
||||
case int64:
|
||||
value = null.FloatFrom(float64(columnValue))
|
||||
case float64:
|
||||
value = null.FloatFrom(columnValue)
|
||||
case nil:
|
||||
value.Valid = false
|
||||
default:
|
||||
return fmt.Errorf("Value column must have numeric datatype, column: %s type: %T value: %v", col, columnValue, columnValue)
|
||||
}
|
||||
if metricIndex == -1 {
|
||||
metric = col
|
||||
}
|
||||
|
||||
series, exist := pointsBySeries[metric]
|
||||
if exist == false {
|
||||
series = &tsdb.TimeSeries{Name: metric}
|
||||
pointsBySeries[metric] = series
|
||||
seriesByQueryOrder.PushBack(metric)
|
||||
}
|
||||
|
||||
if fillMissing {
|
||||
var intervalStart float64
|
||||
if exist == false {
|
||||
intervalStart = float64(tsdbQuery.TimeRange.MustGetFrom().UnixNano() / 1e6)
|
||||
} else {
|
||||
intervalStart = series.Points[len(series.Points)-1][1].Float64 + fillInterval
|
||||
}
|
||||
|
||||
// align interval start
|
||||
intervalStart = math.Floor(intervalStart/fillInterval) * fillInterval
|
||||
|
||||
for i := intervalStart; i < timestamp; i += fillInterval {
|
||||
series.Points = append(series.Points, tsdb.TimePoint{fillValue, null.FloatFrom(i)})
|
||||
rowCount++
|
||||
}
|
||||
}
|
||||
|
||||
series.Points = append(series.Points, tsdb.TimePoint{value, null.FloatFrom(timestamp)})
|
||||
|
||||
e.log.Debug("Rows", "metric", metric, "time", timestamp, "value", value)
|
||||
}
|
||||
}
|
||||
|
||||
for elem := seriesByQueryOrder.Front(); elem != nil; elem = elem.Next() {
|
||||
key := elem.Value.(string)
|
||||
result.Series = append(result.Series, pointsBySeries[key])
|
||||
|
||||
if fillMissing {
|
||||
series := pointsBySeries[key]
|
||||
// fill in values from last fetched value till interval end
|
||||
intervalStart := series.Points[len(series.Points)-1][1].Float64
|
||||
intervalEnd := float64(tsdbQuery.TimeRange.MustGetTo().UnixNano() / 1e6)
|
||||
|
||||
// align interval start
|
||||
intervalStart = math.Floor(intervalStart/fillInterval) * fillInterval
|
||||
for i := intervalStart + fillInterval; i < intervalEnd; i += fillInterval {
|
||||
series.Points = append(series.Points, tsdb.TimePoint{fillValue, null.FloatFrom(i)})
|
||||
rowCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.Meta.Set("rowCount", rowCount)
|
||||
return nil
|
||||
}
|
686
pkg/tsdb/mssql/mssql_test.go
Normal file
686
pkg/tsdb/mssql/mssql_test.go
Normal file
@ -0,0 +1,686 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/log"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
||||
"github.com/grafana/grafana/pkg/tsdb"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
// To run this test, remove the Skip from SkipConvey
|
||||
// and set up a MSSQL db named grafanatest and a user/password grafana/Password!
|
||||
// Use the docker/blocks/mssql_tests/docker-compose.yaml to spin up a
|
||||
// preconfigured MSSQL server suitable for running these tests.
|
||||
// If needed, change the variable below to the IP address of the database.
|
||||
var serverIP string = "localhost"
|
||||
|
||||
func TestMSSQL(t *testing.T) {
|
||||
SkipConvey("MSSQL", t, func() {
|
||||
x := InitMSSQLTestDB(t)
|
||||
|
||||
endpoint := &MssqlQueryEndpoint{
|
||||
sqlEngine: &tsdb.DefaultSqlEngine{
|
||||
MacroEngine: NewMssqlMacroEngine(),
|
||||
XormEngine: x,
|
||||
},
|
||||
log: log.New("tsdb.mssql"),
|
||||
}
|
||||
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
|
||||
fromStart := time.Date(2018, 3, 15, 13, 0, 0, 0, time.UTC)
|
||||
|
||||
Convey("Given a table with different native data types", func() {
|
||||
sql := `
|
||||
IF OBJECT_ID('dbo.[mssql_types]', 'U') IS NOT NULL
|
||||
DROP TABLE dbo.[mssql_types]
|
||||
|
||||
CREATE TABLE [mssql_types] (
|
||||
c_bit bit,
|
||||
|
||||
c_tinyint tinyint,
|
||||
c_smallint smallint,
|
||||
c_int int,
|
||||
c_bigint bigint,
|
||||
|
||||
c_money money,
|
||||
c_smallmoney smallmoney,
|
||||
c_numeric numeric(10,5),
|
||||
c_real real,
|
||||
c_decimal decimal(10,2),
|
||||
c_float float,
|
||||
|
||||
c_char char(10),
|
||||
c_varchar varchar(10),
|
||||
c_text text,
|
||||
|
||||
c_nchar nchar(12),
|
||||
c_nvarchar nvarchar(12),
|
||||
c_ntext ntext,
|
||||
|
||||
c_datetime datetime,
|
||||
c_datetime2 datetime2,
|
||||
c_smalldatetime smalldatetime,
|
||||
c_date date,
|
||||
c_time time,
|
||||
c_datetimeoffset datetimeoffset
|
||||
)
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
dt := time.Date(2018, 3, 14, 21, 20, 6, 527e6, time.UTC)
|
||||
dtFormat := "2006-01-02 15:04:05.999999999"
|
||||
d := dt.Format(dtFormat)
|
||||
dt2 := time.Date(2018, 3, 14, 21, 20, 6, 8896406e2, time.UTC)
|
||||
dt2Format := "2006-01-02 15:04:05.999999999 -07:00"
|
||||
d2 := dt2.Format(dt2Format)
|
||||
|
||||
sql = fmt.Sprintf(`
|
||||
INSERT INTO [mssql_types]
|
||||
SELECT
|
||||
1, 5, 20020, 980300, 1420070400, '$20000.15', '£2.15', 12345.12,
|
||||
1.11, 2.22, 3.33,
|
||||
'char10', 'varchar10', 'text',
|
||||
N'☺nchar12☺', N'☺nvarchar12☺', N'☺text☺',
|
||||
CAST('%s' AS DATETIME), CAST('%s' AS DATETIME2), CAST('%s' AS SMALLDATETIME), CAST('%s' AS DATE), CAST('%s' AS TIME), SWITCHOFFSET(CAST('%s' AS DATETIMEOFFSET), '-07:00')
|
||||
`, d, d2, d, d, d, d2)
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
Convey("When doing a table query should map MSSQL column types to Go types", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT * FROM mssql_types",
|
||||
"format": "table",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
column := queryResult.Tables[0].Rows[0]
|
||||
|
||||
So(column[0].(bool), ShouldEqual, true)
|
||||
|
||||
So(column[1].(int64), ShouldEqual, 5)
|
||||
So(column[2].(int64), ShouldEqual, 20020)
|
||||
So(column[3].(int64), ShouldEqual, 980300)
|
||||
So(column[4].(int64), ShouldEqual, 1420070400)
|
||||
|
||||
So(column[5].(float64), ShouldEqual, 20000.15)
|
||||
So(column[6].(float64), ShouldEqual, 2.15)
|
||||
So(column[7].(float64), ShouldEqual, 12345.12)
|
||||
So(column[8].(float64), ShouldEqual, 1.1100000143051147)
|
||||
So(column[9].(float64), ShouldEqual, 2.22)
|
||||
So(column[10].(float64), ShouldEqual, 3.33)
|
||||
|
||||
So(column[11].(string), ShouldEqual, "char10 ")
|
||||
So(column[12].(string), ShouldEqual, "varchar10")
|
||||
So(column[13].(string), ShouldEqual, "text")
|
||||
|
||||
So(column[14].(string), ShouldEqual, "☺nchar12☺ ")
|
||||
So(column[15].(string), ShouldEqual, "☺nvarchar12☺")
|
||||
So(column[16].(string), ShouldEqual, "☺text☺")
|
||||
|
||||
So(column[17].(time.Time), ShouldEqual, dt)
|
||||
So(column[18].(time.Time), ShouldEqual, dt2)
|
||||
So(column[19].(time.Time), ShouldEqual, dt.Truncate(time.Minute))
|
||||
So(column[20].(time.Time), ShouldEqual, dt.Truncate(24*time.Hour))
|
||||
So(column[21].(time.Time), ShouldEqual, time.Date(1, 1, 1, dt.Hour(), dt.Minute(), dt.Second(), dt.Nanosecond(), time.UTC))
|
||||
So(column[22].(time.Time), ShouldEqual, dt2.In(time.FixedZone("UTC", int(-7*time.Hour))))
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Given a table with metrics that lacks data for some series ", func() {
|
||||
sql := `
|
||||
IF OBJECT_ID('dbo.[metric]', 'U') IS NOT NULL
|
||||
DROP TABLE dbo.[metric]
|
||||
|
||||
CREATE TABLE [metric] (
|
||||
time datetime,
|
||||
value int
|
||||
)
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
type metric struct {
|
||||
Time time.Time
|
||||
Value int64
|
||||
}
|
||||
|
||||
series := []*metric{}
|
||||
firstRange := genTimeRangeByInterval(fromStart, 10*time.Minute, 10*time.Second)
|
||||
secondRange := genTimeRangeByInterval(fromStart.Add(20*time.Minute), 10*time.Minute, 10*time.Second)
|
||||
|
||||
for _, t := range firstRange {
|
||||
series = append(series, &metric{
|
||||
Time: t,
|
||||
Value: 15,
|
||||
})
|
||||
}
|
||||
|
||||
for _, t := range secondRange {
|
||||
series = append(series, &metric{
|
||||
Time: t,
|
||||
Value: 20,
|
||||
})
|
||||
}
|
||||
|
||||
dtFormat := "2006-01-02 15:04:05.999999999"
|
||||
for _, s := range series {
|
||||
sql = fmt.Sprintf(`
|
||||
INSERT INTO metric (time, value)
|
||||
VALUES(CAST('%s' AS DATETIME), %d)
|
||||
`, s.Time.Format(dtFormat), s.Value)
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
}
|
||||
|
||||
Convey("When doing a metric query using timeGroup", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT $__timeGroup(time, '5m') AS time, avg(value) as value FROM metric GROUP BY $__timeGroup(time, '5m') ORDER BY 1",
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
points := queryResult.Series[0].Points
|
||||
|
||||
So(len(points), ShouldEqual, 4)
|
||||
actualValueFirst := points[0][0].Float64
|
||||
actualTimeFirst := time.Unix(int64(points[0][1].Float64)/1000, 0)
|
||||
So(actualValueFirst, ShouldEqual, 15)
|
||||
So(actualTimeFirst, ShouldEqual, fromStart)
|
||||
|
||||
actualValueLast := points[3][0].Float64
|
||||
actualTimeLast := time.Unix(int64(points[3][1].Float64)/1000, 0)
|
||||
So(actualValueLast, ShouldEqual, 20)
|
||||
So(actualTimeLast, ShouldEqual, fromStart.Add(25*time.Minute))
|
||||
})
|
||||
|
||||
Convey("When doing a metric query using timeGroup with NULL fill enabled", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT $__timeGroup(time, '5m', NULL) AS time, avg(value) as value FROM metric GROUP BY $__timeGroup(time, '5m') ORDER BY 1",
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: fmt.Sprintf("%v", fromStart.Unix()*1000),
|
||||
To: fmt.Sprintf("%v", fromStart.Add(34*time.Minute).Unix()*1000),
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
points := queryResult.Series[0].Points
|
||||
|
||||
So(len(points), ShouldEqual, 7)
|
||||
actualValueFirst := points[0][0].Float64
|
||||
actualTimeFirst := time.Unix(int64(points[0][1].Float64)/1000, 0)
|
||||
So(actualValueFirst, ShouldEqual, 15)
|
||||
So(actualTimeFirst, ShouldEqual, fromStart)
|
||||
|
||||
actualNullPoint := points[3][0]
|
||||
actualNullTime := time.Unix(int64(points[3][1].Float64)/1000, 0)
|
||||
So(actualNullPoint.Valid, ShouldBeFalse)
|
||||
So(actualNullTime, ShouldEqual, fromStart.Add(15*time.Minute))
|
||||
|
||||
actualValueLast := points[5][0].Float64
|
||||
actualTimeLast := time.Unix(int64(points[5][1].Float64)/1000, 0)
|
||||
So(actualValueLast, ShouldEqual, 20)
|
||||
So(actualTimeLast, ShouldEqual, fromStart.Add(25*time.Minute))
|
||||
|
||||
actualLastNullPoint := points[6][0]
|
||||
actualLastNullTime := time.Unix(int64(points[6][1].Float64)/1000, 0)
|
||||
So(actualLastNullPoint.Valid, ShouldBeFalse)
|
||||
So(actualLastNullTime, ShouldEqual, fromStart.Add(30*time.Minute))
|
||||
|
||||
})
|
||||
|
||||
Convey("When doing a metric query using timeGroup with float fill enabled", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT $__timeGroup(time, '5m', 1.5) AS time, avg(value) as value FROM metric GROUP BY $__timeGroup(time, '5m') ORDER BY 1",
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: fmt.Sprintf("%v", fromStart.Unix()*1000),
|
||||
To: fmt.Sprintf("%v", fromStart.Add(34*time.Minute).Unix()*1000),
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
points := queryResult.Series[0].Points
|
||||
|
||||
So(points[6][0].Float64, ShouldEqual, 1.5)
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Given a table with metrics having multiple values and measurements", func() {
|
||||
sql := `
|
||||
IF OBJECT_ID('dbo.[metric_values]', 'U') IS NOT NULL
|
||||
DROP TABLE dbo.[metric_values]
|
||||
|
||||
CREATE TABLE [metric_values] (
|
||||
time datetime,
|
||||
measurement nvarchar(100),
|
||||
valueOne int,
|
||||
valueTwo int,
|
||||
)
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
type metricValues struct {
|
||||
Time time.Time
|
||||
Measurement string
|
||||
ValueOne int64
|
||||
ValueTwo int64
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().Unix())
|
||||
rnd := func(min, max int64) int64 {
|
||||
return rand.Int63n(max-min) + min
|
||||
}
|
||||
|
||||
series := []*metricValues{}
|
||||
for _, t := range genTimeRangeByInterval(fromStart.Add(-30*time.Minute), 90*time.Minute, 5*time.Minute) {
|
||||
series = append(series, &metricValues{
|
||||
Time: t,
|
||||
Measurement: "Metric A",
|
||||
ValueOne: rnd(0, 100),
|
||||
ValueTwo: rnd(0, 100),
|
||||
})
|
||||
series = append(series, &metricValues{
|
||||
Time: t,
|
||||
Measurement: "Metric B",
|
||||
ValueOne: rnd(0, 100),
|
||||
ValueTwo: rnd(0, 100),
|
||||
})
|
||||
}
|
||||
|
||||
dtFormat := "2006-01-02 15:04:05"
|
||||
for _, s := range series {
|
||||
sql = fmt.Sprintf(`
|
||||
INSERT metric_values (time, measurement, valueOne, valueTwo)
|
||||
VALUES(CAST('%s' AS DATETIME), '%s', %d, %d)
|
||||
`, s.Time.Format(dtFormat), s.Measurement, s.ValueOne, s.ValueTwo)
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
}
|
||||
|
||||
Convey("When doing a metric query grouping by time and select metric column should return correct series", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT $__timeEpoch(time), measurement + ' - value one' as metric, valueOne FROM metric_values ORDER BY 1",
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
So(len(queryResult.Series), ShouldEqual, 2)
|
||||
So(queryResult.Series[0].Name, ShouldEqual, "Metric A - value one")
|
||||
So(queryResult.Series[1].Name, ShouldEqual, "Metric B - value one")
|
||||
})
|
||||
|
||||
Convey("When doing a metric query grouping by time should return correct series", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT $__timeEpoch(time), valueOne, valueTwo FROM metric_values ORDER BY 1",
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
So(len(queryResult.Series), ShouldEqual, 2)
|
||||
So(queryResult.Series[0].Name, ShouldEqual, "valueOne")
|
||||
So(queryResult.Series[1].Name, ShouldEqual, "valueTwo")
|
||||
})
|
||||
|
||||
Convey("Given a stored procedure that takes @from and @to in epoch time", func() {
|
||||
sql := `
|
||||
IF object_id('sp_test_epoch') IS NOT NULL
|
||||
DROP PROCEDURE sp_test_epoch
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
sql = `
|
||||
CREATE PROCEDURE sp_test_epoch(
|
||||
@from int,
|
||||
@to int
|
||||
) AS
|
||||
BEGIN
|
||||
SELECT
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time))/600 as int)*600 as int) as time,
|
||||
measurement + ' - value one' as metric,
|
||||
avg(valueOne) as value
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
time >= DATEADD(s, @from, '1970-01-01') AND time <= DATEADD(s, @to, '1970-01-01')
|
||||
GROUP BY
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time))/600 as int)*600 as int),
|
||||
measurement
|
||||
UNION ALL
|
||||
SELECT
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time))/600 as int)*600 as int) as time,
|
||||
measurement + ' - value two' as metric,
|
||||
avg(valueTwo) as value
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
time >= DATEADD(s, @from, '1970-01-01') AND time <= DATEADD(s, @to, '1970-01-01')
|
||||
GROUP BY
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), time))/600 as int)*600 as int),
|
||||
measurement
|
||||
ORDER BY 1
|
||||
END
|
||||
`
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
Convey("When doing a metric query using stored procedure should return correct result", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": `DECLARE
|
||||
@from int = $__unixEpochFrom(),
|
||||
@to int = $__unixEpochTo()
|
||||
|
||||
EXEC dbo.sp_test_epoch @from, @to`,
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: "1521117000000",
|
||||
To: "1521122100000",
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
So(len(queryResult.Series), ShouldEqual, 4)
|
||||
So(queryResult.Series[0].Name, ShouldEqual, "Metric A - value one")
|
||||
So(queryResult.Series[1].Name, ShouldEqual, "Metric B - value one")
|
||||
So(queryResult.Series[2].Name, ShouldEqual, "Metric A - value two")
|
||||
So(queryResult.Series[3].Name, ShouldEqual, "Metric B - value two")
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Given a stored procedure that takes @from and @to in datetime", func() {
|
||||
sql := `
|
||||
IF object_id('sp_test_datetime') IS NOT NULL
|
||||
DROP PROCEDURE sp_test_datetime
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
sql = `
|
||||
CREATE PROCEDURE sp_test_datetime(
|
||||
@from datetime,
|
||||
@to datetime
|
||||
) AS
|
||||
BEGIN
|
||||
SELECT
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, time)/600 as int)*600 as int) as time,
|
||||
measurement + ' - value one' as metric,
|
||||
avg(valueOne) as value
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
time >= @from AND time <= @to
|
||||
GROUP BY
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, time)/600 as int)*600 as int),
|
||||
measurement
|
||||
UNION ALL
|
||||
SELECT
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, time)/600 as int)*600 as int) as time,
|
||||
measurement + ' - value two' as metric,
|
||||
avg(valueTwo) as value
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
time >= @from AND time <= @to
|
||||
GROUP BY
|
||||
cast(cast(DATEDIFF(second, {d '1970-01-01'}, time)/600 as int)*600 as int),
|
||||
measurement
|
||||
ORDER BY 1
|
||||
END
|
||||
`
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
Convey("When doing a metric query using stored procedure should return correct result", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": `DECLARE
|
||||
@from int = $__unixEpochFrom(),
|
||||
@to int = $__unixEpochTo()
|
||||
|
||||
EXEC dbo.sp_test_epoch @from, @to`,
|
||||
"format": "time_series",
|
||||
}),
|
||||
RefId: "A",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: "1521117000000",
|
||||
To: "1521122100000",
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["A"]
|
||||
So(err, ShouldBeNil)
|
||||
So(queryResult.Error, ShouldBeNil)
|
||||
|
||||
So(len(queryResult.Series), ShouldEqual, 4)
|
||||
So(queryResult.Series[0].Name, ShouldEqual, "Metric A - value one")
|
||||
So(queryResult.Series[1].Name, ShouldEqual, "Metric B - value one")
|
||||
So(queryResult.Series[2].Name, ShouldEqual, "Metric A - value two")
|
||||
So(queryResult.Series[3].Name, ShouldEqual, "Metric B - value two")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Given a table with event data", func() {
|
||||
sql := `
|
||||
IF OBJECT_ID('dbo.[event]', 'U') IS NOT NULL
|
||||
DROP TABLE dbo.[event]
|
||||
|
||||
CREATE TABLE [event] (
|
||||
time_sec bigint,
|
||||
description nvarchar(100),
|
||||
tags nvarchar(100),
|
||||
)
|
||||
`
|
||||
|
||||
_, err := sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
type event struct {
|
||||
TimeSec int64
|
||||
Description string
|
||||
Tags string
|
||||
}
|
||||
|
||||
events := []*event{}
|
||||
for _, t := range genTimeRangeByInterval(fromStart.Add(-20*time.Minute), 60*time.Minute, 25*time.Minute) {
|
||||
events = append(events, &event{
|
||||
TimeSec: t.Unix(),
|
||||
Description: "Someone deployed something",
|
||||
Tags: "deploy",
|
||||
})
|
||||
events = append(events, &event{
|
||||
TimeSec: t.Add(5 * time.Minute).Unix(),
|
||||
Description: "New support ticket registered",
|
||||
Tags: "ticket",
|
||||
})
|
||||
}
|
||||
|
||||
for _, e := range events {
|
||||
sql = fmt.Sprintf(`
|
||||
INSERT [event] (time_sec, description, tags)
|
||||
VALUES(%d, '%s', '%s')
|
||||
`, e.TimeSec, e.Description, e.Tags)
|
||||
|
||||
_, err = sess.Exec(sql)
|
||||
So(err, ShouldBeNil)
|
||||
}
|
||||
|
||||
Convey("When doing an annotation query of deploy events should return expected result", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT time_sec as time, description as [text], tags FROM [event] WHERE $__unixEpochFilter(time_sec) AND tags='deploy' ORDER BY 1 ASC",
|
||||
"format": "table",
|
||||
}),
|
||||
RefId: "Deploys",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: fmt.Sprintf("%v", fromStart.Add(-20*time.Minute).Unix()*1000),
|
||||
To: fmt.Sprintf("%v", fromStart.Add(40*time.Minute).Unix()*1000),
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["Deploys"]
|
||||
So(err, ShouldBeNil)
|
||||
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
|
||||
})
|
||||
|
||||
Convey("When doing an annotation query of ticket events should return expected result", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
Model: simplejson.NewFromAny(map[string]interface{}{
|
||||
"rawSql": "SELECT time_sec as time, description as [text], tags FROM [event] WHERE $__unixEpochFilter(time_sec) AND tags='ticket' ORDER BY 1 ASC",
|
||||
"format": "table",
|
||||
}),
|
||||
RefId: "Tickets",
|
||||
},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{
|
||||
From: fmt.Sprintf("%v", fromStart.Add(-20*time.Minute).Unix()*1000),
|
||||
To: fmt.Sprintf("%v", fromStart.Add(40*time.Minute).Unix()*1000),
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := endpoint.Query(nil, nil, query)
|
||||
queryResult := resp.Results["Tickets"]
|
||||
So(err, ShouldBeNil)
|
||||
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func InitMSSQLTestDB(t *testing.T) *xorm.Engine {
|
||||
x, err := xorm.NewEngine(sqlutil.TestDB_Mssql.DriverName, strings.Replace(sqlutil.TestDB_Mssql.ConnStr, "localhost", serverIP, 1))
|
||||
|
||||
// x.ShowSQL()
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to init mssql db %v", err)
|
||||
}
|
||||
|
||||
sqlutil.CleanDB(x)
|
||||
|
||||
return x
|
||||
}
|
||||
|
||||
func genTimeRangeByInterval(from time.Time, duration time.Duration, interval time.Duration) []time.Time {
|
||||
durationSec := int64(duration.Seconds())
|
||||
intervalSec := int64(interval.Seconds())
|
||||
timeRange := []time.Time{}
|
||||
|
||||
for i := int64(0); i < durationSec; i += intervalSec {
|
||||
timeRange = append(timeRange, from)
|
||||
from = from.Add(time.Duration(int64(time.Second) * intervalSec))
|
||||
}
|
||||
|
||||
return timeRange
|
||||
}
|
@ -36,6 +36,8 @@ import 'brace/mode/text';
|
||||
import 'brace/snippets/text';
|
||||
import 'brace/mode/sql';
|
||||
import 'brace/snippets/sql';
|
||||
import 'brace/mode/sqlserver';
|
||||
import 'brace/snippets/sqlserver';
|
||||
import 'brace/mode/markdown';
|
||||
import 'brace/snippets/markdown';
|
||||
import 'brace/mode/json';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import classNames from "classnames";
|
||||
import { observer } from "mobx-react";
|
||||
import { store } from "app/stores/store";
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { observer } from 'mobx-react';
|
||||
import { store } from 'app/stores/store';
|
||||
|
||||
export interface SearchResultProps {
|
||||
search: any;
|
||||
@ -13,7 +13,7 @@ export class SearchResult extends React.Component<SearchResultProps, any> {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
search: store.search
|
||||
search: store.search,
|
||||
};
|
||||
|
||||
store.search.query();
|
||||
@ -56,29 +56,20 @@ export class SearchResultSection extends React.Component<SectionProps, any> {
|
||||
render() {
|
||||
let collapseClassNames = classNames({
|
||||
fa: true,
|
||||
"fa-plus": !this.props.section.expanded,
|
||||
"fa-minus": this.props.section.expanded,
|
||||
"search-section__header__toggle": true
|
||||
'fa-plus': !this.props.section.expanded,
|
||||
'fa-minus': this.props.section.expanded,
|
||||
'search-section__header__toggle': true,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="search-section" key={this.props.section.id}>
|
||||
<div className="search-section__header">
|
||||
<i
|
||||
className={classNames(
|
||||
"search-section__header__icon",
|
||||
this.props.section.icon
|
||||
)}
|
||||
/>
|
||||
<span className="search-section__header__text">
|
||||
{this.props.section.title}
|
||||
</span>
|
||||
<i className={classNames('search-section__header__icon', this.props.section.icon)} />
|
||||
<span className="search-section__header__text">{this.props.section.title}</span>
|
||||
<i className={collapseClassNames} onClick={this.toggleSection} />
|
||||
</div>
|
||||
{this.props.section.expanded && (
|
||||
<div className="search-section__items">
|
||||
{this.props.section.items.map(this.renderItem)}
|
||||
</div>
|
||||
<div className="search-section__items">{this.props.section.items.map(this.renderItem)}</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
@ -866,9 +866,9 @@ kbn.getUnitFormats = function() {
|
||||
{ text: 'Hryvnias (₴)', value: 'currencyUAH' },
|
||||
{ text: 'Real (R$)', value: 'currencyBRL' },
|
||||
{ text: 'Danish Krone (kr)', value: 'currencyDKK' },
|
||||
{ text: 'Icelandic Krone (kr)', value: 'currencyISK' },
|
||||
{ text: 'Icelandic Króna (kr)', value: 'currencyISK' },
|
||||
{ text: 'Norwegian Krone (kr)', value: 'currencyNOK' },
|
||||
{ text: 'Swedish Krone (kr)', value: 'currencySEK' },
|
||||
{ text: 'Swedish Krona (kr)', value: 'currencySEK' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ import * as mixedPlugin from 'app/plugins/datasource/mixed/module';
|
||||
import * as mysqlPlugin from 'app/plugins/datasource/mysql/module';
|
||||
import * as postgresPlugin from 'app/plugins/datasource/postgres/module';
|
||||
import * as prometheusPlugin from 'app/plugins/datasource/prometheus/module';
|
||||
import * as mssqlPlugin from 'app/plugins/datasource/mssql/module';
|
||||
|
||||
import * as textPanel from 'app/plugins/panel/text/module';
|
||||
import * as graphPanel from 'app/plugins/panel/graph/module';
|
||||
@ -32,6 +33,7 @@ const builtInPlugins = {
|
||||
'app/plugins/datasource/mixed/module': mixedPlugin,
|
||||
'app/plugins/datasource/mysql/module': mysqlPlugin,
|
||||
'app/plugins/datasource/postgres/module': postgresPlugin,
|
||||
'app/plugins/datasource/mssql/module': mssqlPlugin,
|
||||
'app/plugins/datasource/prometheus/module': prometheusPlugin,
|
||||
'app/plugins/app/testdata/module': testDataAppPlugin,
|
||||
'app/plugins/app/testdata/datasource/module': testDataDSPlugin,
|
||||
|
@ -1,28 +1,24 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
'./query_def',
|
||||
],
|
||||
function (angular, _, queryDef) {
|
||||
'use strict';
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import * as queryDef from './query_def';
|
||||
|
||||
var module = angular.module('grafana.directives');
|
||||
export function elasticBucketAgg() {
|
||||
return {
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html',
|
||||
controller: 'ElasticBucketAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
target: '=',
|
||||
index: '=',
|
||||
onChange: '&',
|
||||
getFields: '&',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.directive('elasticBucketAgg', function() {
|
||||
return {
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html',
|
||||
controller: 'ElasticBucketAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
target: "=",
|
||||
index: "=",
|
||||
onChange: "&",
|
||||
getFields: "&",
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('ElasticBucketAggCtrl', function($scope, uiSegmentSrv, $q, $rootScope) {
|
||||
export class ElasticBucketAggCtrl {
|
||||
/** @nginject */
|
||||
constructor($scope, uiSegmentSrv, $q, $rootScope) {
|
||||
var bucketAggs = $scope.target.bucketAggs;
|
||||
|
||||
$scope.orderByOptions = [];
|
||||
@ -39,9 +35,13 @@ function (angular, _, queryDef) {
|
||||
return queryDef.sizeOptions;
|
||||
};
|
||||
|
||||
$rootScope.onAppEvent('elastic-query-updated', function() {
|
||||
$scope.validateModel();
|
||||
}, $scope);
|
||||
$rootScope.onAppEvent(
|
||||
'elastic-query-updated',
|
||||
function() {
|
||||
$scope.validateModel();
|
||||
},
|
||||
$scope
|
||||
);
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.agg = bucketAggs[$scope.index];
|
||||
@ -56,10 +56,10 @@ function (angular, _, queryDef) {
|
||||
$scope.agg.settings = {};
|
||||
$scope.showOptions = false;
|
||||
|
||||
switch($scope.agg.type) {
|
||||
switch ($scope.agg.type) {
|
||||
case 'date_histogram':
|
||||
case 'histogram':
|
||||
case 'terms': {
|
||||
case 'terms': {
|
||||
delete $scope.agg.query;
|
||||
$scope.agg.field = 'select field';
|
||||
break;
|
||||
@ -84,15 +84,15 @@ function (angular, _, queryDef) {
|
||||
$scope.isFirst = $scope.index === 0;
|
||||
$scope.bucketAggCount = bucketAggs.length;
|
||||
|
||||
var settingsLinkText = "";
|
||||
var settingsLinkText = '';
|
||||
var settings = $scope.agg.settings || {};
|
||||
|
||||
switch($scope.agg.type) {
|
||||
switch ($scope.agg.type) {
|
||||
case 'terms': {
|
||||
settings.order = settings.order || "desc";
|
||||
settings.size = settings.size || "10";
|
||||
settings.order = settings.order || 'desc';
|
||||
settings.size = settings.size || '10';
|
||||
settings.min_doc_count = settings.min_doc_count || 1;
|
||||
settings.orderBy = settings.orderBy || "_term";
|
||||
settings.orderBy = settings.orderBy || '_term';
|
||||
|
||||
if (settings.size !== '0') {
|
||||
settingsLinkText = queryDef.describeOrder(settings.order) + ' ' + settings.size + ', ';
|
||||
@ -111,13 +111,17 @@ function (angular, _, queryDef) {
|
||||
break;
|
||||
}
|
||||
case 'filters': {
|
||||
settings.filters = settings.filters || [{query: '*'}];
|
||||
settingsLinkText = _.reduce(settings.filters, function(memo, value, index) {
|
||||
memo += 'Q' + (index + 1) + ' = ' + value.query + ' ';
|
||||
return memo;
|
||||
}, '');
|
||||
settings.filters = settings.filters || [{ query: '*' }];
|
||||
settingsLinkText = _.reduce(
|
||||
settings.filters,
|
||||
function(memo, value, index) {
|
||||
memo += 'Q' + (index + 1) + ' = ' + value.query + ' ';
|
||||
return memo;
|
||||
},
|
||||
''
|
||||
);
|
||||
if (settingsLinkText.length > 50) {
|
||||
settingsLinkText = settingsLinkText.substr(0, 50) + "...";
|
||||
settingsLinkText = settingsLinkText.substr(0, 50) + '...';
|
||||
}
|
||||
settingsLinkText = 'Filter Queries (' + settings.filters.length + ')';
|
||||
break;
|
||||
@ -165,7 +169,7 @@ function (angular, _, queryDef) {
|
||||
};
|
||||
|
||||
$scope.addFiltersQuery = function() {
|
||||
$scope.agg.settings.filters.push({query: '*'});
|
||||
$scope.agg.settings.filters.push({ query: '*' });
|
||||
};
|
||||
|
||||
$scope.removeFiltersQuery = function(filter) {
|
||||
@ -182,7 +186,7 @@ function (angular, _, queryDef) {
|
||||
|
||||
$scope.getFieldsInternal = function() {
|
||||
if ($scope.agg.type === 'date_histogram') {
|
||||
return $scope.getFields({$fieldType: 'date'});
|
||||
return $scope.getFields({ $fieldType: 'date' });
|
||||
} else {
|
||||
return $scope.getFields();
|
||||
}
|
||||
@ -198,14 +202,18 @@ function (angular, _, queryDef) {
|
||||
var addIndex = bucketAggs.length - 1;
|
||||
|
||||
if (lastBucket && lastBucket.type === 'date_histogram') {
|
||||
addIndex - 1;
|
||||
addIndex -= 1;
|
||||
}
|
||||
|
||||
var id = _.reduce($scope.target.bucketAggs.concat($scope.target.metrics), function(max, val) {
|
||||
return parseInt(val.id) > max ? parseInt(val.id) : max;
|
||||
}, 0);
|
||||
var id = _.reduce(
|
||||
$scope.target.bucketAggs.concat($scope.target.metrics),
|
||||
function(max, val) {
|
||||
return parseInt(val.id) > max ? parseInt(val.id) : max;
|
||||
},
|
||||
0
|
||||
);
|
||||
|
||||
bucketAggs.splice(addIndex, 0, {type: "terms", field: "select field", id: (id+1).toString(), fake: true});
|
||||
bucketAggs.splice(addIndex, 0, { type: 'terms', field: 'select field', id: (id + 1).toString(), fake: true });
|
||||
$scope.onChange();
|
||||
};
|
||||
|
||||
@ -215,7 +223,9 @@ function (angular, _, queryDef) {
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
var module = angular.module('grafana.directives');
|
||||
module.directive('elasticBucketAgg', elasticBucketAgg);
|
||||
module.controller('ElasticBucketAggCtrl', ElasticBucketAggCtrl);
|
@ -1,31 +1,25 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
'./query_def'
|
||||
],
|
||||
function (angular, _, queryDef) {
|
||||
'use strict';
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import * as queryDef from './query_def';
|
||||
|
||||
var module = angular.module('grafana.directives');
|
||||
export function elasticMetricAgg() {
|
||||
return {
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/metric_agg.html',
|
||||
controller: 'ElasticMetricAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
target: '=',
|
||||
index: '=',
|
||||
onChange: '&',
|
||||
getFields: '&',
|
||||
esVersion: '=',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.directive('elasticMetricAgg', function() {
|
||||
return {
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/metric_agg.html',
|
||||
controller: 'ElasticMetricAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
target: "=",
|
||||
index: "=",
|
||||
onChange: "&",
|
||||
getFields: "&",
|
||||
esVersion: '='
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('ElasticMetricAggCtrl', function($scope, uiSegmentSrv, $q, $rootScope) {
|
||||
export class ElasticMetricAggCtrl {
|
||||
constructor($scope, uiSegmentSrv, $q, $rootScope) {
|
||||
var metricAggs = $scope.target.metrics;
|
||||
|
||||
$scope.metricAggTypes = queryDef.getMetricAggTypes($scope.esVersion);
|
||||
$scope.extendedStats = queryDef.extendedStats;
|
||||
$scope.pipelineAggOptions = [];
|
||||
@ -41,17 +35,21 @@ function (angular, _, queryDef) {
|
||||
$scope.pipelineAggOptions = queryDef.getPipelineAggOptions($scope.target);
|
||||
};
|
||||
|
||||
$rootScope.onAppEvent('elastic-query-updated', function() {
|
||||
$scope.index = _.indexOf(metricAggs, $scope.agg);
|
||||
$scope.updatePipelineAggOptions();
|
||||
$scope.validateModel();
|
||||
}, $scope);
|
||||
$rootScope.onAppEvent(
|
||||
'elastic-query-updated',
|
||||
function() {
|
||||
$scope.index = _.indexOf(metricAggs, $scope.agg);
|
||||
$scope.updatePipelineAggOptions();
|
||||
$scope.validateModel();
|
||||
},
|
||||
$scope
|
||||
);
|
||||
|
||||
$scope.validateModel = function() {
|
||||
$scope.isFirst = $scope.index === 0;
|
||||
$scope.isSingle = metricAggs.length === 1;
|
||||
$scope.settingsLinkText = '';
|
||||
$scope.aggDef = _.find($scope.metricAggTypes, {value: $scope.agg.type});
|
||||
$scope.aggDef = _.find($scope.metricAggTypes, { value: $scope.agg.type });
|
||||
|
||||
if (queryDef.isPipelineAgg($scope.agg.type)) {
|
||||
$scope.agg.pipelineAgg = $scope.agg.pipelineAgg || 'select metric';
|
||||
@ -67,30 +65,34 @@ function (angular, _, queryDef) {
|
||||
} else if (!$scope.agg.field) {
|
||||
$scope.agg.field = 'select field';
|
||||
}
|
||||
switch($scope.agg.type) {
|
||||
switch ($scope.agg.type) {
|
||||
case 'cardinality': {
|
||||
var precision_threshold = $scope.agg.settings.precision_threshold || '';
|
||||
$scope.settingsLinkText = 'Precision threshold: ' + precision_threshold;
|
||||
break;
|
||||
}
|
||||
case 'percentiles': {
|
||||
$scope.agg.settings.percents = $scope.agg.settings.percents || [25,50,75,95,99];
|
||||
$scope.agg.settings.percents = $scope.agg.settings.percents || [25, 50, 75, 95, 99];
|
||||
$scope.settingsLinkText = 'Values: ' + $scope.agg.settings.percents.join(',');
|
||||
break;
|
||||
}
|
||||
case 'extended_stats': {
|
||||
if (_.keys($scope.agg.meta).length === 0) {
|
||||
if (_.keys($scope.agg.meta).length === 0) {
|
||||
$scope.agg.meta.std_deviation_bounds_lower = true;
|
||||
$scope.agg.meta.std_deviation_bounds_upper = true;
|
||||
}
|
||||
|
||||
var stats = _.reduce($scope.agg.meta, function(memo, val, key) {
|
||||
if (val) {
|
||||
var def = _.find($scope.extendedStats, {value: key});
|
||||
memo.push(def.text);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
var stats = _.reduce(
|
||||
$scope.agg.meta,
|
||||
function(memo, val, key) {
|
||||
if (val) {
|
||||
var def = _.find($scope.extendedStats, { value: key });
|
||||
memo.push(def.text);
|
||||
}
|
||||
return memo;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
$scope.settingsLinkText = 'Stats: ' + stats.join(', ');
|
||||
break;
|
||||
@ -103,8 +105,8 @@ function (angular, _, queryDef) {
|
||||
}
|
||||
case 'raw_document': {
|
||||
$scope.agg.settings.size = $scope.agg.settings.size || 500;
|
||||
$scope.settingsLinkText = 'Size: ' + $scope.agg.settings.size ;
|
||||
$scope.target.metrics.splice(0,$scope.target.metrics.length, $scope.agg);
|
||||
$scope.settingsLinkText = 'Size: ' + $scope.agg.settings.size;
|
||||
$scope.target.metrics.splice(0, $scope.target.metrics.length, $scope.agg);
|
||||
|
||||
$scope.target.bucketAggs = [];
|
||||
break;
|
||||
@ -115,7 +117,7 @@ function (angular, _, queryDef) {
|
||||
// but having it like this simplifes the query_builder
|
||||
var inlineScript = $scope.agg.inlineScript;
|
||||
if (inlineScript) {
|
||||
$scope.agg.settings.script = {inline: inlineScript};
|
||||
$scope.agg.settings.script = { inline: inlineScript };
|
||||
} else {
|
||||
delete $scope.agg.settings.script;
|
||||
}
|
||||
@ -135,15 +137,15 @@ function (angular, _, queryDef) {
|
||||
$scope.onChange();
|
||||
};
|
||||
|
||||
$scope.updateMovingAvgModelSettings = function () {
|
||||
$scope.updateMovingAvgModelSettings = function() {
|
||||
var modelSettingsKeys = [];
|
||||
var modelSettings = queryDef.getMovingAvgSettings($scope.agg.settings.model, false);
|
||||
for (var i=0; i < modelSettings.length; i++) {
|
||||
for (var i = 0; i < modelSettings.length; i++) {
|
||||
modelSettingsKeys.push(modelSettings[i].value);
|
||||
}
|
||||
|
||||
for (var key in $scope.agg.settings.settings) {
|
||||
if (($scope.agg.settings.settings[key] === null) || (modelSettingsKeys.indexOf(key) === -1)) {
|
||||
if ($scope.agg.settings.settings[key] === null || modelSettingsKeys.indexOf(key) === -1) {
|
||||
delete $scope.agg.settings.settings[key];
|
||||
}
|
||||
}
|
||||
@ -166,17 +168,21 @@ function (angular, _, queryDef) {
|
||||
if ($scope.agg.type === 'cardinality') {
|
||||
return $scope.getFields();
|
||||
}
|
||||
return $scope.getFields({$fieldType: 'number'});
|
||||
return $scope.getFields({ $fieldType: 'number' });
|
||||
};
|
||||
|
||||
$scope.addMetricAgg = function() {
|
||||
var addIndex = metricAggs.length;
|
||||
|
||||
var id = _.reduce($scope.target.bucketAggs.concat($scope.target.metrics), function(max, val) {
|
||||
return parseInt(val.id) > max ? parseInt(val.id) : max;
|
||||
}, 0);
|
||||
var id = _.reduce(
|
||||
$scope.target.bucketAggs.concat($scope.target.metrics),
|
||||
function(max, val) {
|
||||
return parseInt(val.id) > max ? parseInt(val.id) : max;
|
||||
},
|
||||
0
|
||||
);
|
||||
|
||||
metricAggs.splice(addIndex, 0, {type: "count", field: "select field", id: (id+1).toString()});
|
||||
metricAggs.splice(addIndex, 0, { type: 'count', field: 'select field', id: (id + 1).toString() });
|
||||
$scope.onChange();
|
||||
};
|
||||
|
||||
@ -194,7 +200,9 @@ function (angular, _, queryDef) {
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
var module = angular.module('grafana.directives');
|
||||
module.directive('elasticMetricAgg', elasticMetricAgg);
|
||||
module.controller('ElasticMetricAggCtrl', ElasticMetricAggCtrl);
|
12
public/app/plugins/datasource/mssql/README.md
Normal file
12
public/app/plugins/datasource/mssql/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Grafana Microsoft SQL Server Data Source - Native Plugin
|
||||
|
||||
Grafana ships with a built-in Microsoft SQL Server (MSSQL) data source plugin that allows you to query and visualize data from any Microsoft SQL Server 2005 or newer.
|
||||
|
||||
## Adding the data source
|
||||
|
||||
1. Open the side menu by clicking the Grafana icon in the top header.
|
||||
2. In the side menu under the `Configuration` link you should find a link named `Data Sources`.
|
||||
3. Click the `+ Add data source` button in the top header.
|
||||
4. Select *Microsoft SQL Server* from the *Type* dropdown.
|
||||
|
||||
For more information, check the [docs](http://docs.grafana.org/).
|
151
public/app/plugins/datasource/mssql/datasource.ts
Normal file
151
public/app/plugins/datasource/mssql/datasource.ts
Normal file
@ -0,0 +1,151 @@
|
||||
import _ from 'lodash';
|
||||
import ResponseParser from './response_parser';
|
||||
|
||||
export class MssqlDatasource {
|
||||
id: any;
|
||||
name: any;
|
||||
responseParser: ResponseParser;
|
||||
|
||||
/** @ngInject **/
|
||||
constructor(instanceSettings, private backendSrv, private $q, private templateSrv) {
|
||||
this.name = instanceSettings.name;
|
||||
this.id = instanceSettings.id;
|
||||
this.responseParser = new ResponseParser(this.$q);
|
||||
}
|
||||
|
||||
interpolateVariable(value, variable) {
|
||||
if (typeof value === 'string') {
|
||||
if (variable.multi || variable.includeAll) {
|
||||
return "'" + value + "'";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof value === 'number') {
|
||||
return value;
|
||||
}
|
||||
|
||||
var quotedValues = _.map(value, function(val) {
|
||||
if (typeof value === 'number') {
|
||||
return value;
|
||||
}
|
||||
|
||||
return "'" + val + "'";
|
||||
});
|
||||
return quotedValues.join(',');
|
||||
}
|
||||
|
||||
query(options) {
|
||||
var queries = _.filter(options.targets, item => {
|
||||
return item.hide !== true;
|
||||
}).map(item => {
|
||||
return {
|
||||
refId: item.refId,
|
||||
intervalMs: options.intervalMs,
|
||||
maxDataPoints: options.maxDataPoints,
|
||||
datasourceId: this.id,
|
||||
rawSql: this.templateSrv.replace(item.rawSql, options.scopedVars, this.interpolateVariable),
|
||||
format: item.format,
|
||||
};
|
||||
});
|
||||
|
||||
if (queries.length === 0) {
|
||||
return this.$q.when({ data: [] });
|
||||
}
|
||||
|
||||
return this.backendSrv
|
||||
.datasourceRequest({
|
||||
url: '/api/tsdb/query',
|
||||
method: 'POST',
|
||||
data: {
|
||||
from: options.range.from.valueOf().toString(),
|
||||
to: options.range.to.valueOf().toString(),
|
||||
queries: queries,
|
||||
},
|
||||
})
|
||||
.then(this.responseParser.processQueryResult);
|
||||
}
|
||||
|
||||
annotationQuery(options) {
|
||||
if (!options.annotation.rawQuery) {
|
||||
return this.$q.reject({ message: 'Query missing in annotation definition' });
|
||||
}
|
||||
|
||||
const query = {
|
||||
refId: options.annotation.name,
|
||||
datasourceId: this.id,
|
||||
rawSql: this.templateSrv.replace(options.annotation.rawQuery, options.scopedVars, this.interpolateVariable),
|
||||
format: 'table',
|
||||
};
|
||||
|
||||
return this.backendSrv
|
||||
.datasourceRequest({
|
||||
url: '/api/tsdb/query',
|
||||
method: 'POST',
|
||||
data: {
|
||||
from: options.range.from.valueOf().toString(),
|
||||
to: options.range.to.valueOf().toString(),
|
||||
queries: [query],
|
||||
},
|
||||
})
|
||||
.then(data => this.responseParser.transformAnnotationResponse(options, data));
|
||||
}
|
||||
|
||||
metricFindQuery(query, optionalOptions) {
|
||||
let refId = 'tempvar';
|
||||
if (optionalOptions && optionalOptions.variable && optionalOptions.variable.name) {
|
||||
refId = optionalOptions.variable.name;
|
||||
}
|
||||
|
||||
const interpolatedQuery = {
|
||||
refId: refId,
|
||||
datasourceId: this.id,
|
||||
rawSql: this.templateSrv.replace(query, {}, this.interpolateVariable),
|
||||
format: 'table',
|
||||
};
|
||||
|
||||
return this.backendSrv
|
||||
.datasourceRequest({
|
||||
url: '/api/tsdb/query',
|
||||
method: 'POST',
|
||||
data: {
|
||||
queries: [interpolatedQuery],
|
||||
},
|
||||
})
|
||||
.then(data => this.responseParser.parseMetricFindQueryResult(refId, data));
|
||||
}
|
||||
|
||||
testDatasource() {
|
||||
return this.backendSrv
|
||||
.datasourceRequest({
|
||||
url: '/api/tsdb/query',
|
||||
method: 'POST',
|
||||
data: {
|
||||
from: '5m',
|
||||
to: 'now',
|
||||
queries: [
|
||||
{
|
||||
refId: 'A',
|
||||
intervalMs: 1,
|
||||
maxDataPoints: 1,
|
||||
datasourceId: this.id,
|
||||
rawSql: 'SELECT 1',
|
||||
format: 'table',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
return { status: 'success', message: 'Database Connection OK' };
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
if (err.data && err.data.message) {
|
||||
return { status: 'error', message: err.data.message };
|
||||
} else {
|
||||
return { status: 'error', message: err.status };
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
36
public/app/plugins/datasource/mssql/module.ts
Normal file
36
public/app/plugins/datasource/mssql/module.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { MssqlDatasource } from './datasource';
|
||||
import { MssqlQueryCtrl } from './query_ctrl';
|
||||
|
||||
class MssqlConfigCtrl {
|
||||
static templateUrl = 'partials/config.html';
|
||||
}
|
||||
|
||||
const defaultQuery = `SELECT
|
||||
<time_column> as time,
|
||||
<text_column> as text,
|
||||
<tags_column> as tags
|
||||
FROM
|
||||
<table name>
|
||||
WHERE
|
||||
$__timeFilter(time_column)
|
||||
ORDER BY
|
||||
<time_column> ASC`;
|
||||
|
||||
class MssqlAnnotationsQueryCtrl {
|
||||
static templateUrl = 'partials/annotations.editor.html';
|
||||
|
||||
annotation: any;
|
||||
|
||||
/** @ngInject **/
|
||||
constructor() {
|
||||
this.annotation.rawQuery = this.annotation.rawQuery || defaultQuery;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
MssqlDatasource,
|
||||
MssqlDatasource as Datasource,
|
||||
MssqlQueryCtrl as QueryCtrl,
|
||||
MssqlConfigCtrl as ConfigCtrl,
|
||||
MssqlAnnotationsQueryCtrl as AnnotationsQueryCtrl,
|
||||
};
|
@ -0,0 +1,42 @@
|
||||
|
||||
<div class="gf-form-group">
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form gf-form--grow">
|
||||
<textarea rows="10" class="gf-form-input" ng-model="ctrl.annotation.rawQuery" spellcheck="false" placeholder="query expression" data-min-length=0 data-items=100 ng-model-onblur ng-change="ctrl.panelCtrl.refresh()"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword" ng-click="ctrl.showHelp = !ctrl.showHelp">
|
||||
Show Help
|
||||
<i class="fa fa-caret-down" ng-show="ctrl.showHelp"></i>
|
||||
<i class="fa fa-caret-right" ng-hide="ctrl.showHelp"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form" ng-show="ctrl.showHelp">
|
||||
<pre class="gf-form-pre alert alert-info"><h6>Annotation Query Format</h6>
|
||||
An annotation is an event that is overlayed on top of graphs. The query can have up to three columns per row, the <b>time</b> column is mandatory. Annotation rendering is expensive so it is important to limit the number of rows returned.
|
||||
|
||||
- column with alias: <b>time</b> for the annotation event time (in UTC). Use unix timestamp in seconds or any native date data type.
|
||||
- column with alias: <b>text</b> for the annotation text.
|
||||
- column with alias: <b>tags</b> for annotation tags. This is a comma separated string of tags e.g. 'tag1,tag2'.
|
||||
|
||||
|
||||
Macros:
|
||||
- $__time(column) -> column AS time
|
||||
- $__utcTime(column) -> DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) AS time
|
||||
- $__timeEpoch(column) -> DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) ) AS time
|
||||
- $__timeFilter(column) -> column > DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01') AND column < DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__unixEpochFilter(column) -> column > 1492750877 AND column < 1492750877
|
||||
|
||||
Or build your own conditionals using these macros which just return the values:
|
||||
- $__timeFrom() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__timeTo() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__unixEpochFrom() -> 1492750877
|
||||
- $__unixEpochTo() -> 1492750877
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
43
public/app/plugins/datasource/mssql/partials/config.html
Normal file
43
public/app/plugins/datasource/mssql/partials/config.html
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
<h3 class="page-heading">MSSQL Connection</h3>
|
||||
|
||||
<div class="gf-form-group">
|
||||
<div class="gf-form max-width-30">
|
||||
<span class="gf-form-label width-7">Host</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="localhost:1433" bs-typeahead="{{['localhost', 'localhost:1433']}}" required></input>
|
||||
</div>
|
||||
|
||||
<div class="gf-form max-width-30">
|
||||
<span class="gf-form-label width-7">Database</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.database' placeholder="database name" required></input>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form max-width-15">
|
||||
<span class="gf-form-label width-7">User</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder="user"></input>
|
||||
</div>
|
||||
<div class="gf-form max-width-15" ng-if="!ctrl.current.secureJsonFields.password">
|
||||
<span class="gf-form-label width-7">Password</span>
|
||||
<input type="password" class="gf-form-input" ng-model='ctrl.current.secureJsonData.password' placeholder="password"></input>
|
||||
</div>
|
||||
<div class="gf-form max-width-19" ng-if="ctrl.current.secureJsonFields.password">
|
||||
<span class="gf-form-label width-7">Password</span>
|
||||
<input type="text" class="gf-form-input" disabled="disabled" value="configured">
|
||||
<a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.current.secureJsonFields.password = false">reset</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-group">
|
||||
<div class="grafana-info-box">
|
||||
<h5>User Permission</h5>
|
||||
<p>
|
||||
The database user should only be granted SELECT permissions on the specified database & tables you want to query.
|
||||
Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
|
||||
like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
|
||||
<strong>Highly</strong> recommmend you create a specific MSSQL user with restricted permissions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,71 @@
|
||||
<query-editor-row query-ctrl="ctrl" can-collapse="false">
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form gf-form--grow">
|
||||
<code-editor content="ctrl.target.rawSql" datasource="ctrl.datasource" on-change="ctrl.panelCtrl.refresh()" data-mode="sqlserver">
|
||||
</code-editor>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword">Format as</label>
|
||||
<div class="gf-form-select-wrapper">
|
||||
<select class="gf-form-input gf-size-auto" ng-model="ctrl.target.format" ng-options="f.value as f.text for f in ctrl.formats" ng-change="ctrl.refresh()"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword" ng-click="ctrl.showHelp = !ctrl.showHelp">
|
||||
Show Help
|
||||
<i class="fa fa-caret-down" ng-show="ctrl.showHelp"></i>
|
||||
<i class="fa fa-caret-right" ng-hide="ctrl.showHelp"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="gf-form" ng-show="ctrl.lastQueryMeta">
|
||||
<label class="gf-form-label query-keyword" ng-click="ctrl.showLastQuerySQL = !ctrl.showLastQuerySQL">
|
||||
Generated SQL
|
||||
<i class="fa fa-caret-down" ng-show="ctrl.showLastQuerySQL"></i>
|
||||
<i class="fa fa-caret-right" ng-hide="ctrl.showLastQuerySQL"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="gf-form gf-form--grow">
|
||||
<div class="gf-form-label gf-form-label--grow"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form" ng-show="ctrl.showLastQuerySQL">
|
||||
<pre class="gf-form-pre">{{ctrl.lastQueryMeta.sql}}</pre>
|
||||
</div>
|
||||
|
||||
<div class="gf-form" ng-show="ctrl.showHelp">
|
||||
<pre class="gf-form-pre alert alert-info">Time series:
|
||||
- return column named time (in UTC), as a unix time stamp or any sql native date data type. You can use the macros below.
|
||||
- optional: return column named metric to represent the series names.
|
||||
- any other columns returned will be the time point values.
|
||||
- if multiple value columns are present and a metric column is provided. the series name will be the combination of "MetricName - ValueColumnName".
|
||||
|
||||
Table:
|
||||
- return any set of columns
|
||||
|
||||
Macros:
|
||||
- $__time(column) -> column AS time
|
||||
- $__utcTime(column) -> DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) AS time
|
||||
- $__timeEpoch(column) -> DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) ) AS time
|
||||
- $__timeFilter(column) -> column > DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01') AND column < DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__unixEpochFilter(column) -> column > 1492750877 AND column < 1492750877
|
||||
- $__timeGroup(column, '5m'[, fillvalue]) -> cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column))/300 as int)*300 as int). Providing a <i>fillValue</i> of <i>NULL</i> or floating value will automatically fill empty series in timerange with that value.
|
||||
|
||||
Or build your own conditionals using these macros which just return the values:
|
||||
- $__timeFrom() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__timeTo() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
|
||||
- $__unixEpochFrom() -> 1492750877
|
||||
- $__unixEpochTo() -> 1492750877
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="gf-form" ng-show="ctrl.lastQueryError">
|
||||
<pre class="gf-form-pre alert alert-error">{{ctrl.lastQueryError}}</pre>
|
||||
</div>
|
||||
|
||||
</query-editor-row>
|
21
public/app/plugins/datasource/mssql/plugin.json
Normal file
21
public/app/plugins/datasource/mssql/plugin.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"type": "datasource",
|
||||
"name": "Microsoft SQL Server",
|
||||
"id": "mssql",
|
||||
|
||||
"info": {
|
||||
"description": "Microsoft SQL Server Data Source for Grafana",
|
||||
"author": {
|
||||
"name": "Grafana Project",
|
||||
"url": "https://grafana.com"
|
||||
},
|
||||
"logos": {
|
||||
"small": "",
|
||||
"large": ""
|
||||
}
|
||||
},
|
||||
|
||||
"alerting": true,
|
||||
"annotations": true,
|
||||
"metrics": true
|
||||
}
|
77
public/app/plugins/datasource/mssql/query_ctrl.ts
Normal file
77
public/app/plugins/datasource/mssql/query_ctrl.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import _ from 'lodash';
|
||||
import { QueryCtrl } from 'app/plugins/sdk';
|
||||
|
||||
export interface MssqlQuery {
|
||||
refId: string;
|
||||
format: string;
|
||||
alias: string;
|
||||
rawSql: string;
|
||||
}
|
||||
|
||||
export interface QueryMeta {
|
||||
sql: string;
|
||||
}
|
||||
|
||||
const defaultQuery = `SELECT
|
||||
$__timeEpoch(<time_column>),
|
||||
<value column> as value,
|
||||
<series name column> as metric
|
||||
FROM
|
||||
<table name>
|
||||
WHERE
|
||||
$__timeFilter(time_column)
|
||||
ORDER BY
|
||||
<time_column> ASC`;
|
||||
|
||||
export class MssqlQueryCtrl extends QueryCtrl {
|
||||
static templateUrl = 'partials/query.editor.html';
|
||||
|
||||
showLastQuerySQL: boolean;
|
||||
formats: any[];
|
||||
target: MssqlQuery;
|
||||
lastQueryMeta: QueryMeta;
|
||||
lastQueryError: string;
|
||||
showHelp: boolean;
|
||||
|
||||
/** @ngInject **/
|
||||
constructor($scope, $injector) {
|
||||
super($scope, $injector);
|
||||
|
||||
this.target.format = this.target.format || 'time_series';
|
||||
this.target.alias = '';
|
||||
this.formats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }];
|
||||
|
||||
if (!this.target.rawSql) {
|
||||
// special handling when in table panel
|
||||
if (this.panelCtrl.panel.type === 'table') {
|
||||
this.target.format = 'table';
|
||||
this.target.rawSql = 'SELECT 1';
|
||||
} else {
|
||||
this.target.rawSql = defaultQuery;
|
||||
}
|
||||
}
|
||||
|
||||
this.panelCtrl.events.on('data-received', this.onDataReceived.bind(this), $scope);
|
||||
this.panelCtrl.events.on('data-error', this.onDataError.bind(this), $scope);
|
||||
}
|
||||
|
||||
onDataReceived(dataList) {
|
||||
this.lastQueryMeta = null;
|
||||
this.lastQueryError = null;
|
||||
|
||||
let anySeriesFromQuery = _.find(dataList, { refId: this.target.refId });
|
||||
if (anySeriesFromQuery) {
|
||||
this.lastQueryMeta = anySeriesFromQuery.meta;
|
||||
}
|
||||
}
|
||||
|
||||
onDataError(err) {
|
||||
if (err.data && err.data.results) {
|
||||
let queryRes = err.data.results[this.target.refId];
|
||||
if (queryRes) {
|
||||
this.lastQueryMeta = queryRes.meta;
|
||||
this.lastQueryError = queryRes.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
139
public/app/plugins/datasource/mssql/response_parser.ts
Normal file
139
public/app/plugins/datasource/mssql/response_parser.ts
Normal file
@ -0,0 +1,139 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
export default class ResponseParser {
|
||||
constructor(private $q) {}
|
||||
|
||||
processQueryResult(res) {
|
||||
var data = [];
|
||||
|
||||
if (!res.data.results) {
|
||||
return { data: data };
|
||||
}
|
||||
|
||||
for (let key in res.data.results) {
|
||||
let queryRes = res.data.results[key];
|
||||
|
||||
if (queryRes.series) {
|
||||
for (let series of queryRes.series) {
|
||||
data.push({
|
||||
target: series.name,
|
||||
datapoints: series.points,
|
||||
refId: queryRes.refId,
|
||||
meta: queryRes.meta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (queryRes.tables) {
|
||||
for (let table of queryRes.tables) {
|
||||
table.type = 'table';
|
||||
table.refId = queryRes.refId;
|
||||
table.meta = queryRes.meta;
|
||||
data.push(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { data: data };
|
||||
}
|
||||
|
||||
parseMetricFindQueryResult(refId, results) {
|
||||
if (!results || results.data.length === 0 || results.data.results[refId].meta.rowCount === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const columns = results.data.results[refId].tables[0].columns;
|
||||
const rows = results.data.results[refId].tables[0].rows;
|
||||
const textColIndex = this.findColIndex(columns, '__text');
|
||||
const valueColIndex = this.findColIndex(columns, '__value');
|
||||
|
||||
if (columns.length === 2 && textColIndex !== -1 && valueColIndex !== -1) {
|
||||
return this.transformToKeyValueList(rows, textColIndex, valueColIndex);
|
||||
}
|
||||
|
||||
return this.transformToSimpleList(rows);
|
||||
}
|
||||
|
||||
transformToKeyValueList(rows, textColIndex, valueColIndex) {
|
||||
const res = [];
|
||||
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (!this.containsKey(res, rows[i][textColIndex])) {
|
||||
res.push({ text: rows[i][textColIndex], value: rows[i][valueColIndex] });
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
transformToSimpleList(rows) {
|
||||
const res = [];
|
||||
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
for (let j = 0; j < rows[i].length; j++) {
|
||||
const value = rows[i][j];
|
||||
if (res.indexOf(value) === -1) {
|
||||
res.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _.map(res, value => {
|
||||
return { text: value };
|
||||
});
|
||||
}
|
||||
|
||||
findColIndex(columns, colName) {
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
if (columns[i].text === colName) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
containsKey(res, key) {
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
if (res[i].text === key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
transformAnnotationResponse(options, data) {
|
||||
const table = data.data.results[options.annotation.name].tables[0];
|
||||
|
||||
let timeColumnIndex = -1;
|
||||
let textColumnIndex = -1;
|
||||
let tagsColumnIndex = -1;
|
||||
|
||||
for (let i = 0; i < table.columns.length; i++) {
|
||||
if (table.columns[i].text === 'time') {
|
||||
timeColumnIndex = i;
|
||||
} else if (table.columns[i].text === 'text') {
|
||||
textColumnIndex = i;
|
||||
} else if (table.columns[i].text === 'tags') {
|
||||
tagsColumnIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeColumnIndex === -1) {
|
||||
return this.$q.reject({ message: 'Missing mandatory time column (with time column alias) in annotation query.' });
|
||||
}
|
||||
|
||||
const list = [];
|
||||
for (let i = 0; i < table.rows.length; i++) {
|
||||
const row = table.rows[i];
|
||||
list.push({
|
||||
annotation: options.annotation,
|
||||
time: Math.floor(row[timeColumnIndex]) * 1000,
|
||||
text: row[textColumnIndex],
|
||||
tags: row[tagsColumnIndex] ? row[tagsColumnIndex].trim().split(/\s*,\s*/) : [],
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
236
public/app/plugins/datasource/mssql/specs/datasource_specs.ts
Normal file
236
public/app/plugins/datasource/mssql/specs/datasource_specs.ts
Normal file
@ -0,0 +1,236 @@
|
||||
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
|
||||
import moment from 'moment';
|
||||
import helpers from 'test/specs/helpers';
|
||||
import {MssqlDatasource} from '../datasource';
|
||||
import {CustomVariable} from 'app/features/templating/custom_variable';
|
||||
|
||||
describe('MSSQLDatasource', function() {
|
||||
var ctx = new helpers.ServiceTestContext();
|
||||
var instanceSettings = {name: 'mssql'};
|
||||
|
||||
beforeEach(angularMocks.module('grafana.core'));
|
||||
beforeEach(angularMocks.module('grafana.services'));
|
||||
beforeEach(ctx.providePhase(['backendSrv']));
|
||||
|
||||
beforeEach(angularMocks.inject(function($q, $rootScope, $httpBackend, $injector) {
|
||||
ctx.$q = $q;
|
||||
ctx.$httpBackend = $httpBackend;
|
||||
ctx.$rootScope = $rootScope;
|
||||
ctx.ds = $injector.instantiate(MssqlDatasource, {instanceSettings: instanceSettings});
|
||||
$httpBackend.when('GET', /\.html$/).respond('');
|
||||
}));
|
||||
|
||||
describe('When performing annotationQuery', function() {
|
||||
let results;
|
||||
|
||||
const annotationName = 'MyAnno';
|
||||
|
||||
const options = {
|
||||
annotation: {
|
||||
name: annotationName,
|
||||
rawQuery: 'select time, text, tags from table;'
|
||||
},
|
||||
range: {
|
||||
from: moment(1432288354),
|
||||
to: moment(1432288401)
|
||||
}
|
||||
};
|
||||
|
||||
const response = {
|
||||
results: {
|
||||
MyAnno: {
|
||||
refId: annotationName,
|
||||
tables: [
|
||||
{
|
||||
columns: [{text: 'time'}, {text: 'text'}, {text: 'tags'}],
|
||||
rows: [
|
||||
[1432288355, 'some text', 'TagA,TagB'],
|
||||
[1432288390, 'some text2', ' TagB , TagC'],
|
||||
[1432288400, 'some text3']
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
ctx.backendSrv.datasourceRequest = function(options) {
|
||||
return ctx.$q.when({data: response, status: 200});
|
||||
};
|
||||
ctx.ds.annotationQuery(options).then(function(data) { results = data; });
|
||||
ctx.$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return annotation list', function() {
|
||||
expect(results.length).to.be(3);
|
||||
|
||||
expect(results[0].text).to.be('some text');
|
||||
expect(results[0].tags[0]).to.be('TagA');
|
||||
expect(results[0].tags[1]).to.be('TagB');
|
||||
|
||||
expect(results[1].tags[0]).to.be('TagB');
|
||||
expect(results[1].tags[1]).to.be('TagC');
|
||||
|
||||
expect(results[2].tags.length).to.be(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery', function() {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
results: {
|
||||
tempvar: {
|
||||
meta: {
|
||||
rowCount: 3
|
||||
},
|
||||
refId: 'tempvar',
|
||||
tables: [
|
||||
{
|
||||
columns: [{text: 'title'}, {text: 'text'}],
|
||||
rows: [
|
||||
['aTitle', 'some text'],
|
||||
['aTitle2', 'some text2'],
|
||||
['aTitle3', 'some text3']
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
ctx.backendSrv.datasourceRequest = function(options) {
|
||||
return ctx.$q.when({data: response, status: 200});
|
||||
};
|
||||
ctx.ds.metricFindQuery(query).then(function(data) { results = data; });
|
||||
ctx.$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return list of all column values', function() {
|
||||
expect(results.length).to.be(6);
|
||||
expect(results[0].text).to.be('aTitle');
|
||||
expect(results[5].text).to.be('some text3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery with key, value columns', function() {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
results: {
|
||||
tempvar: {
|
||||
meta: {
|
||||
rowCount: 3
|
||||
},
|
||||
refId: 'tempvar',
|
||||
tables: [
|
||||
{
|
||||
columns: [{text: '__value'}, {text: '__text'}],
|
||||
rows: [
|
||||
['value1', 'aTitle'],
|
||||
['value2', 'aTitle2'],
|
||||
['value3', 'aTitle3']
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
ctx.backendSrv.datasourceRequest = function(options) {
|
||||
return ctx.$q.when({data: response, status: 200});
|
||||
};
|
||||
ctx.ds.metricFindQuery(query).then(function(data) { results = data; });
|
||||
ctx.$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return list of as text, value', function() {
|
||||
expect(results.length).to.be(3);
|
||||
expect(results[0].text).to.be('aTitle');
|
||||
expect(results[0].value).to.be('value1');
|
||||
expect(results[2].text).to.be('aTitle3');
|
||||
expect(results[2].value).to.be('value3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery with key, value columns and with duplicate keys', function() {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
results: {
|
||||
tempvar: {
|
||||
meta: {
|
||||
rowCount: 3
|
||||
},
|
||||
refId: 'tempvar',
|
||||
tables: [
|
||||
{
|
||||
columns: [{text: '__text'}, {text: '__value'}],
|
||||
rows: [
|
||||
['aTitle', 'same'],
|
||||
['aTitle', 'same'],
|
||||
['aTitle', 'diff']
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
ctx.backendSrv.datasourceRequest = function(options) {
|
||||
return ctx.$q.when({data: response, status: 200});
|
||||
};
|
||||
ctx.ds.metricFindQuery(query).then(function(data) { results = data; });
|
||||
ctx.$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return list of unique keys', function() {
|
||||
expect(results.length).to.be(1);
|
||||
expect(results[0].text).to.be('aTitle');
|
||||
expect(results[0].value).to.be('same');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When interpolating variables', () => {
|
||||
beforeEach(function() {
|
||||
ctx.variable = new CustomVariable({},{});
|
||||
});
|
||||
|
||||
describe('and value is a string', () => {
|
||||
it('should return an unquoted value', () => {
|
||||
expect(ctx.ds.interpolateVariable('abc', ctx.variable)).to.eql('abc');
|
||||
});
|
||||
});
|
||||
|
||||
describe('and value is a number', () => {
|
||||
it('should return an unquoted value', () => {
|
||||
expect(ctx.ds.interpolateVariable(1000, ctx.variable)).to.eql(1000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('and value is an array of strings', () => {
|
||||
it('should return comma separated quoted values', () => {
|
||||
expect(ctx.ds.interpolateVariable(['a', 'b', 'c'], ctx.variable)).to.eql('\'a\',\'b\',\'c\'');
|
||||
});
|
||||
});
|
||||
|
||||
describe('and variable allows multi-value and value is a string', () => {
|
||||
it('should return a quoted value', () => {
|
||||
ctx.variable.multi = true;
|
||||
expect(ctx.ds.interpolateVariable('abc', ctx.variable)).to.eql('\'abc\'');
|
||||
});
|
||||
});
|
||||
|
||||
describe('and variable allows all and value is a string', () => {
|
||||
it('should return a quoted value', () => {
|
||||
ctx.variable.includeAll = true;
|
||||
expect(ctx.ds.interpolateVariable('abc', ctx.variable)).to.eql('\'abc\'');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
@ -1,476 +0,0 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
'app/core/utils/datemath',
|
||||
'moment',
|
||||
],
|
||||
function (angular, _, dateMath) {
|
||||
'use strict';
|
||||
|
||||
/** @ngInject */
|
||||
function OpenTsDatasource(instanceSettings, $q, backendSrv, templateSrv) {
|
||||
this.type = 'opentsdb';
|
||||
this.url = instanceSettings.url;
|
||||
this.name = instanceSettings.name;
|
||||
this.withCredentials = instanceSettings.withCredentials;
|
||||
this.basicAuth = instanceSettings.basicAuth;
|
||||
instanceSettings.jsonData = instanceSettings.jsonData || {};
|
||||
this.tsdbVersion = instanceSettings.jsonData.tsdbVersion || 1;
|
||||
this.tsdbResolution = instanceSettings.jsonData.tsdbResolution || 1;
|
||||
this.supportMetrics = true;
|
||||
this.tagKeys = {};
|
||||
|
||||
// Called once per panel (graph)
|
||||
this.query = function(options) {
|
||||
var start = convertToTSDBTime(options.rangeRaw.from, false);
|
||||
var end = convertToTSDBTime(options.rangeRaw.to, true);
|
||||
var qs = [];
|
||||
|
||||
_.each(options.targets, function(target) {
|
||||
if (!target.metric) { return; }
|
||||
qs.push(convertTargetToQuery(target, options, this.tsdbVersion));
|
||||
}.bind(this));
|
||||
|
||||
var queries = _.compact(qs);
|
||||
|
||||
// No valid targets, return the empty result to save a round trip.
|
||||
if (_.isEmpty(queries)) {
|
||||
var d = $q.defer();
|
||||
d.resolve({ data: [] });
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
var groupByTags = {};
|
||||
_.each(queries, function(query) {
|
||||
if (query.filters && query.filters.length > 0) {
|
||||
_.each(query.filters, function(val) {
|
||||
groupByTags[val.tagk] = true;
|
||||
});
|
||||
} else {
|
||||
_.each(query.tags, function(val, key) {
|
||||
groupByTags[key] = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
options.targets = _.filter(options.targets, function(query) {
|
||||
return query.hide !== true;
|
||||
});
|
||||
|
||||
return this.performTimeSeriesQuery(queries, start, end).then(function(response) {
|
||||
var metricToTargetMapping = mapMetricsToTargets(response.data, options, this.tsdbVersion);
|
||||
var result = _.map(response.data, function(metricData, index) {
|
||||
index = metricToTargetMapping[index];
|
||||
if (index === -1) {
|
||||
index = 0;
|
||||
}
|
||||
this._saveTagKeys(metricData);
|
||||
|
||||
return transformMetricData(metricData, groupByTags, options.targets[index], options, this.tsdbResolution);
|
||||
}.bind(this));
|
||||
return { data: result };
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
this.annotationQuery = function(options) {
|
||||
var start = convertToTSDBTime(options.rangeRaw.from, false);
|
||||
var end = convertToTSDBTime(options.rangeRaw.to, true);
|
||||
var qs = [];
|
||||
var eventList = [];
|
||||
|
||||
qs.push({ aggregator:"sum", metric:options.annotation.target });
|
||||
|
||||
var queries = _.compact(qs);
|
||||
|
||||
return this.performTimeSeriesQuery(queries, start, end).then(function(results) {
|
||||
if(results.data[0]) {
|
||||
var annotationObject = results.data[0].annotations;
|
||||
if(options.annotation.isGlobal){
|
||||
annotationObject = results.data[0].globalAnnotations;
|
||||
}
|
||||
if(annotationObject) {
|
||||
_.each(annotationObject, function(annotation) {
|
||||
var event = {
|
||||
text: annotation.description,
|
||||
time: Math.floor(annotation.startTime) * 1000,
|
||||
annotation: options.annotation
|
||||
};
|
||||
|
||||
eventList.push(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
return eventList;
|
||||
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
this.targetContainsTemplate = function(target) {
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
for (var i = 0; i < target.filters.length; i++) {
|
||||
if (templateSrv.variableExists(target.filters[i].filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.tags && Object.keys(target.tags).length > 0) {
|
||||
for (var tagKey in target.tags) {
|
||||
if (templateSrv.variableExists(target.tags[tagKey])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
this.performTimeSeriesQuery = function(queries, start, end) {
|
||||
var msResolution = false;
|
||||
if (this.tsdbResolution === 2) {
|
||||
msResolution = true;
|
||||
}
|
||||
var reqBody = {
|
||||
start: start,
|
||||
queries: queries,
|
||||
msResolution: msResolution,
|
||||
globalAnnotations: true
|
||||
};
|
||||
if (this.tsdbVersion === 3) {
|
||||
reqBody.showQuery = true;
|
||||
}
|
||||
|
||||
// Relative queries (e.g. last hour) don't include an end time
|
||||
if (end) {
|
||||
reqBody.end = end;
|
||||
}
|
||||
|
||||
var options = {
|
||||
method: 'POST',
|
||||
url: this.url + '/api/query',
|
||||
data: reqBody
|
||||
};
|
||||
|
||||
this._addCredentialOptions(options);
|
||||
return backendSrv.datasourceRequest(options);
|
||||
};
|
||||
|
||||
this.suggestTagKeys = function(metric) {
|
||||
return $q.when(this.tagKeys[metric] || []);
|
||||
};
|
||||
|
||||
this._saveTagKeys = function(metricData) {
|
||||
var tagKeys = Object.keys(metricData.tags);
|
||||
_.each(metricData.aggregateTags, function(tag) {
|
||||
tagKeys.push(tag);
|
||||
});
|
||||
|
||||
this.tagKeys[metricData.metric] = tagKeys;
|
||||
};
|
||||
|
||||
this._performSuggestQuery = function(query, type) {
|
||||
return this._get('/api/suggest', {type: type, q: query, max: 1000}).then(function(result) {
|
||||
return result.data;
|
||||
});
|
||||
};
|
||||
|
||||
this._performMetricKeyValueLookup = function(metric, keys) {
|
||||
|
||||
if(!metric || !keys) {
|
||||
return $q.when([]);
|
||||
}
|
||||
|
||||
var keysArray = keys.split(",").map(function(key) {
|
||||
return key.trim();
|
||||
});
|
||||
var key = keysArray[0];
|
||||
var keysQuery = key + "=*";
|
||||
|
||||
if (keysArray.length > 1) {
|
||||
keysQuery += "," + keysArray.splice(1).join(",");
|
||||
}
|
||||
|
||||
var m = metric + "{" + keysQuery + "}";
|
||||
|
||||
return this._get('/api/search/lookup', {m: m, limit: 3000}).then(function(result) {
|
||||
result = result.data.results;
|
||||
var tagvs = [];
|
||||
_.each(result, function(r) {
|
||||
if (tagvs.indexOf(r.tags[key]) === -1) {
|
||||
tagvs.push(r.tags[key]);
|
||||
}
|
||||
});
|
||||
return tagvs;
|
||||
});
|
||||
};
|
||||
|
||||
this._performMetricKeyLookup = function(metric) {
|
||||
if(!metric) { return $q.when([]); }
|
||||
|
||||
return this._get('/api/search/lookup', {m: metric, limit: 1000}).then(function(result) {
|
||||
result = result.data.results;
|
||||
var tagks = [];
|
||||
_.each(result, function(r) {
|
||||
_.each(r.tags, function(tagv, tagk) {
|
||||
if(tagks.indexOf(tagk) === -1) {
|
||||
tagks.push(tagk);
|
||||
}
|
||||
});
|
||||
});
|
||||
return tagks;
|
||||
});
|
||||
};
|
||||
|
||||
this._get = function(relativeUrl, params) {
|
||||
var options = {
|
||||
method: 'GET',
|
||||
url: this.url + relativeUrl,
|
||||
params: params,
|
||||
};
|
||||
|
||||
this._addCredentialOptions(options);
|
||||
|
||||
return backendSrv.datasourceRequest(options);
|
||||
};
|
||||
|
||||
this._addCredentialOptions = function(options) {
|
||||
if (this.basicAuth || this.withCredentials) {
|
||||
options.withCredentials = true;
|
||||
}
|
||||
if (this.basicAuth) {
|
||||
options.headers = {"Authorization": this.basicAuth};
|
||||
}
|
||||
};
|
||||
|
||||
this.metricFindQuery = function(query) {
|
||||
if (!query) { return $q.when([]); }
|
||||
|
||||
var interpolated;
|
||||
try {
|
||||
interpolated = templateSrv.replace(query, {}, 'distributed');
|
||||
}
|
||||
catch (err) {
|
||||
return $q.reject(err);
|
||||
}
|
||||
|
||||
var responseTransform = function(result) {
|
||||
return _.map(result, function(value) {
|
||||
return {text: value};
|
||||
});
|
||||
};
|
||||
|
||||
var metrics_regex = /metrics\((.*)\)/;
|
||||
var tag_names_regex = /tag_names\((.*)\)/;
|
||||
var tag_values_regex = /tag_values\((.*?),\s?(.*)\)/;
|
||||
var tag_names_suggest_regex = /suggest_tagk\((.*)\)/;
|
||||
var tag_values_suggest_regex = /suggest_tagv\((.*)\)/;
|
||||
|
||||
var metrics_query = interpolated.match(metrics_regex);
|
||||
if (metrics_query) {
|
||||
return this._performSuggestQuery(metrics_query[1], 'metrics').then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_names_query = interpolated.match(tag_names_regex);
|
||||
if (tag_names_query) {
|
||||
return this._performMetricKeyLookup(tag_names_query[1]).then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_values_query = interpolated.match(tag_values_regex);
|
||||
if (tag_values_query) {
|
||||
return this._performMetricKeyValueLookup(tag_values_query[1], tag_values_query[2]).then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_names_suggest_query = interpolated.match(tag_names_suggest_regex);
|
||||
if (tag_names_suggest_query) {
|
||||
return this._performSuggestQuery(tag_names_suggest_query[1], 'tagk').then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_values_suggest_query = interpolated.match(tag_values_suggest_regex);
|
||||
if (tag_values_suggest_query) {
|
||||
return this._performSuggestQuery(tag_values_suggest_query[1], 'tagv').then(responseTransform);
|
||||
}
|
||||
|
||||
return $q.when([]);
|
||||
};
|
||||
|
||||
this.testDatasource = function() {
|
||||
return this._performSuggestQuery('cpu', 'metrics').then(function () {
|
||||
return { status: "success", message: "Data source is working" };
|
||||
});
|
||||
};
|
||||
|
||||
var aggregatorsPromise = null;
|
||||
this.getAggregators = function() {
|
||||
if (aggregatorsPromise) { return aggregatorsPromise; }
|
||||
|
||||
aggregatorsPromise = this._get('/api/aggregators').then(function(result) {
|
||||
if (result.data && _.isArray(result.data)) {
|
||||
return result.data.sort();
|
||||
}
|
||||
return [];
|
||||
});
|
||||
return aggregatorsPromise;
|
||||
};
|
||||
|
||||
var filterTypesPromise = null;
|
||||
this.getFilterTypes = function() {
|
||||
if (filterTypesPromise) { return filterTypesPromise; }
|
||||
|
||||
filterTypesPromise = this._get('/api/config/filters').then(function(result) {
|
||||
if (result.data) {
|
||||
return Object.keys(result.data).sort();
|
||||
}
|
||||
return [];
|
||||
});
|
||||
return filterTypesPromise;
|
||||
};
|
||||
|
||||
function transformMetricData(md, groupByTags, target, options, tsdbResolution) {
|
||||
var metricLabel = createMetricLabel(md, target, groupByTags, options);
|
||||
var dps = [];
|
||||
|
||||
// TSDB returns datapoints has a hash of ts => value.
|
||||
// Can't use _.pairs(invert()) because it stringifies keys/values
|
||||
_.each(md.dps, function (v, k) {
|
||||
if (tsdbResolution === 2) {
|
||||
dps.push([v, k * 1]);
|
||||
} else {
|
||||
dps.push([v, k * 1000]);
|
||||
}
|
||||
});
|
||||
|
||||
return { target: metricLabel, datapoints: dps };
|
||||
}
|
||||
|
||||
function createMetricLabel(md, target, groupByTags, options) {
|
||||
if (target.alias) {
|
||||
var scopedVars = _.clone(options.scopedVars || {});
|
||||
_.each(md.tags, function(value, key) {
|
||||
scopedVars['tag_' + key] = {value: value};
|
||||
});
|
||||
return templateSrv.replace(target.alias, scopedVars);
|
||||
}
|
||||
|
||||
var label = md.metric;
|
||||
var tagData = [];
|
||||
|
||||
if (!_.isEmpty(md.tags)) {
|
||||
_.each(_.toPairs(md.tags), function(tag) {
|
||||
if (_.has(groupByTags, tag[0])) {
|
||||
tagData.push(tag[0] + "=" + tag[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!_.isEmpty(tagData)) {
|
||||
label += "{" + tagData.join(", ") + "}";
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
function convertTargetToQuery(target, options, tsdbVersion) {
|
||||
if (!target.metric || target.hide) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var query = {
|
||||
metric: templateSrv.replace(target.metric, options.scopedVars, 'pipe'),
|
||||
aggregator: "avg"
|
||||
};
|
||||
|
||||
if (target.aggregator) {
|
||||
query.aggregator = templateSrv.replace(target.aggregator);
|
||||
}
|
||||
|
||||
if (target.shouldComputeRate) {
|
||||
query.rate = true;
|
||||
query.rateOptions = {
|
||||
counter: !!target.isCounter
|
||||
};
|
||||
|
||||
if (target.counterMax && target.counterMax.length) {
|
||||
query.rateOptions.counterMax = parseInt(target.counterMax);
|
||||
}
|
||||
|
||||
if (target.counterResetValue && target.counterResetValue.length) {
|
||||
query.rateOptions.resetValue = parseInt(target.counterResetValue);
|
||||
}
|
||||
|
||||
if(tsdbVersion >= 2) {
|
||||
query.rateOptions.dropResets = !query.rateOptions.counterMax &&
|
||||
(!query.rateOptions.ResetValue || query.rateOptions.ResetValue === 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.disableDownsampling) {
|
||||
var interval = templateSrv.replace(target.downsampleInterval || options.interval);
|
||||
|
||||
if (interval.match(/\.[0-9]+s/)) {
|
||||
interval = parseFloat(interval)*1000 + "ms";
|
||||
}
|
||||
|
||||
query.downsample = interval + "-" + target.downsampleAggregator;
|
||||
|
||||
if (target.downsampleFillPolicy && target.downsampleFillPolicy !== "none") {
|
||||
query.downsample += "-" + target.downsampleFillPolicy;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
query.filters = angular.copy(target.filters);
|
||||
if (query.filters){
|
||||
for (var filter_key in query.filters) {
|
||||
query.filters[filter_key].filter = templateSrv.replace(query.filters[filter_key].filter, options.scopedVars, 'pipe');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
query.tags = angular.copy(target.tags);
|
||||
if (query.tags){
|
||||
for (var tag_key in query.tags) {
|
||||
query.tags[tag_key] = templateSrv.replace(query.tags[tag_key], options.scopedVars, 'pipe');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.explicitTags) {
|
||||
query.explicitTags = true;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
function mapMetricsToTargets(metrics, options, tsdbVersion) {
|
||||
var interpolatedTagValue, arrTagV;
|
||||
return _.map(metrics, function(metricData) {
|
||||
if (tsdbVersion === 3) {
|
||||
return metricData.query.index;
|
||||
} else {
|
||||
return _.findIndex(options.targets, function(target) {
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
return target.metric === metricData.metric;
|
||||
} else {
|
||||
return target.metric === metricData.metric &&
|
||||
_.every(target.tags, function(tagV, tagK) {
|
||||
interpolatedTagValue = templateSrv.replace(tagV, options.scopedVars, 'pipe');
|
||||
arrTagV = interpolatedTagValue.split('|');
|
||||
return _.includes(arrTagV, metricData.tags[tagK]) || interpolatedTagValue === "*";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function convertToTSDBTime(date, roundUp) {
|
||||
if (date === 'now') {
|
||||
return null;
|
||||
}
|
||||
|
||||
date = dateMath.parse(date, roundUp);
|
||||
return date.valueOf();
|
||||
}
|
||||
}
|
||||
|
||||
return OpenTsDatasource;
|
||||
});
|
513
public/app/plugins/datasource/opentsdb/datasource.ts
Normal file
513
public/app/plugins/datasource/opentsdb/datasource.ts
Normal file
@ -0,0 +1,513 @@
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import * as dateMath from 'app/core/utils/datemath';
|
||||
|
||||
export default class OpenTsDatasource {
|
||||
type: any;
|
||||
url: any;
|
||||
name: any;
|
||||
withCredentials: any;
|
||||
basicAuth: any;
|
||||
tsdbVersion: any;
|
||||
tsdbResolution: any;
|
||||
supportMetrics: any;
|
||||
tagKeys: any;
|
||||
|
||||
aggregatorsPromise: any;
|
||||
filterTypesPromise: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(instanceSettings, private $q, private backendSrv, private templateSrv) {
|
||||
this.type = 'opentsdb';
|
||||
this.url = instanceSettings.url;
|
||||
this.name = instanceSettings.name;
|
||||
this.withCredentials = instanceSettings.withCredentials;
|
||||
this.basicAuth = instanceSettings.basicAuth;
|
||||
instanceSettings.jsonData = instanceSettings.jsonData || {};
|
||||
this.tsdbVersion = instanceSettings.jsonData.tsdbVersion || 1;
|
||||
this.tsdbResolution = instanceSettings.jsonData.tsdbResolution || 1;
|
||||
this.supportMetrics = true;
|
||||
this.tagKeys = {};
|
||||
|
||||
this.aggregatorsPromise = null;
|
||||
this.filterTypesPromise = null;
|
||||
}
|
||||
|
||||
// Called once per panel (graph)
|
||||
query(options) {
|
||||
var start = this.convertToTSDBTime(options.rangeRaw.from, false);
|
||||
var end = this.convertToTSDBTime(options.rangeRaw.to, true);
|
||||
var qs = [];
|
||||
|
||||
_.each(
|
||||
options.targets,
|
||||
function(target) {
|
||||
if (!target.metric) {
|
||||
return;
|
||||
}
|
||||
qs.push(this.convertTargetToQuery(target, options, this.tsdbVersion));
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
var queries = _.compact(qs);
|
||||
|
||||
// No valid targets, return the empty result to save a round trip.
|
||||
if (_.isEmpty(queries)) {
|
||||
var d = this.$q.defer();
|
||||
d.resolve({ data: [] });
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
var groupByTags = {};
|
||||
_.each(queries, function(query) {
|
||||
if (query.filters && query.filters.length > 0) {
|
||||
_.each(query.filters, function(val) {
|
||||
groupByTags[val.tagk] = true;
|
||||
});
|
||||
} else {
|
||||
_.each(query.tags, function(val, key) {
|
||||
groupByTags[key] = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
options.targets = _.filter(options.targets, function(query) {
|
||||
return query.hide !== true;
|
||||
});
|
||||
|
||||
return this.performTimeSeriesQuery(queries, start, end).then(
|
||||
function(response) {
|
||||
var metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion);
|
||||
var result = _.map(
|
||||
response.data,
|
||||
function(metricData, index) {
|
||||
index = metricToTargetMapping[index];
|
||||
if (index === -1) {
|
||||
index = 0;
|
||||
}
|
||||
this._saveTagKeys(metricData);
|
||||
|
||||
return this.transformMetricData(
|
||||
metricData,
|
||||
groupByTags,
|
||||
options.targets[index],
|
||||
options,
|
||||
this.tsdbResolution
|
||||
);
|
||||
}.bind(this)
|
||||
);
|
||||
return { data: result };
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
annotationQuery(options) {
|
||||
var start = this.convertToTSDBTime(options.rangeRaw.from, false);
|
||||
var end = this.convertToTSDBTime(options.rangeRaw.to, true);
|
||||
var qs = [];
|
||||
var eventList = [];
|
||||
|
||||
qs.push({ aggregator: 'sum', metric: options.annotation.target });
|
||||
|
||||
var queries = _.compact(qs);
|
||||
|
||||
return this.performTimeSeriesQuery(queries, start, end).then(
|
||||
function(results) {
|
||||
if (results.data[0]) {
|
||||
var annotationObject = results.data[0].annotations;
|
||||
if (options.annotation.isGlobal) {
|
||||
annotationObject = results.data[0].globalAnnotations;
|
||||
}
|
||||
if (annotationObject) {
|
||||
_.each(annotationObject, function(annotation) {
|
||||
var event = {
|
||||
text: annotation.description,
|
||||
time: Math.floor(annotation.startTime) * 1000,
|
||||
annotation: options.annotation,
|
||||
};
|
||||
|
||||
eventList.push(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
return eventList;
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
targetContainsTemplate(target) {
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
for (var i = 0; i < target.filters.length; i++) {
|
||||
if (this.templateSrv.variableExists(target.filters[i].filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.tags && Object.keys(target.tags).length > 0) {
|
||||
for (var tagKey in target.tags) {
|
||||
if (this.templateSrv.variableExists(target.tags[tagKey])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
performTimeSeriesQuery(queries, start, end) {
|
||||
var msResolution = false;
|
||||
if (this.tsdbResolution === 2) {
|
||||
msResolution = true;
|
||||
}
|
||||
var reqBody: any = {
|
||||
start: start,
|
||||
queries: queries,
|
||||
msResolution: msResolution,
|
||||
globalAnnotations: true,
|
||||
};
|
||||
if (this.tsdbVersion === 3) {
|
||||
reqBody.showQuery = true;
|
||||
}
|
||||
|
||||
// Relative queries (e.g. last hour) don't include an end time
|
||||
if (end) {
|
||||
reqBody.end = end;
|
||||
}
|
||||
|
||||
var options = {
|
||||
method: 'POST',
|
||||
url: this.url + '/api/query',
|
||||
data: reqBody,
|
||||
};
|
||||
|
||||
this._addCredentialOptions(options);
|
||||
return this.backendSrv.datasourceRequest(options);
|
||||
}
|
||||
|
||||
suggestTagKeys(metric) {
|
||||
return this.$q.when(this.tagKeys[metric] || []);
|
||||
}
|
||||
|
||||
_saveTagKeys(metricData) {
|
||||
var tagKeys = Object.keys(metricData.tags);
|
||||
_.each(metricData.aggregateTags, function(tag) {
|
||||
tagKeys.push(tag);
|
||||
});
|
||||
|
||||
this.tagKeys[metricData.metric] = tagKeys;
|
||||
}
|
||||
|
||||
_performSuggestQuery(query, type) {
|
||||
return this._get('/api/suggest', { type: type, q: query, max: 1000 }).then(function(result) {
|
||||
return result.data;
|
||||
});
|
||||
}
|
||||
|
||||
_performMetricKeyValueLookup(metric, keys) {
|
||||
if (!metric || !keys) {
|
||||
return this.$q.when([]);
|
||||
}
|
||||
|
||||
var keysArray = keys.split(',').map(function(key) {
|
||||
return key.trim();
|
||||
});
|
||||
var key = keysArray[0];
|
||||
var keysQuery = key + '=*';
|
||||
|
||||
if (keysArray.length > 1) {
|
||||
keysQuery += ',' + keysArray.splice(1).join(',');
|
||||
}
|
||||
|
||||
var m = metric + '{' + keysQuery + '}';
|
||||
|
||||
return this._get('/api/search/lookup', { m: m, limit: 3000 }).then(function(result) {
|
||||
result = result.data.results;
|
||||
var tagvs = [];
|
||||
_.each(result, function(r) {
|
||||
if (tagvs.indexOf(r.tags[key]) === -1) {
|
||||
tagvs.push(r.tags[key]);
|
||||
}
|
||||
});
|
||||
return tagvs;
|
||||
});
|
||||
}
|
||||
|
||||
_performMetricKeyLookup(metric) {
|
||||
if (!metric) {
|
||||
return this.$q.when([]);
|
||||
}
|
||||
|
||||
return this._get('/api/search/lookup', { m: metric, limit: 1000 }).then(function(result) {
|
||||
result = result.data.results;
|
||||
var tagks = [];
|
||||
_.each(result, function(r) {
|
||||
_.each(r.tags, function(tagv, tagk) {
|
||||
if (tagks.indexOf(tagk) === -1) {
|
||||
tagks.push(tagk);
|
||||
}
|
||||
});
|
||||
});
|
||||
return tagks;
|
||||
});
|
||||
}
|
||||
|
||||
_get(relativeUrl, params?) {
|
||||
var options = {
|
||||
method: 'GET',
|
||||
url: this.url + relativeUrl,
|
||||
params: params,
|
||||
};
|
||||
|
||||
this._addCredentialOptions(options);
|
||||
|
||||
return this.backendSrv.datasourceRequest(options);
|
||||
}
|
||||
|
||||
_addCredentialOptions(options) {
|
||||
if (this.basicAuth || this.withCredentials) {
|
||||
options.withCredentials = true;
|
||||
}
|
||||
if (this.basicAuth) {
|
||||
options.headers = { Authorization: this.basicAuth };
|
||||
}
|
||||
}
|
||||
|
||||
metricFindQuery(query) {
|
||||
if (!query) {
|
||||
return this.$q.when([]);
|
||||
}
|
||||
|
||||
var interpolated;
|
||||
try {
|
||||
interpolated = this.templateSrv.replace(query, {}, 'distributed');
|
||||
} catch (err) {
|
||||
return this.$q.reject(err);
|
||||
}
|
||||
|
||||
var responseTransform = function(result) {
|
||||
return _.map(result, function(value) {
|
||||
return { text: value };
|
||||
});
|
||||
};
|
||||
|
||||
var metrics_regex = /metrics\((.*)\)/;
|
||||
var tag_names_regex = /tag_names\((.*)\)/;
|
||||
var tag_values_regex = /tag_values\((.*?),\s?(.*)\)/;
|
||||
var tag_names_suggest_regex = /suggest_tagk\((.*)\)/;
|
||||
var tag_values_suggest_regex = /suggest_tagv\((.*)\)/;
|
||||
|
||||
var metrics_query = interpolated.match(metrics_regex);
|
||||
if (metrics_query) {
|
||||
return this._performSuggestQuery(metrics_query[1], 'metrics').then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_names_query = interpolated.match(tag_names_regex);
|
||||
if (tag_names_query) {
|
||||
return this._performMetricKeyLookup(tag_names_query[1]).then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_values_query = interpolated.match(tag_values_regex);
|
||||
if (tag_values_query) {
|
||||
return this._performMetricKeyValueLookup(tag_values_query[1], tag_values_query[2]).then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_names_suggest_query = interpolated.match(tag_names_suggest_regex);
|
||||
if (tag_names_suggest_query) {
|
||||
return this._performSuggestQuery(tag_names_suggest_query[1], 'tagk').then(responseTransform);
|
||||
}
|
||||
|
||||
var tag_values_suggest_query = interpolated.match(tag_values_suggest_regex);
|
||||
if (tag_values_suggest_query) {
|
||||
return this._performSuggestQuery(tag_values_suggest_query[1], 'tagv').then(responseTransform);
|
||||
}
|
||||
|
||||
return this.$q.when([]);
|
||||
}
|
||||
|
||||
testDatasource() {
|
||||
return this._performSuggestQuery('cpu', 'metrics').then(function() {
|
||||
return { status: 'success', message: 'Data source is working' };
|
||||
});
|
||||
}
|
||||
|
||||
getAggregators() {
|
||||
if (this.aggregatorsPromise) {
|
||||
return this.aggregatorsPromise;
|
||||
}
|
||||
|
||||
this.aggregatorsPromise = this._get('/api/aggregators').then(function(result) {
|
||||
if (result.data && _.isArray(result.data)) {
|
||||
return result.data.sort();
|
||||
}
|
||||
return [];
|
||||
});
|
||||
return this.aggregatorsPromise;
|
||||
}
|
||||
|
||||
getFilterTypes() {
|
||||
if (this.filterTypesPromise) {
|
||||
return this.filterTypesPromise;
|
||||
}
|
||||
|
||||
this.filterTypesPromise = this._get('/api/config/filters').then(function(result) {
|
||||
if (result.data) {
|
||||
return Object.keys(result.data).sort();
|
||||
}
|
||||
return [];
|
||||
});
|
||||
return this.filterTypesPromise;
|
||||
}
|
||||
|
||||
transformMetricData(md, groupByTags, target, options, tsdbResolution) {
|
||||
var metricLabel = this.createMetricLabel(md, target, groupByTags, options);
|
||||
var dps = [];
|
||||
|
||||
// TSDB returns datapoints has a hash of ts => value.
|
||||
// Can't use _.pairs(invert()) because it stringifies keys/values
|
||||
_.each(md.dps, function(v, k) {
|
||||
if (tsdbResolution === 2) {
|
||||
dps.push([v, k * 1]);
|
||||
} else {
|
||||
dps.push([v, k * 1000]);
|
||||
}
|
||||
});
|
||||
|
||||
return { target: metricLabel, datapoints: dps };
|
||||
}
|
||||
|
||||
createMetricLabel(md, target, groupByTags, options) {
|
||||
if (target.alias) {
|
||||
var scopedVars = _.clone(options.scopedVars || {});
|
||||
_.each(md.tags, function(value, key) {
|
||||
scopedVars['tag_' + key] = { value: value };
|
||||
});
|
||||
return this.templateSrv.replace(target.alias, scopedVars);
|
||||
}
|
||||
|
||||
var label = md.metric;
|
||||
var tagData = [];
|
||||
|
||||
if (!_.isEmpty(md.tags)) {
|
||||
_.each(_.toPairs(md.tags), function(tag) {
|
||||
if (_.has(groupByTags, tag[0])) {
|
||||
tagData.push(tag[0] + '=' + tag[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!_.isEmpty(tagData)) {
|
||||
label += '{' + tagData.join(', ') + '}';
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
convertTargetToQuery(target, options, tsdbVersion) {
|
||||
if (!target.metric || target.hide) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var query: any = {
|
||||
metric: this.templateSrv.replace(target.metric, options.scopedVars, 'pipe'),
|
||||
aggregator: 'avg',
|
||||
};
|
||||
|
||||
if (target.aggregator) {
|
||||
query.aggregator = this.templateSrv.replace(target.aggregator);
|
||||
}
|
||||
|
||||
if (target.shouldComputeRate) {
|
||||
query.rate = true;
|
||||
query.rateOptions = {
|
||||
counter: !!target.isCounter,
|
||||
};
|
||||
|
||||
if (target.counterMax && target.counterMax.length) {
|
||||
query.rateOptions.counterMax = parseInt(target.counterMax);
|
||||
}
|
||||
|
||||
if (target.counterResetValue && target.counterResetValue.length) {
|
||||
query.rateOptions.resetValue = parseInt(target.counterResetValue);
|
||||
}
|
||||
|
||||
if (tsdbVersion >= 2) {
|
||||
query.rateOptions.dropResets =
|
||||
!query.rateOptions.counterMax && (!query.rateOptions.ResetValue || query.rateOptions.ResetValue === 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.disableDownsampling) {
|
||||
var interval = this.templateSrv.replace(target.downsampleInterval || options.interval);
|
||||
|
||||
if (interval.match(/\.[0-9]+s/)) {
|
||||
interval = parseFloat(interval) * 1000 + 'ms';
|
||||
}
|
||||
|
||||
query.downsample = interval + '-' + target.downsampleAggregator;
|
||||
|
||||
if (target.downsampleFillPolicy && target.downsampleFillPolicy !== 'none') {
|
||||
query.downsample += '-' + target.downsampleFillPolicy;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
query.filters = angular.copy(target.filters);
|
||||
if (query.filters) {
|
||||
for (var filter_key in query.filters) {
|
||||
query.filters[filter_key].filter = this.templateSrv.replace(
|
||||
query.filters[filter_key].filter,
|
||||
options.scopedVars,
|
||||
'pipe'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
query.tags = angular.copy(target.tags);
|
||||
if (query.tags) {
|
||||
for (var tag_key in query.tags) {
|
||||
query.tags[tag_key] = this.templateSrv.replace(query.tags[tag_key], options.scopedVars, 'pipe');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.explicitTags) {
|
||||
query.explicitTags = true;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
mapMetricsToTargets(metrics, options, tsdbVersion) {
|
||||
var interpolatedTagValue, arrTagV;
|
||||
return _.map(metrics, function(metricData) {
|
||||
if (tsdbVersion === 3) {
|
||||
return metricData.query.index;
|
||||
} else {
|
||||
return _.findIndex(options.targets, function(target) {
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
return target.metric === metricData.metric;
|
||||
} else {
|
||||
return (
|
||||
target.metric === metricData.metric &&
|
||||
_.every(target.tags, function(tagV, tagK) {
|
||||
interpolatedTagValue = this.templateSrv.replace(tagV, options.scopedVars, 'pipe');
|
||||
arrTagV = interpolatedTagValue.split('|');
|
||||
return _.includes(arrTagV, metricData.tags[tagK]) || interpolatedTagValue === '*';
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
convertToTSDBTime(date, roundUp) {
|
||||
if (date === 'now') {
|
||||
return null;
|
||||
}
|
||||
|
||||
date = dateMath.parse(date, roundUp);
|
||||
return date.valueOf();
|
||||
}
|
||||
}
|
@ -5,32 +5,46 @@ export class PromCompleter {
|
||||
labelQueryCache: any;
|
||||
labelNameCache: any;
|
||||
labelValueCache: any;
|
||||
templateVariableCompletions: any;
|
||||
|
||||
identifierRegexps = [/\[/, /[a-zA-Z0-9_:]/];
|
||||
|
||||
constructor(private datasource: PrometheusDatasource) {
|
||||
constructor(private datasource: PrometheusDatasource, private templateSrv) {
|
||||
this.labelQueryCache = {};
|
||||
this.labelNameCache = {};
|
||||
this.labelValueCache = {};
|
||||
this.templateVariableCompletions = this.templateSrv.variables.map(variable => {
|
||||
return {
|
||||
caption: '$' + variable.name,
|
||||
value: '$' + variable.name,
|
||||
meta: 'variable',
|
||||
score: Number.MAX_VALUE,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getCompletions(editor, session, pos, prefix, callback) {
|
||||
let wrappedCallback = (err, completions) => {
|
||||
completions = completions.concat(this.templateVariableCompletions);
|
||||
return callback(err, completions);
|
||||
};
|
||||
|
||||
let token = session.getTokenAt(pos.row, pos.column);
|
||||
|
||||
switch (token.type) {
|
||||
case 'entity.name.tag.label-matcher':
|
||||
this.getCompletionsForLabelMatcherName(session, pos).then(completions => {
|
||||
callback(null, completions);
|
||||
wrappedCallback(null, completions);
|
||||
});
|
||||
return;
|
||||
case 'string.quoted.label-matcher':
|
||||
this.getCompletionsForLabelMatcherValue(session, pos).then(completions => {
|
||||
callback(null, completions);
|
||||
wrappedCallback(null, completions);
|
||||
});
|
||||
return;
|
||||
case 'entity.name.tag.label-list-matcher':
|
||||
this.getCompletionsForBinaryOperator(session, pos).then(completions => {
|
||||
callback(null, completions);
|
||||
wrappedCallback(null, completions);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -59,14 +73,14 @@ export class PromCompleter {
|
||||
meta: 'range vector',
|
||||
});
|
||||
|
||||
callback(null, vectors);
|
||||
wrappedCallback(null, vectors);
|
||||
return;
|
||||
}
|
||||
|
||||
var query = prefix;
|
||||
|
||||
return this.datasource.performSuggestQuery(query, true).then(metricNames => {
|
||||
callback(
|
||||
wrappedCallback(
|
||||
null,
|
||||
metricNames.map(name => {
|
||||
let value = name;
|
||||
|
@ -50,6 +50,9 @@ var PrometheusHighlightRules = function() {
|
||||
token : "keyword.control",
|
||||
regex : "by|without|on|ignoring|group_left|group_right",
|
||||
next : "start-label-list-matcher"
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : "\\$[A-Za-z0-9_]+"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_:][a-zA-Z0-9_:]*"
|
||||
|
@ -43,7 +43,7 @@ class PrometheusQueryCtrl extends QueryCtrl {
|
||||
}
|
||||
|
||||
getCompleter(query) {
|
||||
return new PromCompleter(this.datasource);
|
||||
return new PromCompleter(this.datasource, this.templateSrv);
|
||||
}
|
||||
|
||||
getDefaultFormat() {
|
||||
|
@ -1,9 +1,13 @@
|
||||
import { describe, it, sinon, expect } from 'test/lib/common';
|
||||
import helpers from 'test/specs/helpers';
|
||||
|
||||
import { PromCompleter } from '../completer';
|
||||
import { PrometheusDatasource } from '../datasource';
|
||||
|
||||
describe('Prometheus editor completer', function() {
|
||||
var ctx = new helpers.ServiceTestContext();
|
||||
beforeEach(ctx.providePhase(['templateSrv']));
|
||||
|
||||
function getSessionStub(data) {
|
||||
return {
|
||||
getTokenAt: sinon.stub().returns(data.currentToken),
|
||||
@ -39,7 +43,18 @@ describe('Prometheus editor completer', function() {
|
||||
.returns(Promise.resolve(['node_cpu'])),
|
||||
};
|
||||
|
||||
let completer = new PromCompleter(datasourceStub);
|
||||
let templateSrv = {
|
||||
variables: [
|
||||
{
|
||||
name: 'var_name',
|
||||
options: [
|
||||
{ text: 'foo', value: 'foo', selected: false },
|
||||
{ text: 'bar', value: 'bar', selected: true }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
let completer = new PromCompleter(datasourceStub, templateSrv);
|
||||
|
||||
describe('When inside brackets', () => {
|
||||
it('Should return range vectors', () => {
|
||||
|
27
vendor/github.com/denisenkom/go-mssqldb/LICENSE.txt
generated
vendored
Normal file
27
vendor/github.com/denisenkom/go-mssqldb/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
259
vendor/github.com/denisenkom/go-mssqldb/buf.go
generated
vendored
Normal file
259
vendor/github.com/denisenkom/go-mssqldb/buf.go
generated
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
)
|
||||
|
||||
type packetType uint8
|
||||
|
||||
type header struct {
|
||||
PacketType packetType
|
||||
Status uint8
|
||||
Size uint16
|
||||
Spid uint16
|
||||
PacketNo uint8
|
||||
Pad uint8
|
||||
}
|
||||
|
||||
// tdsBuffer reads and writes TDS packets of data to the transport.
|
||||
// The write and read buffers are separate to make sending attn signals
|
||||
// possible without locks. Currently attn signals are only sent during
|
||||
// reads, not writes.
|
||||
type tdsBuffer struct {
|
||||
transport io.ReadWriteCloser
|
||||
|
||||
packetSize int
|
||||
|
||||
// Write fields.
|
||||
wbuf []byte
|
||||
wpos int
|
||||
wPacketSeq byte
|
||||
wPacketType packetType
|
||||
|
||||
// Read fields.
|
||||
rbuf []byte
|
||||
rpos int
|
||||
rsize int
|
||||
final bool
|
||||
rPacketType packetType
|
||||
|
||||
// afterFirst is assigned to right after tdsBuffer is created and
|
||||
// before the first use. It is executed after the first packet is
|
||||
// written and then removed.
|
||||
afterFirst func()
|
||||
}
|
||||
|
||||
func newTdsBuffer(bufsize uint16, transport io.ReadWriteCloser) *tdsBuffer {
|
||||
return &tdsBuffer{
|
||||
packetSize: int(bufsize),
|
||||
wbuf: make([]byte, 1<<16),
|
||||
rbuf: make([]byte, 1<<16),
|
||||
rpos: 8,
|
||||
transport: transport,
|
||||
}
|
||||
}
|
||||
|
||||
func (rw *tdsBuffer) ResizeBuffer(packetSize int) {
|
||||
rw.packetSize = packetSize
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) PackageSize() int {
|
||||
return w.packetSize
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) flush() (err error) {
|
||||
// Write packet size.
|
||||
w.wbuf[0] = byte(w.wPacketType)
|
||||
binary.BigEndian.PutUint16(w.wbuf[2:], uint16(w.wpos))
|
||||
w.wbuf[6] = w.wPacketSeq
|
||||
|
||||
// Write packet into underlying transport.
|
||||
if _, err = w.transport.Write(w.wbuf[:w.wpos]); err != nil {
|
||||
return err
|
||||
}
|
||||
// It is possible to create a whole new buffer after a flush.
|
||||
// Useful for debugging. Normally reuse the buffer.
|
||||
// w.wbuf = make([]byte, 1<<16)
|
||||
|
||||
// Execute afterFirst hook if it is set.
|
||||
if w.afterFirst != nil {
|
||||
w.afterFirst()
|
||||
w.afterFirst = nil
|
||||
}
|
||||
|
||||
w.wpos = 8
|
||||
w.wPacketSeq++
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) Write(p []byte) (total int, err error) {
|
||||
for {
|
||||
copied := copy(w.wbuf[w.wpos:w.packetSize], p)
|
||||
w.wpos += copied
|
||||
total += copied
|
||||
if copied == len(p) {
|
||||
return
|
||||
}
|
||||
if err = w.flush(); err != nil {
|
||||
return
|
||||
}
|
||||
p = p[copied:]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) WriteByte(b byte) error {
|
||||
if int(w.wpos) == len(w.wbuf) {
|
||||
if err := w.flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
w.wbuf[w.wpos] = b
|
||||
w.wpos += 1
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) BeginPacket(packetType packetType, resetSession bool) {
|
||||
status := byte(0)
|
||||
if resetSession {
|
||||
switch packetType {
|
||||
// Reset session can only be set on the following packet types.
|
||||
case packSQLBatch, packRPCRequest, packTransMgrReq:
|
||||
status = 0x8
|
||||
}
|
||||
}
|
||||
w.wbuf[1] = status // Packet is incomplete. This byte is set again in FinishPacket.
|
||||
w.wpos = 8
|
||||
w.wPacketSeq = 1
|
||||
w.wPacketType = packetType
|
||||
}
|
||||
|
||||
func (w *tdsBuffer) FinishPacket() error {
|
||||
w.wbuf[1] |= 1 // Mark this as the last packet in the message.
|
||||
return w.flush()
|
||||
}
|
||||
|
||||
var headerSize = binary.Size(header{})
|
||||
|
||||
func (r *tdsBuffer) readNextPacket() error {
|
||||
h := header{}
|
||||
var err error
|
||||
err = binary.Read(r.transport, binary.BigEndian, &h)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if int(h.Size) > len(r.rbuf) {
|
||||
return errors.New("Invalid packet size, it is longer than buffer size")
|
||||
}
|
||||
if headerSize > int(h.Size) {
|
||||
return errors.New("Invalid packet size, it is shorter than header size")
|
||||
}
|
||||
_, err = io.ReadFull(r.transport, r.rbuf[headerSize:h.Size])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.rpos = headerSize
|
||||
r.rsize = int(h.Size)
|
||||
r.final = h.Status != 0
|
||||
r.rPacketType = h.PacketType
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) BeginRead() (packetType, error) {
|
||||
err := r.readNextPacket()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return r.rPacketType, nil
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) ReadByte() (res byte, err error) {
|
||||
if r.rpos == r.rsize {
|
||||
if r.final {
|
||||
return 0, io.EOF
|
||||
}
|
||||
err = r.readNextPacket()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
res = r.rbuf[r.rpos]
|
||||
r.rpos++
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) byte() byte {
|
||||
b, err := r.ReadByte()
|
||||
if err != nil {
|
||||
badStreamPanic(err)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) ReadFull(buf []byte) {
|
||||
_, err := io.ReadFull(r, buf[:])
|
||||
if err != nil {
|
||||
badStreamPanic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) uint64() uint64 {
|
||||
var buf [8]byte
|
||||
r.ReadFull(buf[:])
|
||||
return binary.LittleEndian.Uint64(buf[:])
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) int32() int32 {
|
||||
return int32(r.uint32())
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) uint32() uint32 {
|
||||
var buf [4]byte
|
||||
r.ReadFull(buf[:])
|
||||
return binary.LittleEndian.Uint32(buf[:])
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) uint16() uint16 {
|
||||
var buf [2]byte
|
||||
r.ReadFull(buf[:])
|
||||
return binary.LittleEndian.Uint16(buf[:])
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) BVarChar() string {
|
||||
l := int(r.byte())
|
||||
return r.readUcs2(l)
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) UsVarChar() string {
|
||||
l := int(r.uint16())
|
||||
return r.readUcs2(l)
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) readUcs2(numchars int) string {
|
||||
b := make([]byte, numchars*2)
|
||||
r.ReadFull(b)
|
||||
res, err := ucs22str(b)
|
||||
if err != nil {
|
||||
badStreamPanic(err)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (r *tdsBuffer) Read(buf []byte) (copied int, err error) {
|
||||
copied = 0
|
||||
err = nil
|
||||
if r.rpos == r.rsize {
|
||||
if r.final {
|
||||
return 0, io.EOF
|
||||
}
|
||||
err = r.readNextPacket()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
copied = copy(buf, r.rbuf[r.rpos:r.rsize])
|
||||
r.rpos += copied
|
||||
return
|
||||
}
|
604
vendor/github.com/denisenkom/go-mssqldb/bulkcopy.go
generated
vendored
Normal file
604
vendor/github.com/denisenkom/go-mssqldb/bulkcopy.go
generated
vendored
Normal file
@ -0,0 +1,604 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Bulk struct {
|
||||
// ctx is used only for AddRow and Done methods.
|
||||
// This could be removed if AddRow and Done accepted
|
||||
// a ctx field as well, which is available with the
|
||||
// database/sql call.
|
||||
ctx context.Context
|
||||
|
||||
cn *Conn
|
||||
metadata []columnStruct
|
||||
bulkColumns []columnStruct
|
||||
columnsName []string
|
||||
tablename string
|
||||
numRows int
|
||||
|
||||
headerSent bool
|
||||
Options BulkOptions
|
||||
Debug bool
|
||||
}
|
||||
type BulkOptions struct {
|
||||
CheckConstraints bool
|
||||
FireTriggers bool
|
||||
KeepNulls bool
|
||||
KilobytesPerBatch int
|
||||
RowsPerBatch int
|
||||
Order []string
|
||||
Tablock bool
|
||||
}
|
||||
|
||||
type DataValue interface{}
|
||||
|
||||
func (cn *Conn) CreateBulk(table string, columns []string) (_ *Bulk) {
|
||||
b := Bulk{ctx: context.Background(), cn: cn, tablename: table, headerSent: false, columnsName: columns}
|
||||
b.Debug = false
|
||||
return &b
|
||||
}
|
||||
|
||||
func (cn *Conn) CreateBulkContext(ctx context.Context, table string, columns []string) (_ *Bulk) {
|
||||
b := Bulk{ctx: ctx, cn: cn, tablename: table, headerSent: false, columnsName: columns}
|
||||
b.Debug = false
|
||||
return &b
|
||||
}
|
||||
|
||||
func (b *Bulk) sendBulkCommand(ctx context.Context) (err error) {
|
||||
//get table columns info
|
||||
err = b.getMetadata(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//match the columns
|
||||
for _, colname := range b.columnsName {
|
||||
var bulkCol *columnStruct
|
||||
|
||||
for _, m := range b.metadata {
|
||||
if m.ColName == colname {
|
||||
bulkCol = &m
|
||||
break
|
||||
}
|
||||
}
|
||||
if bulkCol != nil {
|
||||
|
||||
if bulkCol.ti.TypeId == typeUdt {
|
||||
//send udt as binary
|
||||
bulkCol.ti.TypeId = typeBigVarBin
|
||||
}
|
||||
b.bulkColumns = append(b.bulkColumns, *bulkCol)
|
||||
b.dlogf("Adding column %s %s %#x", colname, bulkCol.ColName, bulkCol.ti.TypeId)
|
||||
} else {
|
||||
return fmt.Errorf("Column %s does not exist in destination table %s", colname, b.tablename)
|
||||
}
|
||||
}
|
||||
|
||||
//create the bulk command
|
||||
|
||||
//columns definitions
|
||||
var col_defs bytes.Buffer
|
||||
for i, col := range b.bulkColumns {
|
||||
if i != 0 {
|
||||
col_defs.WriteString(", ")
|
||||
}
|
||||
col_defs.WriteString("[" + col.ColName + "] " + makeDecl(col.ti))
|
||||
}
|
||||
|
||||
//options
|
||||
var with_opts []string
|
||||
|
||||
if b.Options.CheckConstraints {
|
||||
with_opts = append(with_opts, "CHECK_CONSTRAINTS")
|
||||
}
|
||||
if b.Options.FireTriggers {
|
||||
with_opts = append(with_opts, "FIRE_TRIGGERS")
|
||||
}
|
||||
if b.Options.KeepNulls {
|
||||
with_opts = append(with_opts, "KEEP_NULLS")
|
||||
}
|
||||
if b.Options.KilobytesPerBatch > 0 {
|
||||
with_opts = append(with_opts, fmt.Sprintf("KILOBYTES_PER_BATCH = %d", b.Options.KilobytesPerBatch))
|
||||
}
|
||||
if b.Options.RowsPerBatch > 0 {
|
||||
with_opts = append(with_opts, fmt.Sprintf("ROWS_PER_BATCH = %d", b.Options.RowsPerBatch))
|
||||
}
|
||||
if len(b.Options.Order) > 0 {
|
||||
with_opts = append(with_opts, fmt.Sprintf("ORDER(%s)", strings.Join(b.Options.Order, ",")))
|
||||
}
|
||||
if b.Options.Tablock {
|
||||
with_opts = append(with_opts, "TABLOCK")
|
||||
}
|
||||
var with_part string
|
||||
if len(with_opts) > 0 {
|
||||
with_part = fmt.Sprintf("WITH (%s)", strings.Join(with_opts, ","))
|
||||
}
|
||||
|
||||
query := fmt.Sprintf("INSERT BULK %s (%s) %s", b.tablename, col_defs.String(), with_part)
|
||||
|
||||
stmt, err := b.cn.PrepareContext(ctx, query)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Prepare failed: %s", err.Error())
|
||||
}
|
||||
b.dlogf(query)
|
||||
|
||||
_, err = stmt.(*Stmt).ExecContext(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
b.headerSent = true
|
||||
|
||||
var buf = b.cn.sess.buf
|
||||
buf.BeginPacket(packBulkLoadBCP, false)
|
||||
|
||||
// Send the columns metadata.
|
||||
columnMetadata := b.createColMetadata()
|
||||
_, err = buf.Write(columnMetadata)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// AddRow immediately writes the row to the destination table.
|
||||
// The arguments are the row values in the order they were specified.
|
||||
func (b *Bulk) AddRow(row []interface{}) (err error) {
|
||||
if !b.headerSent {
|
||||
err = b.sendBulkCommand(b.ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(row) != len(b.bulkColumns) {
|
||||
return fmt.Errorf("Row does not have the same number of columns than the destination table %d %d",
|
||||
len(row), len(b.bulkColumns))
|
||||
}
|
||||
|
||||
bytes, err := b.makeRowData(row)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = b.cn.sess.buf.Write(bytes)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
b.numRows = b.numRows + 1
|
||||
return
|
||||
}
|
||||
|
||||
func (b *Bulk) makeRowData(row []interface{}) ([]byte, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.WriteByte(byte(tokenRow))
|
||||
|
||||
var logcol bytes.Buffer
|
||||
for i, col := range b.bulkColumns {
|
||||
|
||||
if b.Debug {
|
||||
logcol.WriteString(fmt.Sprintf(" col[%d]='%v' ", i, row[i]))
|
||||
}
|
||||
param, err := b.makeParam(row[i], col)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("bulkcopy: %s", err.Error())
|
||||
}
|
||||
|
||||
if col.ti.Writer == nil {
|
||||
return nil, fmt.Errorf("no writer for column: %s, TypeId: %#x",
|
||||
col.ColName, col.ti.TypeId)
|
||||
}
|
||||
err = col.ti.Writer(buf, param.ti, param.buffer)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("bulkcopy: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
b.dlogf("row[%d] %s\n", b.numRows, logcol.String())
|
||||
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func (b *Bulk) Done() (rowcount int64, err error) {
|
||||
if b.headerSent == false {
|
||||
//no rows had been sent
|
||||
return 0, nil
|
||||
}
|
||||
var buf = b.cn.sess.buf
|
||||
buf.WriteByte(byte(tokenDone))
|
||||
|
||||
binary.Write(buf, binary.LittleEndian, uint16(doneFinal))
|
||||
binary.Write(buf, binary.LittleEndian, uint16(0)) // curcmd
|
||||
|
||||
if b.cn.sess.loginAck.TDSVersion >= verTDS72 {
|
||||
binary.Write(buf, binary.LittleEndian, uint64(0)) //rowcount 0
|
||||
} else {
|
||||
binary.Write(buf, binary.LittleEndian, uint32(0)) //rowcount 0
|
||||
}
|
||||
|
||||
buf.FinishPacket()
|
||||
|
||||
tokchan := make(chan tokenStruct, 5)
|
||||
go processResponse(b.ctx, b.cn.sess, tokchan, nil)
|
||||
|
||||
var rowCount int64
|
||||
for token := range tokchan {
|
||||
switch token := token.(type) {
|
||||
case doneStruct:
|
||||
if token.Status&doneCount != 0 {
|
||||
rowCount = int64(token.RowCount)
|
||||
}
|
||||
if token.isError() {
|
||||
return 0, token.getError()
|
||||
}
|
||||
case error:
|
||||
return 0, b.cn.checkBadConn(token)
|
||||
}
|
||||
}
|
||||
return rowCount, nil
|
||||
}
|
||||
|
||||
func (b *Bulk) createColMetadata() []byte {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.WriteByte(byte(tokenColMetadata)) // token
|
||||
binary.Write(buf, binary.LittleEndian, uint16(len(b.bulkColumns))) // column count
|
||||
|
||||
for i, col := range b.bulkColumns {
|
||||
|
||||
if b.cn.sess.loginAck.TDSVersion >= verTDS72 {
|
||||
binary.Write(buf, binary.LittleEndian, uint32(col.UserType)) // usertype, always 0?
|
||||
} else {
|
||||
binary.Write(buf, binary.LittleEndian, uint16(col.UserType))
|
||||
}
|
||||
binary.Write(buf, binary.LittleEndian, uint16(col.Flags))
|
||||
|
||||
writeTypeInfo(buf, &b.bulkColumns[i].ti)
|
||||
|
||||
if col.ti.TypeId == typeNText ||
|
||||
col.ti.TypeId == typeText ||
|
||||
col.ti.TypeId == typeImage {
|
||||
|
||||
tablename_ucs2 := str2ucs2(b.tablename)
|
||||
binary.Write(buf, binary.LittleEndian, uint16(len(tablename_ucs2)/2))
|
||||
buf.Write(tablename_ucs2)
|
||||
}
|
||||
colname_ucs2 := str2ucs2(col.ColName)
|
||||
buf.WriteByte(uint8(len(colname_ucs2) / 2))
|
||||
buf.Write(colname_ucs2)
|
||||
}
|
||||
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
func (b *Bulk) getMetadata(ctx context.Context) (err error) {
|
||||
stmt, err := b.cn.prepareContext(ctx, "SET FMTONLY ON")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = stmt.ExecContext(ctx, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Get columns info.
|
||||
stmt, err = b.cn.prepareContext(ctx, fmt.Sprintf("select * from %s SET FMTONLY OFF", b.tablename))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rows, err := stmt.QueryContext(ctx, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get columns info failed: %v", err)
|
||||
}
|
||||
b.metadata = rows.(*Rows).cols
|
||||
|
||||
if b.Debug {
|
||||
for _, col := range b.metadata {
|
||||
b.dlogf("col: %s typeId: %#x size: %d scale: %d prec: %d flags: %d lcid: %#x\n",
|
||||
col.ColName, col.ti.TypeId, col.ti.Size, col.ti.Scale, col.ti.Prec,
|
||||
col.Flags, col.ti.Collation.LcidAndFlags)
|
||||
}
|
||||
}
|
||||
|
||||
return rows.Close()
|
||||
}
|
||||
|
||||
func (b *Bulk) makeParam(val DataValue, col columnStruct) (res Param, err error) {
|
||||
res.ti.Size = col.ti.Size
|
||||
res.ti.TypeId = col.ti.TypeId
|
||||
|
||||
if val == nil {
|
||||
res.ti.Size = 0
|
||||
return
|
||||
}
|
||||
|
||||
switch col.ti.TypeId {
|
||||
|
||||
case typeInt1, typeInt2, typeInt4, typeInt8, typeIntN:
|
||||
var intvalue int64
|
||||
|
||||
switch val := val.(type) {
|
||||
case int:
|
||||
intvalue = int64(val)
|
||||
case int32:
|
||||
intvalue = int64(val)
|
||||
case int64:
|
||||
intvalue = val
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for int column")
|
||||
return
|
||||
}
|
||||
|
||||
res.buffer = make([]byte, res.ti.Size)
|
||||
if col.ti.Size == 1 {
|
||||
res.buffer[0] = byte(intvalue)
|
||||
} else if col.ti.Size == 2 {
|
||||
binary.LittleEndian.PutUint16(res.buffer, uint16(intvalue))
|
||||
} else if col.ti.Size == 4 {
|
||||
binary.LittleEndian.PutUint32(res.buffer, uint32(intvalue))
|
||||
} else if col.ti.Size == 8 {
|
||||
binary.LittleEndian.PutUint64(res.buffer, uint64(intvalue))
|
||||
}
|
||||
case typeFlt4, typeFlt8, typeFltN:
|
||||
var floatvalue float64
|
||||
|
||||
switch val := val.(type) {
|
||||
case float32:
|
||||
floatvalue = float64(val)
|
||||
case float64:
|
||||
floatvalue = val
|
||||
case int:
|
||||
floatvalue = float64(val)
|
||||
case int64:
|
||||
floatvalue = float64(val)
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for float column: %s", val)
|
||||
return
|
||||
}
|
||||
|
||||
if col.ti.Size == 4 {
|
||||
res.buffer = make([]byte, 4)
|
||||
binary.LittleEndian.PutUint32(res.buffer, math.Float32bits(float32(floatvalue)))
|
||||
} else if col.ti.Size == 8 {
|
||||
res.buffer = make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(res.buffer, math.Float64bits(floatvalue))
|
||||
}
|
||||
case typeNVarChar, typeNText, typeNChar:
|
||||
|
||||
switch val := val.(type) {
|
||||
case string:
|
||||
res.buffer = str2ucs2(val)
|
||||
case []byte:
|
||||
res.buffer = val
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for nvarchar column: %s", val)
|
||||
return
|
||||
}
|
||||
res.ti.Size = len(res.buffer)
|
||||
|
||||
case typeVarChar, typeBigVarChar, typeText, typeChar, typeBigChar:
|
||||
switch val := val.(type) {
|
||||
case string:
|
||||
res.buffer = []byte(val)
|
||||
case []byte:
|
||||
res.buffer = val
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for varchar column: %s", val)
|
||||
return
|
||||
}
|
||||
res.ti.Size = len(res.buffer)
|
||||
|
||||
case typeBit, typeBitN:
|
||||
if reflect.TypeOf(val).Kind() != reflect.Bool {
|
||||
err = fmt.Errorf("mssql: invalid type for bit column: %s", val)
|
||||
return
|
||||
}
|
||||
res.ti.TypeId = typeBitN
|
||||
res.ti.Size = 1
|
||||
res.buffer = make([]byte, 1)
|
||||
if val.(bool) {
|
||||
res.buffer[0] = 1
|
||||
}
|
||||
|
||||
case typeDateTime2N, typeDateTimeOffsetN:
|
||||
switch val := val.(type) {
|
||||
case time.Time:
|
||||
days, ns := dateTime2(val)
|
||||
ns /= int64(math.Pow10(int(col.ti.Scale)*-1) * 1000000000)
|
||||
|
||||
var data = make([]byte, 5)
|
||||
|
||||
data[0] = byte(ns)
|
||||
data[1] = byte(ns >> 8)
|
||||
data[2] = byte(ns >> 16)
|
||||
data[3] = byte(ns >> 24)
|
||||
data[4] = byte(ns >> 32)
|
||||
|
||||
if col.ti.Scale <= 2 {
|
||||
res.ti.Size = 6
|
||||
} else if col.ti.Scale <= 4 {
|
||||
res.ti.Size = 7
|
||||
} else {
|
||||
res.ti.Size = 8
|
||||
}
|
||||
var buf []byte
|
||||
buf = make([]byte, res.ti.Size)
|
||||
copy(buf, data[0:res.ti.Size-3])
|
||||
|
||||
buf[res.ti.Size-3] = byte(days)
|
||||
buf[res.ti.Size-2] = byte(days >> 8)
|
||||
buf[res.ti.Size-1] = byte(days >> 16)
|
||||
|
||||
if col.ti.TypeId == typeDateTimeOffsetN {
|
||||
_, offset := val.Zone()
|
||||
var offsetMinute = uint16(offset / 60)
|
||||
buf = append(buf, byte(offsetMinute))
|
||||
buf = append(buf, byte(offsetMinute>>8))
|
||||
res.ti.Size = res.ti.Size + 2
|
||||
}
|
||||
|
||||
res.buffer = buf
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for datetime2 column: %s", val)
|
||||
return
|
||||
}
|
||||
case typeDateN:
|
||||
switch val := val.(type) {
|
||||
case time.Time:
|
||||
days, _ := dateTime2(val)
|
||||
|
||||
res.ti.Size = 3
|
||||
res.buffer = make([]byte, 3)
|
||||
res.buffer[0] = byte(days)
|
||||
res.buffer[1] = byte(days >> 8)
|
||||
res.buffer[2] = byte(days >> 16)
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for date column: %s", val)
|
||||
return
|
||||
}
|
||||
case typeDateTime, typeDateTimeN, typeDateTim4:
|
||||
switch val := val.(type) {
|
||||
case time.Time:
|
||||
if col.ti.Size == 4 {
|
||||
res.ti.Size = 4
|
||||
res.buffer = make([]byte, 4)
|
||||
|
||||
ref := time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
dur := val.Sub(ref)
|
||||
days := dur / (24 * time.Hour)
|
||||
if days < 0 {
|
||||
err = fmt.Errorf("mssql: Date %s is out of range", val)
|
||||
return
|
||||
}
|
||||
mins := val.Hour()*60 + val.Minute()
|
||||
|
||||
binary.LittleEndian.PutUint16(res.buffer[0:2], uint16(days))
|
||||
binary.LittleEndian.PutUint16(res.buffer[2:4], uint16(mins))
|
||||
} else if col.ti.Size == 8 {
|
||||
res.ti.Size = 8
|
||||
res.buffer = make([]byte, 8)
|
||||
|
||||
days := divFloor(val.Unix(), 24*60*60)
|
||||
//25567 - number of days since Jan 1 1900 UTC to Jan 1 1970
|
||||
days = days + 25567
|
||||
tm := (val.Hour()*60*60+val.Minute()*60+val.Second())*300 + int(val.Nanosecond()/10000000*3)
|
||||
|
||||
binary.LittleEndian.PutUint32(res.buffer[0:4], uint32(days))
|
||||
binary.LittleEndian.PutUint32(res.buffer[4:8], uint32(tm))
|
||||
} else {
|
||||
err = fmt.Errorf("mssql: invalid size of column")
|
||||
}
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for datetime column: %s", val)
|
||||
}
|
||||
|
||||
// case typeMoney, typeMoney4, typeMoneyN:
|
||||
case typeDecimal, typeDecimalN, typeNumeric, typeNumericN:
|
||||
var value float64
|
||||
switch v := val.(type) {
|
||||
case int:
|
||||
value = float64(v)
|
||||
case int8:
|
||||
value = float64(v)
|
||||
case int16:
|
||||
value = float64(v)
|
||||
case int32:
|
||||
value = float64(v)
|
||||
case int64:
|
||||
value = float64(v)
|
||||
case float32:
|
||||
value = float64(v)
|
||||
case float64:
|
||||
value = v
|
||||
case string:
|
||||
if value, err = strconv.ParseFloat(v, 64); err != nil {
|
||||
return res, fmt.Errorf("bulk: unable to convert string to float: %v", err)
|
||||
}
|
||||
default:
|
||||
return res, fmt.Errorf("unknown value for decimal: %#v", v)
|
||||
}
|
||||
|
||||
perc := col.ti.Prec
|
||||
scale := col.ti.Scale
|
||||
var dec Decimal
|
||||
dec, err = Float64ToDecimalScale(value, scale)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
dec.prec = perc
|
||||
|
||||
var length byte
|
||||
switch {
|
||||
case perc <= 9:
|
||||
length = 4
|
||||
case perc <= 19:
|
||||
length = 8
|
||||
case perc <= 28:
|
||||
length = 12
|
||||
default:
|
||||
length = 16
|
||||
}
|
||||
|
||||
buf := make([]byte, length+1)
|
||||
// first byte length written by typeInfo.writer
|
||||
res.ti.Size = int(length) + 1
|
||||
// second byte sign
|
||||
if value < 0 {
|
||||
buf[0] = 0
|
||||
} else {
|
||||
buf[0] = 1
|
||||
}
|
||||
|
||||
ub := dec.UnscaledBytes()
|
||||
l := len(ub)
|
||||
if l > int(length) {
|
||||
err = fmt.Errorf("decimal out of range: %s", dec)
|
||||
return res, err
|
||||
}
|
||||
// reverse the bytes
|
||||
for i, j := 1, l-1; j >= 0; i, j = i+1, j-1 {
|
||||
buf[i] = ub[j]
|
||||
}
|
||||
res.buffer = buf
|
||||
case typeBigVarBin:
|
||||
switch val := val.(type) {
|
||||
case []byte:
|
||||
res.ti.Size = len(val)
|
||||
res.buffer = val
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for Binary column: %s", val)
|
||||
return
|
||||
}
|
||||
case typeGuid:
|
||||
switch val := val.(type) {
|
||||
case []byte:
|
||||
res.ti.Size = len(val)
|
||||
res.buffer = val
|
||||
default:
|
||||
err = fmt.Errorf("mssql: invalid type for Guid column: %s", val)
|
||||
return
|
||||
}
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("mssql: type %x not implemented", col.ti.TypeId)
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func (b *Bulk) dlogf(format string, v ...interface{}) {
|
||||
if b.Debug {
|
||||
b.cn.sess.log.Printf(format, v...)
|
||||
}
|
||||
}
|
93
vendor/github.com/denisenkom/go-mssqldb/bulkcopy_sql.go
generated
vendored
Normal file
93
vendor/github.com/denisenkom/go-mssqldb/bulkcopy_sql.go
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type copyin struct {
|
||||
cn *Conn
|
||||
bulkcopy *Bulk
|
||||
closed bool
|
||||
}
|
||||
|
||||
type serializableBulkConfig struct {
|
||||
TableName string
|
||||
ColumnsName []string
|
||||
Options BulkOptions
|
||||
}
|
||||
|
||||
func (d *Driver) OpenConnection(dsn string) (*Conn, error) {
|
||||
return d.open(context.Background(), dsn)
|
||||
}
|
||||
|
||||
func (c *Conn) prepareCopyIn(ctx context.Context, query string) (_ driver.Stmt, err error) {
|
||||
config_json := query[11:]
|
||||
|
||||
bulkconfig := serializableBulkConfig{}
|
||||
err = json.Unmarshal([]byte(config_json), &bulkconfig)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
bulkcopy := c.CreateBulkContext(ctx, bulkconfig.TableName, bulkconfig.ColumnsName)
|
||||
bulkcopy.Options = bulkconfig.Options
|
||||
|
||||
ci := ©in{
|
||||
cn: c,
|
||||
bulkcopy: bulkcopy,
|
||||
}
|
||||
|
||||
return ci, nil
|
||||
}
|
||||
|
||||
func CopyIn(table string, options BulkOptions, columns ...string) string {
|
||||
bulkconfig := &serializableBulkConfig{TableName: table, Options: options, ColumnsName: columns}
|
||||
|
||||
config_json, err := json.Marshal(bulkconfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
stmt := "INSERTBULK " + string(config_json)
|
||||
|
||||
return stmt
|
||||
}
|
||||
|
||||
func (ci *copyin) NumInput() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (ci *copyin) Query(v []driver.Value) (r driver.Rows, err error) {
|
||||
panic("should never be called")
|
||||
}
|
||||
|
||||
func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {
|
||||
if ci.closed {
|
||||
return nil, errors.New("errCopyInClosed")
|
||||
}
|
||||
|
||||
if len(v) == 0 {
|
||||
rowCount, err := ci.bulkcopy.Done()
|
||||
ci.closed = true
|
||||
return driver.RowsAffected(rowCount), err
|
||||
}
|
||||
|
||||
t := make([]interface{}, len(v))
|
||||
for i, val := range v {
|
||||
t[i] = val
|
||||
}
|
||||
|
||||
err = ci.bulkcopy.AddRow(t)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return driver.RowsAffected(0), nil
|
||||
}
|
||||
|
||||
func (ci *copyin) Close() (err error) {
|
||||
return nil
|
||||
}
|
131
vendor/github.com/denisenkom/go-mssqldb/decimal.go
generated
vendored
Normal file
131
vendor/github.com/denisenkom/go-mssqldb/decimal.go
generated
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"math"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/ee780893.aspx
|
||||
type Decimal struct {
|
||||
integer [4]uint32
|
||||
positive bool
|
||||
prec uint8
|
||||
scale uint8
|
||||
}
|
||||
|
||||
var scaletblflt64 [39]float64
|
||||
|
||||
func (d Decimal) ToFloat64() float64 {
|
||||
val := float64(0)
|
||||
for i := 3; i >= 0; i-- {
|
||||
val *= 0x100000000
|
||||
val += float64(d.integer[i])
|
||||
}
|
||||
if !d.positive {
|
||||
val = -val
|
||||
}
|
||||
if d.scale != 0 {
|
||||
val /= scaletblflt64[d.scale]
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
const autoScale = 100
|
||||
|
||||
func Float64ToDecimal(f float64) (Decimal, error) {
|
||||
return Float64ToDecimalScale(f, autoScale)
|
||||
}
|
||||
|
||||
func Float64ToDecimalScale(f float64, scale uint8) (Decimal, error) {
|
||||
var dec Decimal
|
||||
if math.IsNaN(f) {
|
||||
return dec, errors.New("NaN")
|
||||
}
|
||||
if math.IsInf(f, 0) {
|
||||
return dec, errors.New("Infinity can't be converted to decimal")
|
||||
}
|
||||
dec.positive = f >= 0
|
||||
if !dec.positive {
|
||||
f = math.Abs(f)
|
||||
}
|
||||
if f > 3.402823669209385e+38 {
|
||||
return dec, errors.New("Float value is out of range")
|
||||
}
|
||||
dec.prec = 20
|
||||
var integer float64
|
||||
for dec.scale = 0; dec.scale <= scale; dec.scale++ {
|
||||
integer = f * scaletblflt64[dec.scale]
|
||||
_, frac := math.Modf(integer)
|
||||
if frac == 0 && scale == autoScale {
|
||||
break
|
||||
}
|
||||
}
|
||||
for i := 0; i < 4; i++ {
|
||||
mod := math.Mod(integer, 0x100000000)
|
||||
integer -= mod
|
||||
integer /= 0x100000000
|
||||
dec.integer[i] = uint32(mod)
|
||||
}
|
||||
return dec, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
var acc float64 = 1
|
||||
for i := 0; i <= 38; i++ {
|
||||
scaletblflt64[i] = acc
|
||||
acc *= 10
|
||||
}
|
||||
}
|
||||
|
||||
func (d Decimal) BigInt() big.Int {
|
||||
bytes := make([]byte, 16)
|
||||
binary.BigEndian.PutUint32(bytes[0:4], d.integer[3])
|
||||
binary.BigEndian.PutUint32(bytes[4:8], d.integer[2])
|
||||
binary.BigEndian.PutUint32(bytes[8:12], d.integer[1])
|
||||
binary.BigEndian.PutUint32(bytes[12:16], d.integer[0])
|
||||
var x big.Int
|
||||
x.SetBytes(bytes)
|
||||
if !d.positive {
|
||||
x.Neg(&x)
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
func (d Decimal) Bytes() []byte {
|
||||
x := d.BigInt()
|
||||
return scaleBytes(x.String(), d.scale)
|
||||
}
|
||||
|
||||
func (d Decimal) UnscaledBytes() []byte {
|
||||
x := d.BigInt()
|
||||
return x.Bytes()
|
||||
}
|
||||
|
||||
func scaleBytes(s string, scale uint8) []byte {
|
||||
z := make([]byte, 0, len(s)+1)
|
||||
if s[0] == '-' || s[0] == '+' {
|
||||
z = append(z, byte(s[0]))
|
||||
s = s[1:]
|
||||
}
|
||||
pos := len(s) - int(scale)
|
||||
if pos <= 0 {
|
||||
z = append(z, byte('0'))
|
||||
} else if pos > 0 {
|
||||
z = append(z, []byte(s[:pos])...)
|
||||
}
|
||||
if scale > 0 {
|
||||
z = append(z, byte('.'))
|
||||
for pos < 0 {
|
||||
z = append(z, byte('0'))
|
||||
pos++
|
||||
}
|
||||
z = append(z, []byte(s[pos:])...)
|
||||
}
|
||||
return z
|
||||
}
|
||||
|
||||
func (d Decimal) String() string {
|
||||
return string(d.Bytes())
|
||||
}
|
12
vendor/github.com/denisenkom/go-mssqldb/doc.go
generated
vendored
Normal file
12
vendor/github.com/denisenkom/go-mssqldb/doc.go
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// package mssql implements the TDS protocol used to connect to MS SQL Server (sqlserver)
|
||||
// database servers.
|
||||
//
|
||||
// This package registers two drivers:
|
||||
// sqlserver: uses native "@" parameter placeholder names and does no pre-processing.
|
||||
// mssql: expects identifiers to be prefixed with ":" and pre-processes queries.
|
||||
//
|
||||
// If the ordinal position is used for query parameters, identifiers will be named
|
||||
// "@p1", "@p2", ... "@pN".
|
||||
//
|
||||
// Please refer to the README for the format of the DSN.
|
||||
package mssql
|
73
vendor/github.com/denisenkom/go-mssqldb/error.go
generated
vendored
Normal file
73
vendor/github.com/denisenkom/go-mssqldb/error.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
package mssql
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Error represents an SQL Server error. This
|
||||
// type includes methods for reading the contents
|
||||
// of the struct, which allows calling programs
|
||||
// to check for specific error conditions without
|
||||
// having to import this package directly.
|
||||
type Error struct {
|
||||
Number int32
|
||||
State uint8
|
||||
Class uint8
|
||||
Message string
|
||||
ServerName string
|
||||
ProcName string
|
||||
LineNo int32
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
return "mssql: " + e.Message
|
||||
}
|
||||
|
||||
// SQLErrorNumber returns the SQL Server error number.
|
||||
func (e Error) SQLErrorNumber() int32 {
|
||||
return e.Number
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorState() uint8 {
|
||||
return e.State
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorClass() uint8 {
|
||||
return e.Class
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorMessage() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorServerName() string {
|
||||
return e.ServerName
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorProcName() string {
|
||||
return e.ProcName
|
||||
}
|
||||
|
||||
func (e Error) SQLErrorLineNo() int32 {
|
||||
return e.LineNo
|
||||
}
|
||||
|
||||
type StreamError struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e StreamError) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
func streamErrorf(format string, v ...interface{}) StreamError {
|
||||
return StreamError{"Invalid TDS stream: " + fmt.Sprintf(format, v...)}
|
||||
}
|
||||
|
||||
func badStreamPanic(err error) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
func badStreamPanicf(format string, v ...interface{}) {
|
||||
panic(streamErrorf(format, v...))
|
||||
}
|
113
vendor/github.com/denisenkom/go-mssqldb/internal/cp/charset.go
generated
vendored
Normal file
113
vendor/github.com/denisenkom/go-mssqldb/internal/cp/charset.go
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
package cp
|
||||
|
||||
type charsetMap struct {
|
||||
sb [256]rune // single byte runes, -1 for a double byte character lead byte
|
||||
db map[int]rune // double byte runes
|
||||
}
|
||||
|
||||
func collation2charset(col Collation) *charsetMap {
|
||||
// http://msdn.microsoft.com/en-us/library/ms144250.aspx
|
||||
// http://msdn.microsoft.com/en-us/library/ms144250(v=sql.105).aspx
|
||||
switch col.SortId {
|
||||
case 30, 31, 32, 33, 34:
|
||||
return cp437
|
||||
case 40, 41, 42, 44, 49, 55, 56, 57, 58, 59, 60, 61:
|
||||
return cp850
|
||||
case 50, 51, 52, 53, 54, 71, 72, 73, 74, 75:
|
||||
return cp1252
|
||||
case 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96:
|
||||
return cp1250
|
||||
case 104, 105, 106, 107, 108:
|
||||
return cp1251
|
||||
case 112, 113, 114, 121, 124:
|
||||
return cp1253
|
||||
case 128, 129, 130:
|
||||
return cp1254
|
||||
case 136, 137, 138:
|
||||
return cp1255
|
||||
case 144, 145, 146:
|
||||
return cp1256
|
||||
case 152, 153, 154, 155, 156, 157, 158, 159, 160:
|
||||
return cp1257
|
||||
case 183, 184, 185, 186:
|
||||
return cp1252
|
||||
case 192, 193:
|
||||
return cp932
|
||||
case 194, 195:
|
||||
return cp949
|
||||
case 196, 197:
|
||||
return cp950
|
||||
case 198, 199:
|
||||
return cp936
|
||||
case 200:
|
||||
return cp932
|
||||
case 201:
|
||||
return cp949
|
||||
case 202:
|
||||
return cp950
|
||||
case 203:
|
||||
return cp936
|
||||
case 204, 205, 206:
|
||||
return cp874
|
||||
case 210, 211, 212, 213, 214, 215, 216, 217:
|
||||
return cp1252
|
||||
}
|
||||
// http://technet.microsoft.com/en-us/library/aa176553(v=sql.80).aspx
|
||||
switch col.getLcid() {
|
||||
case 0x001e, 0x041e:
|
||||
return cp874
|
||||
case 0x0411, 0x10411:
|
||||
return cp932
|
||||
case 0x0804, 0x1004, 0x20804:
|
||||
return cp936
|
||||
case 0x0012, 0x0412:
|
||||
return cp949
|
||||
case 0x0404, 0x1404, 0x0c04, 0x7c04, 0x30404:
|
||||
return cp950
|
||||
case 0x041c, 0x041a, 0x0405, 0x040e, 0x104e, 0x0415, 0x0418, 0x041b, 0x0424, 0x1040e:
|
||||
return cp1250
|
||||
case 0x0423, 0x0402, 0x042f, 0x0419, 0x081a, 0x0c1a, 0x0422, 0x043f, 0x0444, 0x082c:
|
||||
return cp1251
|
||||
case 0x0408:
|
||||
return cp1253
|
||||
case 0x041f, 0x042c, 0x0443:
|
||||
return cp1254
|
||||
case 0x040d:
|
||||
return cp1255
|
||||
case 0x0401, 0x0801, 0xc01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001, 0x0429, 0x0420:
|
||||
return cp1256
|
||||
case 0x0425, 0x0426, 0x0427, 0x0827:
|
||||
return cp1257
|
||||
case 0x042a:
|
||||
return cp1258
|
||||
case 0x0439, 0x045a, 0x0465:
|
||||
return nil
|
||||
}
|
||||
return cp1252
|
||||
}
|
||||
|
||||
func CharsetToUTF8(col Collation, s []byte) string {
|
||||
cm := collation2charset(col)
|
||||
if cm == nil {
|
||||
return string(s)
|
||||
}
|
||||
buf := make([]rune, 0, len(s))
|
||||
for i := 0; i < len(s); i++ {
|
||||
ch := cm.sb[s[i]]
|
||||
if ch == -1 {
|
||||
if i+1 == len(s) {
|
||||
ch = 0xfffd
|
||||
} else {
|
||||
n := int(s[i+1]) + (int(s[i]) << 8)
|
||||
i++
|
||||
var ok bool
|
||||
ch, ok = cm.db[n]
|
||||
if !ok {
|
||||
ch = 0xfffd
|
||||
}
|
||||
}
|
||||
}
|
||||
buf = append(buf, ch)
|
||||
}
|
||||
return string(buf)
|
||||
}
|
20
vendor/github.com/denisenkom/go-mssqldb/internal/cp/collation.go
generated
vendored
Normal file
20
vendor/github.com/denisenkom/go-mssqldb/internal/cp/collation.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
package cp
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd340437.aspx
|
||||
|
||||
type Collation struct {
|
||||
LcidAndFlags uint32
|
||||
SortId uint8
|
||||
}
|
||||
|
||||
func (c Collation) getLcid() uint32 {
|
||||
return c.LcidAndFlags & 0x000fffff
|
||||
}
|
||||
|
||||
func (c Collation) getFlags() uint32 {
|
||||
return (c.LcidAndFlags & 0x0ff00000) >> 20
|
||||
}
|
||||
|
||||
func (c Collation) getVersion() uint32 {
|
||||
return (c.LcidAndFlags & 0xf0000000) >> 28
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1250.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1250.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1250 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2030, //PER MILLE SIGN
|
||||
0x0160, //LATIN CAPITAL LETTER S WITH CARON
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x015A, //LATIN CAPITAL LETTER S WITH ACUTE
|
||||
0x0164, //LATIN CAPITAL LETTER T WITH CARON
|
||||
0x017D, //LATIN CAPITAL LETTER Z WITH CARON
|
||||
0x0179, //LATIN CAPITAL LETTER Z WITH ACUTE
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0x0161, //LATIN SMALL LETTER S WITH CARON
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x015B, //LATIN SMALL LETTER S WITH ACUTE
|
||||
0x0165, //LATIN SMALL LETTER T WITH CARON
|
||||
0x017E, //LATIN SMALL LETTER Z WITH CARON
|
||||
0x017A, //LATIN SMALL LETTER Z WITH ACUTE
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x02C7, //CARON
|
||||
0x02D8, //BREVE
|
||||
0x0141, //LATIN CAPITAL LETTER L WITH STROKE
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x0104, //LATIN CAPITAL LETTER A WITH OGONEK
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x015E, //LATIN CAPITAL LETTER S WITH CEDILLA
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x017B, //LATIN CAPITAL LETTER Z WITH DOT ABOVE
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x02DB, //OGONEK
|
||||
0x0142, //LATIN SMALL LETTER L WITH STROKE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x0105, //LATIN SMALL LETTER A WITH OGONEK
|
||||
0x015F, //LATIN SMALL LETTER S WITH CEDILLA
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x013D, //LATIN CAPITAL LETTER L WITH CARON
|
||||
0x02DD, //DOUBLE ACUTE ACCENT
|
||||
0x013E, //LATIN SMALL LETTER L WITH CARON
|
||||
0x017C, //LATIN SMALL LETTER Z WITH DOT ABOVE
|
||||
0x0154, //LATIN CAPITAL LETTER R WITH ACUTE
|
||||
0x00C1, //LATIN CAPITAL LETTER A WITH ACUTE
|
||||
0x00C2, //LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
||||
0x0102, //LATIN CAPITAL LETTER A WITH BREVE
|
||||
0x00C4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x0139, //LATIN CAPITAL LETTER L WITH ACUTE
|
||||
0x0106, //LATIN CAPITAL LETTER C WITH ACUTE
|
||||
0x00C7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x010C, //LATIN CAPITAL LETTER C WITH CARON
|
||||
0x00C9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x0118, //LATIN CAPITAL LETTER E WITH OGONEK
|
||||
0x00CB, //LATIN CAPITAL LETTER E WITH DIAERESIS
|
||||
0x011A, //LATIN CAPITAL LETTER E WITH CARON
|
||||
0x00CD, //LATIN CAPITAL LETTER I WITH ACUTE
|
||||
0x00CE, //LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
||||
0x010E, //LATIN CAPITAL LETTER D WITH CARON
|
||||
0x0110, //LATIN CAPITAL LETTER D WITH STROKE
|
||||
0x0143, //LATIN CAPITAL LETTER N WITH ACUTE
|
||||
0x0147, //LATIN CAPITAL LETTER N WITH CARON
|
||||
0x00D3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x00D4, //LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
||||
0x0150, //LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
|
||||
0x00D6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x0158, //LATIN CAPITAL LETTER R WITH CARON
|
||||
0x016E, //LATIN CAPITAL LETTER U WITH RING ABOVE
|
||||
0x00DA, //LATIN CAPITAL LETTER U WITH ACUTE
|
||||
0x0170, //LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
|
||||
0x00DC, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x00DD, //LATIN CAPITAL LETTER Y WITH ACUTE
|
||||
0x0162, //LATIN CAPITAL LETTER T WITH CEDILLA
|
||||
0x00DF, //LATIN SMALL LETTER SHARP S
|
||||
0x0155, //LATIN SMALL LETTER R WITH ACUTE
|
||||
0x00E1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00E2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x0103, //LATIN SMALL LETTER A WITH BREVE
|
||||
0x00E4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x013A, //LATIN SMALL LETTER L WITH ACUTE
|
||||
0x0107, //LATIN SMALL LETTER C WITH ACUTE
|
||||
0x00E7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x010D, //LATIN SMALL LETTER C WITH CARON
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x0119, //LATIN SMALL LETTER E WITH OGONEK
|
||||
0x00EB, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x011B, //LATIN SMALL LETTER E WITH CARON
|
||||
0x00ED, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00EE, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x010F, //LATIN SMALL LETTER D WITH CARON
|
||||
0x0111, //LATIN SMALL LETTER D WITH STROKE
|
||||
0x0144, //LATIN SMALL LETTER N WITH ACUTE
|
||||
0x0148, //LATIN SMALL LETTER N WITH CARON
|
||||
0x00F3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00F4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x0151, //LATIN SMALL LETTER O WITH DOUBLE ACUTE
|
||||
0x00F6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x0159, //LATIN SMALL LETTER R WITH CARON
|
||||
0x016F, //LATIN SMALL LETTER U WITH RING ABOVE
|
||||
0x00FA, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x0171, //LATIN SMALL LETTER U WITH DOUBLE ACUTE
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x00FD, //LATIN SMALL LETTER Y WITH ACUTE
|
||||
0x0163, //LATIN SMALL LETTER T WITH CEDILLA
|
||||
0x02D9, //DOT ABOVE
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1251.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1251.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1251 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x0402, //CYRILLIC CAPITAL LETTER DJE
|
||||
0x0403, //CYRILLIC CAPITAL LETTER GJE
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0453, //CYRILLIC SMALL LETTER GJE
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x20AC, //EURO SIGN
|
||||
0x2030, //PER MILLE SIGN
|
||||
0x0409, //CYRILLIC CAPITAL LETTER LJE
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x040A, //CYRILLIC CAPITAL LETTER NJE
|
||||
0x040C, //CYRILLIC CAPITAL LETTER KJE
|
||||
0x040B, //CYRILLIC CAPITAL LETTER TSHE
|
||||
0x040F, //CYRILLIC CAPITAL LETTER DZHE
|
||||
0x0452, //CYRILLIC SMALL LETTER DJE
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0x0459, //CYRILLIC SMALL LETTER LJE
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x045A, //CYRILLIC SMALL LETTER NJE
|
||||
0x045C, //CYRILLIC SMALL LETTER KJE
|
||||
0x045B, //CYRILLIC SMALL LETTER TSHE
|
||||
0x045F, //CYRILLIC SMALL LETTER DZHE
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x040E, //CYRILLIC CAPITAL LETTER SHORT U
|
||||
0x045E, //CYRILLIC SMALL LETTER SHORT U
|
||||
0x0408, //CYRILLIC CAPITAL LETTER JE
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x0490, //CYRILLIC CAPITAL LETTER GHE WITH UPTURN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x0401, //CYRILLIC CAPITAL LETTER IO
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x0404, //CYRILLIC CAPITAL LETTER UKRAINIAN IE
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x0407, //CYRILLIC CAPITAL LETTER YI
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x0406, //CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
|
||||
0x0456, //CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
|
||||
0x0491, //CYRILLIC SMALL LETTER GHE WITH UPTURN
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x0451, //CYRILLIC SMALL LETTER IO
|
||||
0x2116, //NUMERO SIGN
|
||||
0x0454, //CYRILLIC SMALL LETTER UKRAINIAN IE
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x0458, //CYRILLIC SMALL LETTER JE
|
||||
0x0405, //CYRILLIC CAPITAL LETTER DZE
|
||||
0x0455, //CYRILLIC SMALL LETTER DZE
|
||||
0x0457, //CYRILLIC SMALL LETTER YI
|
||||
0x0410, //CYRILLIC CAPITAL LETTER A
|
||||
0x0411, //CYRILLIC CAPITAL LETTER BE
|
||||
0x0412, //CYRILLIC CAPITAL LETTER VE
|
||||
0x0413, //CYRILLIC CAPITAL LETTER GHE
|
||||
0x0414, //CYRILLIC CAPITAL LETTER DE
|
||||
0x0415, //CYRILLIC CAPITAL LETTER IE
|
||||
0x0416, //CYRILLIC CAPITAL LETTER ZHE
|
||||
0x0417, //CYRILLIC CAPITAL LETTER ZE
|
||||
0x0418, //CYRILLIC CAPITAL LETTER I
|
||||
0x0419, //CYRILLIC CAPITAL LETTER SHORT I
|
||||
0x041A, //CYRILLIC CAPITAL LETTER KA
|
||||
0x041B, //CYRILLIC CAPITAL LETTER EL
|
||||
0x041C, //CYRILLIC CAPITAL LETTER EM
|
||||
0x041D, //CYRILLIC CAPITAL LETTER EN
|
||||
0x041E, //CYRILLIC CAPITAL LETTER O
|
||||
0x041F, //CYRILLIC CAPITAL LETTER PE
|
||||
0x0420, //CYRILLIC CAPITAL LETTER ER
|
||||
0x0421, //CYRILLIC CAPITAL LETTER ES
|
||||
0x0422, //CYRILLIC CAPITAL LETTER TE
|
||||
0x0423, //CYRILLIC CAPITAL LETTER U
|
||||
0x0424, //CYRILLIC CAPITAL LETTER EF
|
||||
0x0425, //CYRILLIC CAPITAL LETTER HA
|
||||
0x0426, //CYRILLIC CAPITAL LETTER TSE
|
||||
0x0427, //CYRILLIC CAPITAL LETTER CHE
|
||||
0x0428, //CYRILLIC CAPITAL LETTER SHA
|
||||
0x0429, //CYRILLIC CAPITAL LETTER SHCHA
|
||||
0x042A, //CYRILLIC CAPITAL LETTER HARD SIGN
|
||||
0x042B, //CYRILLIC CAPITAL LETTER YERU
|
||||
0x042C, //CYRILLIC CAPITAL LETTER SOFT SIGN
|
||||
0x042D, //CYRILLIC CAPITAL LETTER E
|
||||
0x042E, //CYRILLIC CAPITAL LETTER YU
|
||||
0x042F, //CYRILLIC CAPITAL LETTER YA
|
||||
0x0430, //CYRILLIC SMALL LETTER A
|
||||
0x0431, //CYRILLIC SMALL LETTER BE
|
||||
0x0432, //CYRILLIC SMALL LETTER VE
|
||||
0x0433, //CYRILLIC SMALL LETTER GHE
|
||||
0x0434, //CYRILLIC SMALL LETTER DE
|
||||
0x0435, //CYRILLIC SMALL LETTER IE
|
||||
0x0436, //CYRILLIC SMALL LETTER ZHE
|
||||
0x0437, //CYRILLIC SMALL LETTER ZE
|
||||
0x0438, //CYRILLIC SMALL LETTER I
|
||||
0x0439, //CYRILLIC SMALL LETTER SHORT I
|
||||
0x043A, //CYRILLIC SMALL LETTER KA
|
||||
0x043B, //CYRILLIC SMALL LETTER EL
|
||||
0x043C, //CYRILLIC SMALL LETTER EM
|
||||
0x043D, //CYRILLIC SMALL LETTER EN
|
||||
0x043E, //CYRILLIC SMALL LETTER O
|
||||
0x043F, //CYRILLIC SMALL LETTER PE
|
||||
0x0440, //CYRILLIC SMALL LETTER ER
|
||||
0x0441, //CYRILLIC SMALL LETTER ES
|
||||
0x0442, //CYRILLIC SMALL LETTER TE
|
||||
0x0443, //CYRILLIC SMALL LETTER U
|
||||
0x0444, //CYRILLIC SMALL LETTER EF
|
||||
0x0445, //CYRILLIC SMALL LETTER HA
|
||||
0x0446, //CYRILLIC SMALL LETTER TSE
|
||||
0x0447, //CYRILLIC SMALL LETTER CHE
|
||||
0x0448, //CYRILLIC SMALL LETTER SHA
|
||||
0x0449, //CYRILLIC SMALL LETTER SHCHA
|
||||
0x044A, //CYRILLIC SMALL LETTER HARD SIGN
|
||||
0x044B, //CYRILLIC SMALL LETTER YERU
|
||||
0x044C, //CYRILLIC SMALL LETTER SOFT SIGN
|
||||
0x044D, //CYRILLIC SMALL LETTER E
|
||||
0x044E, //CYRILLIC SMALL LETTER YU
|
||||
0x044F, //CYRILLIC SMALL LETTER YA
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1252.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1252.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1252 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x02C6, //MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0x2030, //PER MILLE SIGN
|
||||
0x0160, //LATIN CAPITAL LETTER S WITH CARON
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x0152, //LATIN CAPITAL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0x017D, //LATIN CAPITAL LETTER Z WITH CARON
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0x02DC, //SMALL TILDE
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0x0161, //LATIN SMALL LETTER S WITH CARON
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x0153, //LATIN SMALL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0x017E, //LATIN SMALL LETTER Z WITH CARON
|
||||
0x0178, //LATIN CAPITAL LETTER Y WITH DIAERESIS
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x00A1, //INVERTED EXCLAMATION MARK
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x00AA, //FEMININE ORDINAL INDICATOR
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00AF, //MACRON
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x00BA, //MASCULINE ORDINAL INDICATOR
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00BF, //INVERTED QUESTION MARK
|
||||
0x00C0, //LATIN CAPITAL LETTER A WITH GRAVE
|
||||
0x00C1, //LATIN CAPITAL LETTER A WITH ACUTE
|
||||
0x00C2, //LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
||||
0x00C3, //LATIN CAPITAL LETTER A WITH TILDE
|
||||
0x00C4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00C5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x00C6, //LATIN CAPITAL LETTER AE
|
||||
0x00C7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x00C8, //LATIN CAPITAL LETTER E WITH GRAVE
|
||||
0x00C9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x00CA, //LATIN CAPITAL LETTER E WITH CIRCUMFLEX
|
||||
0x00CB, //LATIN CAPITAL LETTER E WITH DIAERESIS
|
||||
0x00CC, //LATIN CAPITAL LETTER I WITH GRAVE
|
||||
0x00CD, //LATIN CAPITAL LETTER I WITH ACUTE
|
||||
0x00CE, //LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
||||
0x00CF, //LATIN CAPITAL LETTER I WITH DIAERESIS
|
||||
0x00D0, //LATIN CAPITAL LETTER ETH
|
||||
0x00D1, //LATIN CAPITAL LETTER N WITH TILDE
|
||||
0x00D2, //LATIN CAPITAL LETTER O WITH GRAVE
|
||||
0x00D3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x00D4, //LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
||||
0x00D5, //LATIN CAPITAL LETTER O WITH TILDE
|
||||
0x00D6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x00D8, //LATIN CAPITAL LETTER O WITH STROKE
|
||||
0x00D9, //LATIN CAPITAL LETTER U WITH GRAVE
|
||||
0x00DA, //LATIN CAPITAL LETTER U WITH ACUTE
|
||||
0x00DB, //LATIN CAPITAL LETTER U WITH CIRCUMFLEX
|
||||
0x00DC, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x00DD, //LATIN CAPITAL LETTER Y WITH ACUTE
|
||||
0x00DE, //LATIN CAPITAL LETTER THORN
|
||||
0x00DF, //LATIN SMALL LETTER SHARP S
|
||||
0x00E0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x00E1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00E2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x00E3, //LATIN SMALL LETTER A WITH TILDE
|
||||
0x00E4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00E5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x00E6, //LATIN SMALL LETTER AE
|
||||
0x00E7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00E8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00EA, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00EB, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x00EC, //LATIN SMALL LETTER I WITH GRAVE
|
||||
0x00ED, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00EE, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00EF, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x00F0, //LATIN SMALL LETTER ETH
|
||||
0x00F1, //LATIN SMALL LETTER N WITH TILDE
|
||||
0x00F2, //LATIN SMALL LETTER O WITH GRAVE
|
||||
0x00F3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00F4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x00F5, //LATIN SMALL LETTER O WITH TILDE
|
||||
0x00F6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x00F8, //LATIN SMALL LETTER O WITH STROKE
|
||||
0x00F9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x00FA, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x00FB, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x00FD, //LATIN SMALL LETTER Y WITH ACUTE
|
||||
0x00FE, //LATIN SMALL LETTER THORN
|
||||
0x00FF, //LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1253.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1253.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1253 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2030, //PER MILLE SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x0385, //GREEK DIALYTIKA TONOS
|
||||
0x0386, //GREEK CAPITAL LETTER ALPHA WITH TONOS
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x2015, //HORIZONTAL BAR
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x0384, //GREEK TONOS
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x0388, //GREEK CAPITAL LETTER EPSILON WITH TONOS
|
||||
0x0389, //GREEK CAPITAL LETTER ETA WITH TONOS
|
||||
0x038A, //GREEK CAPITAL LETTER IOTA WITH TONOS
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x038C, //GREEK CAPITAL LETTER OMICRON WITH TONOS
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x038E, //GREEK CAPITAL LETTER UPSILON WITH TONOS
|
||||
0x038F, //GREEK CAPITAL LETTER OMEGA WITH TONOS
|
||||
0x0390, //GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
|
||||
0x0391, //GREEK CAPITAL LETTER ALPHA
|
||||
0x0392, //GREEK CAPITAL LETTER BETA
|
||||
0x0393, //GREEK CAPITAL LETTER GAMMA
|
||||
0x0394, //GREEK CAPITAL LETTER DELTA
|
||||
0x0395, //GREEK CAPITAL LETTER EPSILON
|
||||
0x0396, //GREEK CAPITAL LETTER ZETA
|
||||
0x0397, //GREEK CAPITAL LETTER ETA
|
||||
0x0398, //GREEK CAPITAL LETTER THETA
|
||||
0x0399, //GREEK CAPITAL LETTER IOTA
|
||||
0x039A, //GREEK CAPITAL LETTER KAPPA
|
||||
0x039B, //GREEK CAPITAL LETTER LAMDA
|
||||
0x039C, //GREEK CAPITAL LETTER MU
|
||||
0x039D, //GREEK CAPITAL LETTER NU
|
||||
0x039E, //GREEK CAPITAL LETTER XI
|
||||
0x039F, //GREEK CAPITAL LETTER OMICRON
|
||||
0x03A0, //GREEK CAPITAL LETTER PI
|
||||
0x03A1, //GREEK CAPITAL LETTER RHO
|
||||
0xFFFD, //UNDEFINED
|
||||
0x03A3, //GREEK CAPITAL LETTER SIGMA
|
||||
0x03A4, //GREEK CAPITAL LETTER TAU
|
||||
0x03A5, //GREEK CAPITAL LETTER UPSILON
|
||||
0x03A6, //GREEK CAPITAL LETTER PHI
|
||||
0x03A7, //GREEK CAPITAL LETTER CHI
|
||||
0x03A8, //GREEK CAPITAL LETTER PSI
|
||||
0x03A9, //GREEK CAPITAL LETTER OMEGA
|
||||
0x03AA, //GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
|
||||
0x03AB, //GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
|
||||
0x03AC, //GREEK SMALL LETTER ALPHA WITH TONOS
|
||||
0x03AD, //GREEK SMALL LETTER EPSILON WITH TONOS
|
||||
0x03AE, //GREEK SMALL LETTER ETA WITH TONOS
|
||||
0x03AF, //GREEK SMALL LETTER IOTA WITH TONOS
|
||||
0x03B0, //GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
|
||||
0x03B1, //GREEK SMALL LETTER ALPHA
|
||||
0x03B2, //GREEK SMALL LETTER BETA
|
||||
0x03B3, //GREEK SMALL LETTER GAMMA
|
||||
0x03B4, //GREEK SMALL LETTER DELTA
|
||||
0x03B5, //GREEK SMALL LETTER EPSILON
|
||||
0x03B6, //GREEK SMALL LETTER ZETA
|
||||
0x03B7, //GREEK SMALL LETTER ETA
|
||||
0x03B8, //GREEK SMALL LETTER THETA
|
||||
0x03B9, //GREEK SMALL LETTER IOTA
|
||||
0x03BA, //GREEK SMALL LETTER KAPPA
|
||||
0x03BB, //GREEK SMALL LETTER LAMDA
|
||||
0x03BC, //GREEK SMALL LETTER MU
|
||||
0x03BD, //GREEK SMALL LETTER NU
|
||||
0x03BE, //GREEK SMALL LETTER XI
|
||||
0x03BF, //GREEK SMALL LETTER OMICRON
|
||||
0x03C0, //GREEK SMALL LETTER PI
|
||||
0x03C1, //GREEK SMALL LETTER RHO
|
||||
0x03C2, //GREEK SMALL LETTER FINAL SIGMA
|
||||
0x03C3, //GREEK SMALL LETTER SIGMA
|
||||
0x03C4, //GREEK SMALL LETTER TAU
|
||||
0x03C5, //GREEK SMALL LETTER UPSILON
|
||||
0x03C6, //GREEK SMALL LETTER PHI
|
||||
0x03C7, //GREEK SMALL LETTER CHI
|
||||
0x03C8, //GREEK SMALL LETTER PSI
|
||||
0x03C9, //GREEK SMALL LETTER OMEGA
|
||||
0x03CA, //GREEK SMALL LETTER IOTA WITH DIALYTIKA
|
||||
0x03CB, //GREEK SMALL LETTER UPSILON WITH DIALYTIKA
|
||||
0x03CC, //GREEK SMALL LETTER OMICRON WITH TONOS
|
||||
0x03CD, //GREEK SMALL LETTER UPSILON WITH TONOS
|
||||
0x03CE, //GREEK SMALL LETTER OMEGA WITH TONOS
|
||||
0xFFFD, //UNDEFINED
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1254.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1254.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1254 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x02C6, //MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0x2030, //PER MILLE SIGN
|
||||
0x0160, //LATIN CAPITAL LETTER S WITH CARON
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x0152, //LATIN CAPITAL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0x02DC, //SMALL TILDE
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0x0161, //LATIN SMALL LETTER S WITH CARON
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x0153, //LATIN SMALL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x0178, //LATIN CAPITAL LETTER Y WITH DIAERESIS
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x00A1, //INVERTED EXCLAMATION MARK
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x00AA, //FEMININE ORDINAL INDICATOR
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00AF, //MACRON
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x00BA, //MASCULINE ORDINAL INDICATOR
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00BF, //INVERTED QUESTION MARK
|
||||
0x00C0, //LATIN CAPITAL LETTER A WITH GRAVE
|
||||
0x00C1, //LATIN CAPITAL LETTER A WITH ACUTE
|
||||
0x00C2, //LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
||||
0x00C3, //LATIN CAPITAL LETTER A WITH TILDE
|
||||
0x00C4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00C5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x00C6, //LATIN CAPITAL LETTER AE
|
||||
0x00C7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x00C8, //LATIN CAPITAL LETTER E WITH GRAVE
|
||||
0x00C9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x00CA, //LATIN CAPITAL LETTER E WITH CIRCUMFLEX
|
||||
0x00CB, //LATIN CAPITAL LETTER E WITH DIAERESIS
|
||||
0x00CC, //LATIN CAPITAL LETTER I WITH GRAVE
|
||||
0x00CD, //LATIN CAPITAL LETTER I WITH ACUTE
|
||||
0x00CE, //LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
||||
0x00CF, //LATIN CAPITAL LETTER I WITH DIAERESIS
|
||||
0x011E, //LATIN CAPITAL LETTER G WITH BREVE
|
||||
0x00D1, //LATIN CAPITAL LETTER N WITH TILDE
|
||||
0x00D2, //LATIN CAPITAL LETTER O WITH GRAVE
|
||||
0x00D3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x00D4, //LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
||||
0x00D5, //LATIN CAPITAL LETTER O WITH TILDE
|
||||
0x00D6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x00D8, //LATIN CAPITAL LETTER O WITH STROKE
|
||||
0x00D9, //LATIN CAPITAL LETTER U WITH GRAVE
|
||||
0x00DA, //LATIN CAPITAL LETTER U WITH ACUTE
|
||||
0x00DB, //LATIN CAPITAL LETTER U WITH CIRCUMFLEX
|
||||
0x00DC, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x0130, //LATIN CAPITAL LETTER I WITH DOT ABOVE
|
||||
0x015E, //LATIN CAPITAL LETTER S WITH CEDILLA
|
||||
0x00DF, //LATIN SMALL LETTER SHARP S
|
||||
0x00E0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x00E1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00E2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x00E3, //LATIN SMALL LETTER A WITH TILDE
|
||||
0x00E4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00E5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x00E6, //LATIN SMALL LETTER AE
|
||||
0x00E7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00E8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00EA, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00EB, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x00EC, //LATIN SMALL LETTER I WITH GRAVE
|
||||
0x00ED, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00EE, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00EF, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x011F, //LATIN SMALL LETTER G WITH BREVE
|
||||
0x00F1, //LATIN SMALL LETTER N WITH TILDE
|
||||
0x00F2, //LATIN SMALL LETTER O WITH GRAVE
|
||||
0x00F3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00F4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x00F5, //LATIN SMALL LETTER O WITH TILDE
|
||||
0x00F6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x00F8, //LATIN SMALL LETTER O WITH STROKE
|
||||
0x00F9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x00FA, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x00FB, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x0131, //LATIN SMALL LETTER DOTLESS I
|
||||
0x015F, //LATIN SMALL LETTER S WITH CEDILLA
|
||||
0x00FF, //LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1255.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1255.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1255 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x02C6, //MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0x2030, //PER MILLE SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0x02DC, //SMALL TILDE
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x00A1, //INVERTED EXCLAMATION MARK
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x20AA, //NEW SHEQEL SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00AF, //MACRON
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00BF, //INVERTED QUESTION MARK
|
||||
0x05B0, //HEBREW POINT SHEVA
|
||||
0x05B1, //HEBREW POINT HATAF SEGOL
|
||||
0x05B2, //HEBREW POINT HATAF PATAH
|
||||
0x05B3, //HEBREW POINT HATAF QAMATS
|
||||
0x05B4, //HEBREW POINT HIRIQ
|
||||
0x05B5, //HEBREW POINT TSERE
|
||||
0x05B6, //HEBREW POINT SEGOL
|
||||
0x05B7, //HEBREW POINT PATAH
|
||||
0x05B8, //HEBREW POINT QAMATS
|
||||
0x05B9, //HEBREW POINT HOLAM
|
||||
0xFFFD, //UNDEFINED
|
||||
0x05BB, //HEBREW POINT QUBUTS
|
||||
0x05BC, //HEBREW POINT DAGESH OR MAPIQ
|
||||
0x05BD, //HEBREW POINT METEG
|
||||
0x05BE, //HEBREW PUNCTUATION MAQAF
|
||||
0x05BF, //HEBREW POINT RAFE
|
||||
0x05C0, //HEBREW PUNCTUATION PASEQ
|
||||
0x05C1, //HEBREW POINT SHIN DOT
|
||||
0x05C2, //HEBREW POINT SIN DOT
|
||||
0x05C3, //HEBREW PUNCTUATION SOF PASUQ
|
||||
0x05F0, //HEBREW LIGATURE YIDDISH DOUBLE VAV
|
||||
0x05F1, //HEBREW LIGATURE YIDDISH VAV YOD
|
||||
0x05F2, //HEBREW LIGATURE YIDDISH DOUBLE YOD
|
||||
0x05F3, //HEBREW PUNCTUATION GERESH
|
||||
0x05F4, //HEBREW PUNCTUATION GERSHAYIM
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x05D0, //HEBREW LETTER ALEF
|
||||
0x05D1, //HEBREW LETTER BET
|
||||
0x05D2, //HEBREW LETTER GIMEL
|
||||
0x05D3, //HEBREW LETTER DALET
|
||||
0x05D4, //HEBREW LETTER HE
|
||||
0x05D5, //HEBREW LETTER VAV
|
||||
0x05D6, //HEBREW LETTER ZAYIN
|
||||
0x05D7, //HEBREW LETTER HET
|
||||
0x05D8, //HEBREW LETTER TET
|
||||
0x05D9, //HEBREW LETTER YOD
|
||||
0x05DA, //HEBREW LETTER FINAL KAF
|
||||
0x05DB, //HEBREW LETTER KAF
|
||||
0x05DC, //HEBREW LETTER LAMED
|
||||
0x05DD, //HEBREW LETTER FINAL MEM
|
||||
0x05DE, //HEBREW LETTER MEM
|
||||
0x05DF, //HEBREW LETTER FINAL NUN
|
||||
0x05E0, //HEBREW LETTER NUN
|
||||
0x05E1, //HEBREW LETTER SAMEKH
|
||||
0x05E2, //HEBREW LETTER AYIN
|
||||
0x05E3, //HEBREW LETTER FINAL PE
|
||||
0x05E4, //HEBREW LETTER PE
|
||||
0x05E5, //HEBREW LETTER FINAL TSADI
|
||||
0x05E6, //HEBREW LETTER TSADI
|
||||
0x05E7, //HEBREW LETTER QOF
|
||||
0x05E8, //HEBREW LETTER RESH
|
||||
0x05E9, //HEBREW LETTER SHIN
|
||||
0x05EA, //HEBREW LETTER TAV
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x200E, //LEFT-TO-RIGHT MARK
|
||||
0x200F, //RIGHT-TO-LEFT MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1256.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1256.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1256 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0x067E, //ARABIC LETTER PEH
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x02C6, //MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0x2030, //PER MILLE SIGN
|
||||
0x0679, //ARABIC LETTER TTEH
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x0152, //LATIN CAPITAL LIGATURE OE
|
||||
0x0686, //ARABIC LETTER TCHEH
|
||||
0x0698, //ARABIC LETTER JEH
|
||||
0x0688, //ARABIC LETTER DDAL
|
||||
0x06AF, //ARABIC LETTER GAF
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0x06A9, //ARABIC LETTER KEHEH
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0x0691, //ARABIC LETTER RREH
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x0153, //LATIN SMALL LIGATURE OE
|
||||
0x200C, //ZERO WIDTH NON-JOINER
|
||||
0x200D, //ZERO WIDTH JOINER
|
||||
0x06BA, //ARABIC LETTER NOON GHUNNA
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x060C, //ARABIC COMMA
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x06BE, //ARABIC LETTER HEH DOACHASHMEE
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00AF, //MACRON
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x061B, //ARABIC SEMICOLON
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x061F, //ARABIC QUESTION MARK
|
||||
0x06C1, //ARABIC LETTER HEH GOAL
|
||||
0x0621, //ARABIC LETTER HAMZA
|
||||
0x0622, //ARABIC LETTER ALEF WITH MADDA ABOVE
|
||||
0x0623, //ARABIC LETTER ALEF WITH HAMZA ABOVE
|
||||
0x0624, //ARABIC LETTER WAW WITH HAMZA ABOVE
|
||||
0x0625, //ARABIC LETTER ALEF WITH HAMZA BELOW
|
||||
0x0626, //ARABIC LETTER YEH WITH HAMZA ABOVE
|
||||
0x0627, //ARABIC LETTER ALEF
|
||||
0x0628, //ARABIC LETTER BEH
|
||||
0x0629, //ARABIC LETTER TEH MARBUTA
|
||||
0x062A, //ARABIC LETTER TEH
|
||||
0x062B, //ARABIC LETTER THEH
|
||||
0x062C, //ARABIC LETTER JEEM
|
||||
0x062D, //ARABIC LETTER HAH
|
||||
0x062E, //ARABIC LETTER KHAH
|
||||
0x062F, //ARABIC LETTER DAL
|
||||
0x0630, //ARABIC LETTER THAL
|
||||
0x0631, //ARABIC LETTER REH
|
||||
0x0632, //ARABIC LETTER ZAIN
|
||||
0x0633, //ARABIC LETTER SEEN
|
||||
0x0634, //ARABIC LETTER SHEEN
|
||||
0x0635, //ARABIC LETTER SAD
|
||||
0x0636, //ARABIC LETTER DAD
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x0637, //ARABIC LETTER TAH
|
||||
0x0638, //ARABIC LETTER ZAH
|
||||
0x0639, //ARABIC LETTER AIN
|
||||
0x063A, //ARABIC LETTER GHAIN
|
||||
0x0640, //ARABIC TATWEEL
|
||||
0x0641, //ARABIC LETTER FEH
|
||||
0x0642, //ARABIC LETTER QAF
|
||||
0x0643, //ARABIC LETTER KAF
|
||||
0x00E0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x0644, //ARABIC LETTER LAM
|
||||
0x00E2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x0645, //ARABIC LETTER MEEM
|
||||
0x0646, //ARABIC LETTER NOON
|
||||
0x0647, //ARABIC LETTER HEH
|
||||
0x0648, //ARABIC LETTER WAW
|
||||
0x00E7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00E8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00EA, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00EB, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x0649, //ARABIC LETTER ALEF MAKSURA
|
||||
0x064A, //ARABIC LETTER YEH
|
||||
0x00EE, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00EF, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x064B, //ARABIC FATHATAN
|
||||
0x064C, //ARABIC DAMMATAN
|
||||
0x064D, //ARABIC KASRATAN
|
||||
0x064E, //ARABIC FATHA
|
||||
0x00F4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x064F, //ARABIC DAMMA
|
||||
0x0650, //ARABIC KASRA
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x0651, //ARABIC SHADDA
|
||||
0x00F9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x0652, //ARABIC SUKUN
|
||||
0x00FB, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x200E, //LEFT-TO-RIGHT MARK
|
||||
0x200F, //RIGHT-TO-LEFT MARK
|
||||
0x06D2, //ARABIC LETTER YEH BARREE
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1257.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1257.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1257 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2030, //PER MILLE SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A8, //DIAERESIS
|
||||
0x02C7, //CARON
|
||||
0x00B8, //CEDILLA
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00AF, //MACRON
|
||||
0x02DB, //OGONEK
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00D8, //LATIN CAPITAL LETTER O WITH STROKE
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x0156, //LATIN CAPITAL LETTER R WITH CEDILLA
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00C6, //LATIN CAPITAL LETTER AE
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00F8, //LATIN SMALL LETTER O WITH STROKE
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x0157, //LATIN SMALL LETTER R WITH CEDILLA
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00E6, //LATIN SMALL LETTER AE
|
||||
0x0104, //LATIN CAPITAL LETTER A WITH OGONEK
|
||||
0x012E, //LATIN CAPITAL LETTER I WITH OGONEK
|
||||
0x0100, //LATIN CAPITAL LETTER A WITH MACRON
|
||||
0x0106, //LATIN CAPITAL LETTER C WITH ACUTE
|
||||
0x00C4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00C5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x0118, //LATIN CAPITAL LETTER E WITH OGONEK
|
||||
0x0112, //LATIN CAPITAL LETTER E WITH MACRON
|
||||
0x010C, //LATIN CAPITAL LETTER C WITH CARON
|
||||
0x00C9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x0179, //LATIN CAPITAL LETTER Z WITH ACUTE
|
||||
0x0116, //LATIN CAPITAL LETTER E WITH DOT ABOVE
|
||||
0x0122, //LATIN CAPITAL LETTER G WITH CEDILLA
|
||||
0x0136, //LATIN CAPITAL LETTER K WITH CEDILLA
|
||||
0x012A, //LATIN CAPITAL LETTER I WITH MACRON
|
||||
0x013B, //LATIN CAPITAL LETTER L WITH CEDILLA
|
||||
0x0160, //LATIN CAPITAL LETTER S WITH CARON
|
||||
0x0143, //LATIN CAPITAL LETTER N WITH ACUTE
|
||||
0x0145, //LATIN CAPITAL LETTER N WITH CEDILLA
|
||||
0x00D3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x014C, //LATIN CAPITAL LETTER O WITH MACRON
|
||||
0x00D5, //LATIN CAPITAL LETTER O WITH TILDE
|
||||
0x00D6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x0172, //LATIN CAPITAL LETTER U WITH OGONEK
|
||||
0x0141, //LATIN CAPITAL LETTER L WITH STROKE
|
||||
0x015A, //LATIN CAPITAL LETTER S WITH ACUTE
|
||||
0x016A, //LATIN CAPITAL LETTER U WITH MACRON
|
||||
0x00DC, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x017B, //LATIN CAPITAL LETTER Z WITH DOT ABOVE
|
||||
0x017D, //LATIN CAPITAL LETTER Z WITH CARON
|
||||
0x00DF, //LATIN SMALL LETTER SHARP S
|
||||
0x0105, //LATIN SMALL LETTER A WITH OGONEK
|
||||
0x012F, //LATIN SMALL LETTER I WITH OGONEK
|
||||
0x0101, //LATIN SMALL LETTER A WITH MACRON
|
||||
0x0107, //LATIN SMALL LETTER C WITH ACUTE
|
||||
0x00E4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00E5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x0119, //LATIN SMALL LETTER E WITH OGONEK
|
||||
0x0113, //LATIN SMALL LETTER E WITH MACRON
|
||||
0x010D, //LATIN SMALL LETTER C WITH CARON
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x017A, //LATIN SMALL LETTER Z WITH ACUTE
|
||||
0x0117, //LATIN SMALL LETTER E WITH DOT ABOVE
|
||||
0x0123, //LATIN SMALL LETTER G WITH CEDILLA
|
||||
0x0137, //LATIN SMALL LETTER K WITH CEDILLA
|
||||
0x012B, //LATIN SMALL LETTER I WITH MACRON
|
||||
0x013C, //LATIN SMALL LETTER L WITH CEDILLA
|
||||
0x0161, //LATIN SMALL LETTER S WITH CARON
|
||||
0x0144, //LATIN SMALL LETTER N WITH ACUTE
|
||||
0x0146, //LATIN SMALL LETTER N WITH CEDILLA
|
||||
0x00F3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x014D, //LATIN SMALL LETTER O WITH MACRON
|
||||
0x00F5, //LATIN SMALL LETTER O WITH TILDE
|
||||
0x00F6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x0173, //LATIN SMALL LETTER U WITH OGONEK
|
||||
0x0142, //LATIN SMALL LETTER L WITH STROKE
|
||||
0x015B, //LATIN SMALL LETTER S WITH ACUTE
|
||||
0x016B, //LATIN SMALL LETTER U WITH MACRON
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x017C, //LATIN SMALL LETTER Z WITH DOT ABOVE
|
||||
0x017E, //LATIN SMALL LETTER Z WITH CARON
|
||||
0x02D9, //DOT ABOVE
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1258.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp1258.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp1258 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x201A, //SINGLE LOW-9 QUOTATION MARK
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x201E, //DOUBLE LOW-9 QUOTATION MARK
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0x2020, //DAGGER
|
||||
0x2021, //DOUBLE DAGGER
|
||||
0x02C6, //MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0x2030, //PER MILLE SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2039, //SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0x0152, //LATIN CAPITAL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0x02DC, //SMALL TILDE
|
||||
0x2122, //TRADE MARK SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0x203A, //SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0x0153, //LATIN SMALL LIGATURE OE
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x0178, //LATIN CAPITAL LETTER Y WITH DIAERESIS
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x00A1, //INVERTED EXCLAMATION MARK
|
||||
0x00A2, //CENT SIGN
|
||||
0x00A3, //POUND SIGN
|
||||
0x00A4, //CURRENCY SIGN
|
||||
0x00A5, //YEN SIGN
|
||||
0x00A6, //BROKEN BAR
|
||||
0x00A7, //SECTION SIGN
|
||||
0x00A8, //DIAERESIS
|
||||
0x00A9, //COPYRIGHT SIGN
|
||||
0x00AA, //FEMININE ORDINAL INDICATOR
|
||||
0x00AB, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00AC, //NOT SIGN
|
||||
0x00AD, //SOFT HYPHEN
|
||||
0x00AE, //REGISTERED SIGN
|
||||
0x00AF, //MACRON
|
||||
0x00B0, //DEGREE SIGN
|
||||
0x00B1, //PLUS-MINUS SIGN
|
||||
0x00B2, //SUPERSCRIPT TWO
|
||||
0x00B3, //SUPERSCRIPT THREE
|
||||
0x00B4, //ACUTE ACCENT
|
||||
0x00B5, //MICRO SIGN
|
||||
0x00B6, //PILCROW SIGN
|
||||
0x00B7, //MIDDLE DOT
|
||||
0x00B8, //CEDILLA
|
||||
0x00B9, //SUPERSCRIPT ONE
|
||||
0x00BA, //MASCULINE ORDINAL INDICATOR
|
||||
0x00BB, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00BC, //VULGAR FRACTION ONE QUARTER
|
||||
0x00BD, //VULGAR FRACTION ONE HALF
|
||||
0x00BE, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00BF, //INVERTED QUESTION MARK
|
||||
0x00C0, //LATIN CAPITAL LETTER A WITH GRAVE
|
||||
0x00C1, //LATIN CAPITAL LETTER A WITH ACUTE
|
||||
0x00C2, //LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
||||
0x0102, //LATIN CAPITAL LETTER A WITH BREVE
|
||||
0x00C4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00C5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x00C6, //LATIN CAPITAL LETTER AE
|
||||
0x00C7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x00C8, //LATIN CAPITAL LETTER E WITH GRAVE
|
||||
0x00C9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x00CA, //LATIN CAPITAL LETTER E WITH CIRCUMFLEX
|
||||
0x00CB, //LATIN CAPITAL LETTER E WITH DIAERESIS
|
||||
0x0300, //COMBINING GRAVE ACCENT
|
||||
0x00CD, //LATIN CAPITAL LETTER I WITH ACUTE
|
||||
0x00CE, //LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
||||
0x00CF, //LATIN CAPITAL LETTER I WITH DIAERESIS
|
||||
0x0110, //LATIN CAPITAL LETTER D WITH STROKE
|
||||
0x00D1, //LATIN CAPITAL LETTER N WITH TILDE
|
||||
0x0309, //COMBINING HOOK ABOVE
|
||||
0x00D3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x00D4, //LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
||||
0x01A0, //LATIN CAPITAL LETTER O WITH HORN
|
||||
0x00D6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00D7, //MULTIPLICATION SIGN
|
||||
0x00D8, //LATIN CAPITAL LETTER O WITH STROKE
|
||||
0x00D9, //LATIN CAPITAL LETTER U WITH GRAVE
|
||||
0x00DA, //LATIN CAPITAL LETTER U WITH ACUTE
|
||||
0x00DB, //LATIN CAPITAL LETTER U WITH CIRCUMFLEX
|
||||
0x00DC, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x01AF, //LATIN CAPITAL LETTER U WITH HORN
|
||||
0x0303, //COMBINING TILDE
|
||||
0x00DF, //LATIN SMALL LETTER SHARP S
|
||||
0x00E0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x00E1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00E2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x0103, //LATIN SMALL LETTER A WITH BREVE
|
||||
0x00E4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00E5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x00E6, //LATIN SMALL LETTER AE
|
||||
0x00E7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00E8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00E9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00EA, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00EB, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x0301, //COMBINING ACUTE ACCENT
|
||||
0x00ED, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00EE, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00EF, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x0111, //LATIN SMALL LETTER D WITH STROKE
|
||||
0x00F1, //LATIN SMALL LETTER N WITH TILDE
|
||||
0x0323, //COMBINING DOT BELOW
|
||||
0x00F3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00F4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x01A1, //LATIN SMALL LETTER O WITH HORN
|
||||
0x00F6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00F7, //DIVISION SIGN
|
||||
0x00F8, //LATIN SMALL LETTER O WITH STROKE
|
||||
0x00F9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x00FA, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x00FB, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00FC, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x01B0, //LATIN SMALL LETTER U WITH HORN
|
||||
0x20AB, //DONG SIGN
|
||||
0x00FF, //LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp437.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp437.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp437 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000a, //LINE FEED
|
||||
0x000b, //VERTICAL TABULATION
|
||||
0x000c, //FORM FEED
|
||||
0x000d, //CARRIAGE RETURN
|
||||
0x000e, //SHIFT OUT
|
||||
0x000f, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001a, //SUBSTITUTE
|
||||
0x001b, //ESCAPE
|
||||
0x001c, //FILE SEPARATOR
|
||||
0x001d, //GROUP SEPARATOR
|
||||
0x001e, //RECORD SEPARATOR
|
||||
0x001f, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002a, //ASTERISK
|
||||
0x002b, //PLUS SIGN
|
||||
0x002c, //COMMA
|
||||
0x002d, //HYPHEN-MINUS
|
||||
0x002e, //FULL STOP
|
||||
0x002f, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003a, //COLON
|
||||
0x003b, //SEMICOLON
|
||||
0x003c, //LESS-THAN SIGN
|
||||
0x003d, //EQUALS SIGN
|
||||
0x003e, //GREATER-THAN SIGN
|
||||
0x003f, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004a, //LATIN CAPITAL LETTER J
|
||||
0x004b, //LATIN CAPITAL LETTER K
|
||||
0x004c, //LATIN CAPITAL LETTER L
|
||||
0x004d, //LATIN CAPITAL LETTER M
|
||||
0x004e, //LATIN CAPITAL LETTER N
|
||||
0x004f, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005a, //LATIN CAPITAL LETTER Z
|
||||
0x005b, //LEFT SQUARE BRACKET
|
||||
0x005c, //REVERSE SOLIDUS
|
||||
0x005d, //RIGHT SQUARE BRACKET
|
||||
0x005e, //CIRCUMFLEX ACCENT
|
||||
0x005f, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006a, //LATIN SMALL LETTER J
|
||||
0x006b, //LATIN SMALL LETTER K
|
||||
0x006c, //LATIN SMALL LETTER L
|
||||
0x006d, //LATIN SMALL LETTER M
|
||||
0x006e, //LATIN SMALL LETTER N
|
||||
0x006f, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007a, //LATIN SMALL LETTER Z
|
||||
0x007b, //LEFT CURLY BRACKET
|
||||
0x007c, //VERTICAL LINE
|
||||
0x007d, //RIGHT CURLY BRACKET
|
||||
0x007e, //TILDE
|
||||
0x007f, //DELETE
|
||||
0x00c7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x00fc, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x00e9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00e2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x00e4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00e0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x00e5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x00e7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00ea, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00eb, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x00e8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00ef, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x00ee, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00ec, //LATIN SMALL LETTER I WITH GRAVE
|
||||
0x00c4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00c5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x00c9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x00e6, //LATIN SMALL LIGATURE AE
|
||||
0x00c6, //LATIN CAPITAL LIGATURE AE
|
||||
0x00f4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x00f6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00f2, //LATIN SMALL LETTER O WITH GRAVE
|
||||
0x00fb, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00f9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x00ff, //LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
0x00d6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00dc, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x00a2, //CENT SIGN
|
||||
0x00a3, //POUND SIGN
|
||||
0x00a5, //YEN SIGN
|
||||
0x20a7, //PESETA SIGN
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x00e1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00ed, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00f3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00fa, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x00f1, //LATIN SMALL LETTER N WITH TILDE
|
||||
0x00d1, //LATIN CAPITAL LETTER N WITH TILDE
|
||||
0x00aa, //FEMININE ORDINAL INDICATOR
|
||||
0x00ba, //MASCULINE ORDINAL INDICATOR
|
||||
0x00bf, //INVERTED QUESTION MARK
|
||||
0x2310, //REVERSED NOT SIGN
|
||||
0x00ac, //NOT SIGN
|
||||
0x00bd, //VULGAR FRACTION ONE HALF
|
||||
0x00bc, //VULGAR FRACTION ONE QUARTER
|
||||
0x00a1, //INVERTED EXCLAMATION MARK
|
||||
0x00ab, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00bb, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x2591, //LIGHT SHADE
|
||||
0x2592, //MEDIUM SHADE
|
||||
0x2593, //DARK SHADE
|
||||
0x2502, //BOX DRAWINGS LIGHT VERTICAL
|
||||
0x2524, //BOX DRAWINGS LIGHT VERTICAL AND LEFT
|
||||
0x2561, //BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
|
||||
0x2562, //BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
|
||||
0x2556, //BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
|
||||
0x2555, //BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
|
||||
0x2563, //BOX DRAWINGS DOUBLE VERTICAL AND LEFT
|
||||
0x2551, //BOX DRAWINGS DOUBLE VERTICAL
|
||||
0x2557, //BOX DRAWINGS DOUBLE DOWN AND LEFT
|
||||
0x255d, //BOX DRAWINGS DOUBLE UP AND LEFT
|
||||
0x255c, //BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
|
||||
0x255b, //BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
|
||||
0x2510, //BOX DRAWINGS LIGHT DOWN AND LEFT
|
||||
0x2514, //BOX DRAWINGS LIGHT UP AND RIGHT
|
||||
0x2534, //BOX DRAWINGS LIGHT UP AND HORIZONTAL
|
||||
0x252c, //BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
|
||||
0x251c, //BOX DRAWINGS LIGHT VERTICAL AND RIGHT
|
||||
0x2500, //BOX DRAWINGS LIGHT HORIZONTAL
|
||||
0x253c, //BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
|
||||
0x255e, //BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
|
||||
0x255f, //BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
|
||||
0x255a, //BOX DRAWINGS DOUBLE UP AND RIGHT
|
||||
0x2554, //BOX DRAWINGS DOUBLE DOWN AND RIGHT
|
||||
0x2569, //BOX DRAWINGS DOUBLE UP AND HORIZONTAL
|
||||
0x2566, //BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
|
||||
0x2560, //BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
|
||||
0x2550, //BOX DRAWINGS DOUBLE HORIZONTAL
|
||||
0x256c, //BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
|
||||
0x2567, //BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
|
||||
0x2568, //BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
|
||||
0x2564, //BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
|
||||
0x2565, //BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
|
||||
0x2559, //BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
|
||||
0x2558, //BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
|
||||
0x2552, //BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
|
||||
0x2553, //BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
|
||||
0x256b, //BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
|
||||
0x256a, //BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
|
||||
0x2518, //BOX DRAWINGS LIGHT UP AND LEFT
|
||||
0x250c, //BOX DRAWINGS LIGHT DOWN AND RIGHT
|
||||
0x2588, //FULL BLOCK
|
||||
0x2584, //LOWER HALF BLOCK
|
||||
0x258c, //LEFT HALF BLOCK
|
||||
0x2590, //RIGHT HALF BLOCK
|
||||
0x2580, //UPPER HALF BLOCK
|
||||
0x03b1, //GREEK SMALL LETTER ALPHA
|
||||
0x00df, //LATIN SMALL LETTER SHARP S
|
||||
0x0393, //GREEK CAPITAL LETTER GAMMA
|
||||
0x03c0, //GREEK SMALL LETTER PI
|
||||
0x03a3, //GREEK CAPITAL LETTER SIGMA
|
||||
0x03c3, //GREEK SMALL LETTER SIGMA
|
||||
0x00b5, //MICRO SIGN
|
||||
0x03c4, //GREEK SMALL LETTER TAU
|
||||
0x03a6, //GREEK CAPITAL LETTER PHI
|
||||
0x0398, //GREEK CAPITAL LETTER THETA
|
||||
0x03a9, //GREEK CAPITAL LETTER OMEGA
|
||||
0x03b4, //GREEK SMALL LETTER DELTA
|
||||
0x221e, //INFINITY
|
||||
0x03c6, //GREEK SMALL LETTER PHI
|
||||
0x03b5, //GREEK SMALL LETTER EPSILON
|
||||
0x2229, //INTERSECTION
|
||||
0x2261, //IDENTICAL TO
|
||||
0x00b1, //PLUS-MINUS SIGN
|
||||
0x2265, //GREATER-THAN OR EQUAL TO
|
||||
0x2264, //LESS-THAN OR EQUAL TO
|
||||
0x2320, //TOP HALF INTEGRAL
|
||||
0x2321, //BOTTOM HALF INTEGRAL
|
||||
0x00f7, //DIVISION SIGN
|
||||
0x2248, //ALMOST EQUAL TO
|
||||
0x00b0, //DEGREE SIGN
|
||||
0x2219, //BULLET OPERATOR
|
||||
0x00b7, //MIDDLE DOT
|
||||
0x221a, //SQUARE ROOT
|
||||
0x207f, //SUPERSCRIPT LATIN SMALL LETTER N
|
||||
0x00b2, //SUPERSCRIPT TWO
|
||||
0x25a0, //BLACK SQUARE
|
||||
0x00a0, //NO-BREAK SPACE
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp850.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp850.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp850 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000a, //LINE FEED
|
||||
0x000b, //VERTICAL TABULATION
|
||||
0x000c, //FORM FEED
|
||||
0x000d, //CARRIAGE RETURN
|
||||
0x000e, //SHIFT OUT
|
||||
0x000f, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001a, //SUBSTITUTE
|
||||
0x001b, //ESCAPE
|
||||
0x001c, //FILE SEPARATOR
|
||||
0x001d, //GROUP SEPARATOR
|
||||
0x001e, //RECORD SEPARATOR
|
||||
0x001f, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002a, //ASTERISK
|
||||
0x002b, //PLUS SIGN
|
||||
0x002c, //COMMA
|
||||
0x002d, //HYPHEN-MINUS
|
||||
0x002e, //FULL STOP
|
||||
0x002f, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003a, //COLON
|
||||
0x003b, //SEMICOLON
|
||||
0x003c, //LESS-THAN SIGN
|
||||
0x003d, //EQUALS SIGN
|
||||
0x003e, //GREATER-THAN SIGN
|
||||
0x003f, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004a, //LATIN CAPITAL LETTER J
|
||||
0x004b, //LATIN CAPITAL LETTER K
|
||||
0x004c, //LATIN CAPITAL LETTER L
|
||||
0x004d, //LATIN CAPITAL LETTER M
|
||||
0x004e, //LATIN CAPITAL LETTER N
|
||||
0x004f, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005a, //LATIN CAPITAL LETTER Z
|
||||
0x005b, //LEFT SQUARE BRACKET
|
||||
0x005c, //REVERSE SOLIDUS
|
||||
0x005d, //RIGHT SQUARE BRACKET
|
||||
0x005e, //CIRCUMFLEX ACCENT
|
||||
0x005f, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006a, //LATIN SMALL LETTER J
|
||||
0x006b, //LATIN SMALL LETTER K
|
||||
0x006c, //LATIN SMALL LETTER L
|
||||
0x006d, //LATIN SMALL LETTER M
|
||||
0x006e, //LATIN SMALL LETTER N
|
||||
0x006f, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007a, //LATIN SMALL LETTER Z
|
||||
0x007b, //LEFT CURLY BRACKET
|
||||
0x007c, //VERTICAL LINE
|
||||
0x007d, //RIGHT CURLY BRACKET
|
||||
0x007e, //TILDE
|
||||
0x007f, //DELETE
|
||||
0x00c7, //LATIN CAPITAL LETTER C WITH CEDILLA
|
||||
0x00fc, //LATIN SMALL LETTER U WITH DIAERESIS
|
||||
0x00e9, //LATIN SMALL LETTER E WITH ACUTE
|
||||
0x00e2, //LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
0x00e4, //LATIN SMALL LETTER A WITH DIAERESIS
|
||||
0x00e0, //LATIN SMALL LETTER A WITH GRAVE
|
||||
0x00e5, //LATIN SMALL LETTER A WITH RING ABOVE
|
||||
0x00e7, //LATIN SMALL LETTER C WITH CEDILLA
|
||||
0x00ea, //LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
0x00eb, //LATIN SMALL LETTER E WITH DIAERESIS
|
||||
0x00e8, //LATIN SMALL LETTER E WITH GRAVE
|
||||
0x00ef, //LATIN SMALL LETTER I WITH DIAERESIS
|
||||
0x00ee, //LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
0x00ec, //LATIN SMALL LETTER I WITH GRAVE
|
||||
0x00c4, //LATIN CAPITAL LETTER A WITH DIAERESIS
|
||||
0x00c5, //LATIN CAPITAL LETTER A WITH RING ABOVE
|
||||
0x00c9, //LATIN CAPITAL LETTER E WITH ACUTE
|
||||
0x00e6, //LATIN SMALL LIGATURE AE
|
||||
0x00c6, //LATIN CAPITAL LIGATURE AE
|
||||
0x00f4, //LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
0x00f6, //LATIN SMALL LETTER O WITH DIAERESIS
|
||||
0x00f2, //LATIN SMALL LETTER O WITH GRAVE
|
||||
0x00fb, //LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
0x00f9, //LATIN SMALL LETTER U WITH GRAVE
|
||||
0x00ff, //LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
0x00d6, //LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
0x00dc, //LATIN CAPITAL LETTER U WITH DIAERESIS
|
||||
0x00f8, //LATIN SMALL LETTER O WITH STROKE
|
||||
0x00a3, //POUND SIGN
|
||||
0x00d8, //LATIN CAPITAL LETTER O WITH STROKE
|
||||
0x00d7, //MULTIPLICATION SIGN
|
||||
0x0192, //LATIN SMALL LETTER F WITH HOOK
|
||||
0x00e1, //LATIN SMALL LETTER A WITH ACUTE
|
||||
0x00ed, //LATIN SMALL LETTER I WITH ACUTE
|
||||
0x00f3, //LATIN SMALL LETTER O WITH ACUTE
|
||||
0x00fa, //LATIN SMALL LETTER U WITH ACUTE
|
||||
0x00f1, //LATIN SMALL LETTER N WITH TILDE
|
||||
0x00d1, //LATIN CAPITAL LETTER N WITH TILDE
|
||||
0x00aa, //FEMININE ORDINAL INDICATOR
|
||||
0x00ba, //MASCULINE ORDINAL INDICATOR
|
||||
0x00bf, //INVERTED QUESTION MARK
|
||||
0x00ae, //REGISTERED SIGN
|
||||
0x00ac, //NOT SIGN
|
||||
0x00bd, //VULGAR FRACTION ONE HALF
|
||||
0x00bc, //VULGAR FRACTION ONE QUARTER
|
||||
0x00a1, //INVERTED EXCLAMATION MARK
|
||||
0x00ab, //LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x00bb, //RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x2591, //LIGHT SHADE
|
||||
0x2592, //MEDIUM SHADE
|
||||
0x2593, //DARK SHADE
|
||||
0x2502, //BOX DRAWINGS LIGHT VERTICAL
|
||||
0x2524, //BOX DRAWINGS LIGHT VERTICAL AND LEFT
|
||||
0x00c1, //LATIN CAPITAL LETTER A WITH ACUTE
|
||||
0x00c2, //LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
||||
0x00c0, //LATIN CAPITAL LETTER A WITH GRAVE
|
||||
0x00a9, //COPYRIGHT SIGN
|
||||
0x2563, //BOX DRAWINGS DOUBLE VERTICAL AND LEFT
|
||||
0x2551, //BOX DRAWINGS DOUBLE VERTICAL
|
||||
0x2557, //BOX DRAWINGS DOUBLE DOWN AND LEFT
|
||||
0x255d, //BOX DRAWINGS DOUBLE UP AND LEFT
|
||||
0x00a2, //CENT SIGN
|
||||
0x00a5, //YEN SIGN
|
||||
0x2510, //BOX DRAWINGS LIGHT DOWN AND LEFT
|
||||
0x2514, //BOX DRAWINGS LIGHT UP AND RIGHT
|
||||
0x2534, //BOX DRAWINGS LIGHT UP AND HORIZONTAL
|
||||
0x252c, //BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
|
||||
0x251c, //BOX DRAWINGS LIGHT VERTICAL AND RIGHT
|
||||
0x2500, //BOX DRAWINGS LIGHT HORIZONTAL
|
||||
0x253c, //BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
|
||||
0x00e3, //LATIN SMALL LETTER A WITH TILDE
|
||||
0x00c3, //LATIN CAPITAL LETTER A WITH TILDE
|
||||
0x255a, //BOX DRAWINGS DOUBLE UP AND RIGHT
|
||||
0x2554, //BOX DRAWINGS DOUBLE DOWN AND RIGHT
|
||||
0x2569, //BOX DRAWINGS DOUBLE UP AND HORIZONTAL
|
||||
0x2566, //BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
|
||||
0x2560, //BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
|
||||
0x2550, //BOX DRAWINGS DOUBLE HORIZONTAL
|
||||
0x256c, //BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
|
||||
0x00a4, //CURRENCY SIGN
|
||||
0x00f0, //LATIN SMALL LETTER ETH
|
||||
0x00d0, //LATIN CAPITAL LETTER ETH
|
||||
0x00ca, //LATIN CAPITAL LETTER E WITH CIRCUMFLEX
|
||||
0x00cb, //LATIN CAPITAL LETTER E WITH DIAERESIS
|
||||
0x00c8, //LATIN CAPITAL LETTER E WITH GRAVE
|
||||
0x0131, //LATIN SMALL LETTER DOTLESS I
|
||||
0x00cd, //LATIN CAPITAL LETTER I WITH ACUTE
|
||||
0x00ce, //LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
||||
0x00cf, //LATIN CAPITAL LETTER I WITH DIAERESIS
|
||||
0x2518, //BOX DRAWINGS LIGHT UP AND LEFT
|
||||
0x250c, //BOX DRAWINGS LIGHT DOWN AND RIGHT
|
||||
0x2588, //FULL BLOCK
|
||||
0x2584, //LOWER HALF BLOCK
|
||||
0x00a6, //BROKEN BAR
|
||||
0x00cc, //LATIN CAPITAL LETTER I WITH GRAVE
|
||||
0x2580, //UPPER HALF BLOCK
|
||||
0x00d3, //LATIN CAPITAL LETTER O WITH ACUTE
|
||||
0x00df, //LATIN SMALL LETTER SHARP S
|
||||
0x00d4, //LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
||||
0x00d2, //LATIN CAPITAL LETTER O WITH GRAVE
|
||||
0x00f5, //LATIN SMALL LETTER O WITH TILDE
|
||||
0x00d5, //LATIN CAPITAL LETTER O WITH TILDE
|
||||
0x00b5, //MICRO SIGN
|
||||
0x00fe, //LATIN SMALL LETTER THORN
|
||||
0x00de, //LATIN CAPITAL LETTER THORN
|
||||
0x00da, //LATIN CAPITAL LETTER U WITH ACUTE
|
||||
0x00db, //LATIN CAPITAL LETTER U WITH CIRCUMFLEX
|
||||
0x00d9, //LATIN CAPITAL LETTER U WITH GRAVE
|
||||
0x00fd, //LATIN SMALL LETTER Y WITH ACUTE
|
||||
0x00dd, //LATIN CAPITAL LETTER Y WITH ACUTE
|
||||
0x00af, //MACRON
|
||||
0x00b4, //ACUTE ACCENT
|
||||
0x00ad, //SOFT HYPHEN
|
||||
0x00b1, //PLUS-MINUS SIGN
|
||||
0x2017, //DOUBLE LOW LINE
|
||||
0x00be, //VULGAR FRACTION THREE QUARTERS
|
||||
0x00b6, //PILCROW SIGN
|
||||
0x00a7, //SECTION SIGN
|
||||
0x00f7, //DIVISION SIGN
|
||||
0x00b8, //CEDILLA
|
||||
0x00b0, //DEGREE SIGN
|
||||
0x00a8, //DIAERESIS
|
||||
0x00b7, //MIDDLE DOT
|
||||
0x00b9, //SUPERSCRIPT ONE
|
||||
0x00b3, //SUPERSCRIPT THREE
|
||||
0x00b2, //SUPERSCRIPT TWO
|
||||
0x25a0, //BLACK SQUARE
|
||||
0x00a0, //NO-BREAK SPACE
|
||||
},
|
||||
}
|
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp874.go
generated
vendored
Normal file
262
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp874.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
package cp
|
||||
|
||||
var cp874 *charsetMap = &charsetMap{
|
||||
sb: [256]rune{
|
||||
0x0000, //NULL
|
||||
0x0001, //START OF HEADING
|
||||
0x0002, //START OF TEXT
|
||||
0x0003, //END OF TEXT
|
||||
0x0004, //END OF TRANSMISSION
|
||||
0x0005, //ENQUIRY
|
||||
0x0006, //ACKNOWLEDGE
|
||||
0x0007, //BELL
|
||||
0x0008, //BACKSPACE
|
||||
0x0009, //HORIZONTAL TABULATION
|
||||
0x000A, //LINE FEED
|
||||
0x000B, //VERTICAL TABULATION
|
||||
0x000C, //FORM FEED
|
||||
0x000D, //CARRIAGE RETURN
|
||||
0x000E, //SHIFT OUT
|
||||
0x000F, //SHIFT IN
|
||||
0x0010, //DATA LINK ESCAPE
|
||||
0x0011, //DEVICE CONTROL ONE
|
||||
0x0012, //DEVICE CONTROL TWO
|
||||
0x0013, //DEVICE CONTROL THREE
|
||||
0x0014, //DEVICE CONTROL FOUR
|
||||
0x0015, //NEGATIVE ACKNOWLEDGE
|
||||
0x0016, //SYNCHRONOUS IDLE
|
||||
0x0017, //END OF TRANSMISSION BLOCK
|
||||
0x0018, //CANCEL
|
||||
0x0019, //END OF MEDIUM
|
||||
0x001A, //SUBSTITUTE
|
||||
0x001B, //ESCAPE
|
||||
0x001C, //FILE SEPARATOR
|
||||
0x001D, //GROUP SEPARATOR
|
||||
0x001E, //RECORD SEPARATOR
|
||||
0x001F, //UNIT SEPARATOR
|
||||
0x0020, //SPACE
|
||||
0x0021, //EXCLAMATION MARK
|
||||
0x0022, //QUOTATION MARK
|
||||
0x0023, //NUMBER SIGN
|
||||
0x0024, //DOLLAR SIGN
|
||||
0x0025, //PERCENT SIGN
|
||||
0x0026, //AMPERSAND
|
||||
0x0027, //APOSTROPHE
|
||||
0x0028, //LEFT PARENTHESIS
|
||||
0x0029, //RIGHT PARENTHESIS
|
||||
0x002A, //ASTERISK
|
||||
0x002B, //PLUS SIGN
|
||||
0x002C, //COMMA
|
||||
0x002D, //HYPHEN-MINUS
|
||||
0x002E, //FULL STOP
|
||||
0x002F, //SOLIDUS
|
||||
0x0030, //DIGIT ZERO
|
||||
0x0031, //DIGIT ONE
|
||||
0x0032, //DIGIT TWO
|
||||
0x0033, //DIGIT THREE
|
||||
0x0034, //DIGIT FOUR
|
||||
0x0035, //DIGIT FIVE
|
||||
0x0036, //DIGIT SIX
|
||||
0x0037, //DIGIT SEVEN
|
||||
0x0038, //DIGIT EIGHT
|
||||
0x0039, //DIGIT NINE
|
||||
0x003A, //COLON
|
||||
0x003B, //SEMICOLON
|
||||
0x003C, //LESS-THAN SIGN
|
||||
0x003D, //EQUALS SIGN
|
||||
0x003E, //GREATER-THAN SIGN
|
||||
0x003F, //QUESTION MARK
|
||||
0x0040, //COMMERCIAL AT
|
||||
0x0041, //LATIN CAPITAL LETTER A
|
||||
0x0042, //LATIN CAPITAL LETTER B
|
||||
0x0043, //LATIN CAPITAL LETTER C
|
||||
0x0044, //LATIN CAPITAL LETTER D
|
||||
0x0045, //LATIN CAPITAL LETTER E
|
||||
0x0046, //LATIN CAPITAL LETTER F
|
||||
0x0047, //LATIN CAPITAL LETTER G
|
||||
0x0048, //LATIN CAPITAL LETTER H
|
||||
0x0049, //LATIN CAPITAL LETTER I
|
||||
0x004A, //LATIN CAPITAL LETTER J
|
||||
0x004B, //LATIN CAPITAL LETTER K
|
||||
0x004C, //LATIN CAPITAL LETTER L
|
||||
0x004D, //LATIN CAPITAL LETTER M
|
||||
0x004E, //LATIN CAPITAL LETTER N
|
||||
0x004F, //LATIN CAPITAL LETTER O
|
||||
0x0050, //LATIN CAPITAL LETTER P
|
||||
0x0051, //LATIN CAPITAL LETTER Q
|
||||
0x0052, //LATIN CAPITAL LETTER R
|
||||
0x0053, //LATIN CAPITAL LETTER S
|
||||
0x0054, //LATIN CAPITAL LETTER T
|
||||
0x0055, //LATIN CAPITAL LETTER U
|
||||
0x0056, //LATIN CAPITAL LETTER V
|
||||
0x0057, //LATIN CAPITAL LETTER W
|
||||
0x0058, //LATIN CAPITAL LETTER X
|
||||
0x0059, //LATIN CAPITAL LETTER Y
|
||||
0x005A, //LATIN CAPITAL LETTER Z
|
||||
0x005B, //LEFT SQUARE BRACKET
|
||||
0x005C, //REVERSE SOLIDUS
|
||||
0x005D, //RIGHT SQUARE BRACKET
|
||||
0x005E, //CIRCUMFLEX ACCENT
|
||||
0x005F, //LOW LINE
|
||||
0x0060, //GRAVE ACCENT
|
||||
0x0061, //LATIN SMALL LETTER A
|
||||
0x0062, //LATIN SMALL LETTER B
|
||||
0x0063, //LATIN SMALL LETTER C
|
||||
0x0064, //LATIN SMALL LETTER D
|
||||
0x0065, //LATIN SMALL LETTER E
|
||||
0x0066, //LATIN SMALL LETTER F
|
||||
0x0067, //LATIN SMALL LETTER G
|
||||
0x0068, //LATIN SMALL LETTER H
|
||||
0x0069, //LATIN SMALL LETTER I
|
||||
0x006A, //LATIN SMALL LETTER J
|
||||
0x006B, //LATIN SMALL LETTER K
|
||||
0x006C, //LATIN SMALL LETTER L
|
||||
0x006D, //LATIN SMALL LETTER M
|
||||
0x006E, //LATIN SMALL LETTER N
|
||||
0x006F, //LATIN SMALL LETTER O
|
||||
0x0070, //LATIN SMALL LETTER P
|
||||
0x0071, //LATIN SMALL LETTER Q
|
||||
0x0072, //LATIN SMALL LETTER R
|
||||
0x0073, //LATIN SMALL LETTER S
|
||||
0x0074, //LATIN SMALL LETTER T
|
||||
0x0075, //LATIN SMALL LETTER U
|
||||
0x0076, //LATIN SMALL LETTER V
|
||||
0x0077, //LATIN SMALL LETTER W
|
||||
0x0078, //LATIN SMALL LETTER X
|
||||
0x0079, //LATIN SMALL LETTER Y
|
||||
0x007A, //LATIN SMALL LETTER Z
|
||||
0x007B, //LEFT CURLY BRACKET
|
||||
0x007C, //VERTICAL LINE
|
||||
0x007D, //RIGHT CURLY BRACKET
|
||||
0x007E, //TILDE
|
||||
0x007F, //DELETE
|
||||
0x20AC, //EURO SIGN
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2026, //HORIZONTAL ELLIPSIS
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x2018, //LEFT SINGLE QUOTATION MARK
|
||||
0x2019, //RIGHT SINGLE QUOTATION MARK
|
||||
0x201C, //LEFT DOUBLE QUOTATION MARK
|
||||
0x201D, //RIGHT DOUBLE QUOTATION MARK
|
||||
0x2022, //BULLET
|
||||
0x2013, //EN DASH
|
||||
0x2014, //EM DASH
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x00A0, //NO-BREAK SPACE
|
||||
0x0E01, //THAI CHARACTER KO KAI
|
||||
0x0E02, //THAI CHARACTER KHO KHAI
|
||||
0x0E03, //THAI CHARACTER KHO KHUAT
|
||||
0x0E04, //THAI CHARACTER KHO KHWAI
|
||||
0x0E05, //THAI CHARACTER KHO KHON
|
||||
0x0E06, //THAI CHARACTER KHO RAKHANG
|
||||
0x0E07, //THAI CHARACTER NGO NGU
|
||||
0x0E08, //THAI CHARACTER CHO CHAN
|
||||
0x0E09, //THAI CHARACTER CHO CHING
|
||||
0x0E0A, //THAI CHARACTER CHO CHANG
|
||||
0x0E0B, //THAI CHARACTER SO SO
|
||||
0x0E0C, //THAI CHARACTER CHO CHOE
|
||||
0x0E0D, //THAI CHARACTER YO YING
|
||||
0x0E0E, //THAI CHARACTER DO CHADA
|
||||
0x0E0F, //THAI CHARACTER TO PATAK
|
||||
0x0E10, //THAI CHARACTER THO THAN
|
||||
0x0E11, //THAI CHARACTER THO NANGMONTHO
|
||||
0x0E12, //THAI CHARACTER THO PHUTHAO
|
||||
0x0E13, //THAI CHARACTER NO NEN
|
||||
0x0E14, //THAI CHARACTER DO DEK
|
||||
0x0E15, //THAI CHARACTER TO TAO
|
||||
0x0E16, //THAI CHARACTER THO THUNG
|
||||
0x0E17, //THAI CHARACTER THO THAHAN
|
||||
0x0E18, //THAI CHARACTER THO THONG
|
||||
0x0E19, //THAI CHARACTER NO NU
|
||||
0x0E1A, //THAI CHARACTER BO BAIMAI
|
||||
0x0E1B, //THAI CHARACTER PO PLA
|
||||
0x0E1C, //THAI CHARACTER PHO PHUNG
|
||||
0x0E1D, //THAI CHARACTER FO FA
|
||||
0x0E1E, //THAI CHARACTER PHO PHAN
|
||||
0x0E1F, //THAI CHARACTER FO FAN
|
||||
0x0E20, //THAI CHARACTER PHO SAMPHAO
|
||||
0x0E21, //THAI CHARACTER MO MA
|
||||
0x0E22, //THAI CHARACTER YO YAK
|
||||
0x0E23, //THAI CHARACTER RO RUA
|
||||
0x0E24, //THAI CHARACTER RU
|
||||
0x0E25, //THAI CHARACTER LO LING
|
||||
0x0E26, //THAI CHARACTER LU
|
||||
0x0E27, //THAI CHARACTER WO WAEN
|
||||
0x0E28, //THAI CHARACTER SO SALA
|
||||
0x0E29, //THAI CHARACTER SO RUSI
|
||||
0x0E2A, //THAI CHARACTER SO SUA
|
||||
0x0E2B, //THAI CHARACTER HO HIP
|
||||
0x0E2C, //THAI CHARACTER LO CHULA
|
||||
0x0E2D, //THAI CHARACTER O ANG
|
||||
0x0E2E, //THAI CHARACTER HO NOKHUK
|
||||
0x0E2F, //THAI CHARACTER PAIYANNOI
|
||||
0x0E30, //THAI CHARACTER SARA A
|
||||
0x0E31, //THAI CHARACTER MAI HAN-AKAT
|
||||
0x0E32, //THAI CHARACTER SARA AA
|
||||
0x0E33, //THAI CHARACTER SARA AM
|
||||
0x0E34, //THAI CHARACTER SARA I
|
||||
0x0E35, //THAI CHARACTER SARA II
|
||||
0x0E36, //THAI CHARACTER SARA UE
|
||||
0x0E37, //THAI CHARACTER SARA UEE
|
||||
0x0E38, //THAI CHARACTER SARA U
|
||||
0x0E39, //THAI CHARACTER SARA UU
|
||||
0x0E3A, //THAI CHARACTER PHINTHU
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0x0E3F, //THAI CURRENCY SYMBOL BAHT
|
||||
0x0E40, //THAI CHARACTER SARA E
|
||||
0x0E41, //THAI CHARACTER SARA AE
|
||||
0x0E42, //THAI CHARACTER SARA O
|
||||
0x0E43, //THAI CHARACTER SARA AI MAIMUAN
|
||||
0x0E44, //THAI CHARACTER SARA AI MAIMALAI
|
||||
0x0E45, //THAI CHARACTER LAKKHANGYAO
|
||||
0x0E46, //THAI CHARACTER MAIYAMOK
|
||||
0x0E47, //THAI CHARACTER MAITAIKHU
|
||||
0x0E48, //THAI CHARACTER MAI EK
|
||||
0x0E49, //THAI CHARACTER MAI THO
|
||||
0x0E4A, //THAI CHARACTER MAI TRI
|
||||
0x0E4B, //THAI CHARACTER MAI CHATTAWA
|
||||
0x0E4C, //THAI CHARACTER THANTHAKHAT
|
||||
0x0E4D, //THAI CHARACTER NIKHAHIT
|
||||
0x0E4E, //THAI CHARACTER YAMAKKAN
|
||||
0x0E4F, //THAI CHARACTER FONGMAN
|
||||
0x0E50, //THAI DIGIT ZERO
|
||||
0x0E51, //THAI DIGIT ONE
|
||||
0x0E52, //THAI DIGIT TWO
|
||||
0x0E53, //THAI DIGIT THREE
|
||||
0x0E54, //THAI DIGIT FOUR
|
||||
0x0E55, //THAI DIGIT FIVE
|
||||
0x0E56, //THAI DIGIT SIX
|
||||
0x0E57, //THAI DIGIT SEVEN
|
||||
0x0E58, //THAI DIGIT EIGHT
|
||||
0x0E59, //THAI DIGIT NINE
|
||||
0x0E5A, //THAI CHARACTER ANGKHANKHU
|
||||
0x0E5B, //THAI CHARACTER KHOMUT
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
0xFFFD, //UNDEFINED
|
||||
},
|
||||
}
|
7988
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp932.go
generated
vendored
Normal file
7988
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp932.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22055
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp936.go
generated
vendored
Normal file
22055
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp936.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17312
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp949.go
generated
vendored
Normal file
17312
vendor/github.com/denisenkom/go-mssqldb/internal/cp/cp949.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user