mirror of https://github.com/gogits/gogs.git
Unknwon
8 years ago
43 changed files with 70376 additions and 2 deletions
@ -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. |
@ -0,0 +1,149 @@
|
||||
# A pure Go MSSQL driver for Go's database/sql package |
||||
|
||||
## Install |
||||
|
||||
go get github.com/denisenkom/go-mssqldb |
||||
|
||||
## Connection Parameters and DSN |
||||
|
||||
* "server" - host or host\instance (default localhost) |
||||
* "port" - used only when there is no instance in server (default 1433) |
||||
* "failoverpartner" - host or host\instance (default is no partner). |
||||
* "failoverport" - used only when there is no instance in failoverpartner (default 1433) |
||||
* "user id" - enter the SQL Server Authentication user id or the Windows Authentication user id in the DOMAIN\User format. On Windows, if user id is empty or missing Single-Sign-On is used. |
||||
* "password" |
||||
* "database" |
||||
* "connection timeout" - in seconds (default is 30) |
||||
* "dial timeout" - in seconds (default is 5) |
||||
* "keepAlive" - in seconds; 0 to disable (default is 0) |
||||
* "log" - logging flags (default 0/no logging, 63 for full logging) |
||||
* 1 log errors |
||||
* 2 log messages |
||||
* 4 log rows affected |
||||
* 8 trace sql statements |
||||
* 16 log statement parameters |
||||
* 32 log transaction begin/end |
||||
* "encrypt" |
||||
* disable - Data send between client and server is not encrypted. |
||||
* false - Data sent between client and server is not encrypted beyond the login packet. (Default) |
||||
* true - Data sent between client and server is encrypted. |
||||
* "TrustServerCertificate" |
||||
* false - Server certificate is checked. Default is false if encypt is specified. |
||||
* true - Server certificate is not checked. Default is true if encrypt is not specified. If trust server certificate is true, driver accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks. This should be used only for testing. |
||||
* "certificate" - The file that contains the public key certificate of the CA that signed the SQL Server certificate. The specified certificate overrides the go platform specific CA certificates. |
||||
* "hostNameInCertificate" - Specifies the Common Name (CN) in the server certificate. Default value is the server host. |
||||
* "ServerSPN" - The kerberos SPN (Service Principal Name) for the server. Default is MSSQLSvc/host:port. |
||||
* "Workstation ID" - The workstation name (default is the host name) |
||||
* "app name" - The application name (default is go-mssqldb) |
||||
* "ApplicationIntent" - Can be given the value "ReadOnly" to initiate a read-only connection to an Availability Group listener. |
||||
|
||||
The connection string can be specified in one of three formats: |
||||
|
||||
1. ADO: `key=value` pairs separated by `;`. Values may not contain `;`, leading and trailing whitespace is ignored. |
||||
Examples: |
||||
|
||||
* `server=localhost\\SQLExpress;user id=sa;database=master;connection timeout=30` |
||||
* `server=localhost;user id=sa;database=master;connection timeout=30` |
||||
|
||||
2. ODBC: Prefix with `odbc`, `key=value` pairs separated by `;`. Allow `;` by wrapping |
||||
values in `{}`. Examples: |
||||
|
||||
* `odbc:server=localhost\\SQLExpress;user id=sa;database=master;connection timeout=30` |
||||
* `odbc:server=localhost;user id=sa;database=master;connection timeout=30` |
||||
* `odbc:server=localhost;user id=sa;password={foo;bar}` // Value marked with `{}`, password is "foo;bar" |
||||
* `odbc:server=localhost;user id=sa;password={foo{bar}` // Value marked with `{}`, password is "foo{bar" |
||||
* `odbc:server=localhost;user id=sa;password={foobar }` // Value marked with `{}`, password is "foobar " |
||||
* `odbc:server=localhost;user id=sa;password=foo{bar` // Literal `{`, password is "foo{bar" |
||||
* `odbc:server=localhost;user id=sa;password=foo}bar` // Literal `}`, password is "foo}bar" |
||||
* `odbc:server=localhost;user id=sa;password={foo{bar}` // Literal `{`, password is "foo{bar" |
||||
* `odbc:server=localhost;user id=sa;password={foo}}bar}` // Escaped `} with `}}`, password is "foo}bar" |
||||
|
||||
3. URL: with `sqlserver` scheme. username and password appears before the host. Any instance appears as |
||||
the first segment in the path. All other options are query parameters. Examples: |
||||
|
||||
* `sqlserver://username:password@host/instance?param1=value¶m2=value` |
||||
* `sqlserver://username:password@host:port?param1=value¶m2=value` |
||||
* `sqlserver://sa@localhost/SQLExpress?database=master&connection+timeout=30` // `SQLExpress instance. |
||||
* `sqlserver://sa:mypass@localhost?database=master&connection+timeout=30` // username=sa, password=mypass. |
||||
* `sqlserver://sa:mypass@localhost:1234?database=master&connection+timeout=30"` // port 1234 on localhost. |
||||
* `sqlserver://sa:my%7Bpass@somehost?connection+timeout=30` // password is "my{pass" |
||||
|
||||
A string of this format can be constructed using the `URL` type in the `net/url` package. |
||||
|
||||
```go |
||||
query := url.Values{} |
||||
query.Add("connection timeout", fmt.Sprintf("%d", connectionTimeout)) |
||||
|
||||
u := &url.URL{ |
||||
Scheme: "sqlserver", |
||||
User: url.UserPassword(username, password), |
||||
Host: fmt.Sprintf("%s:%d", hostname, port), |
||||
// Path: instance, // if connecting to an instance instead of a port |
||||
RawQuery: query.Encode(), |
||||
} |
||||
|
||||
connectionString := u.String() |
||||
|
||||
db, err := sql.Open("sqlserver", connectionString) |
||||
// or |
||||
db, err := sql.Open("mssql", connectionString) |
||||
``` |
||||
|
||||
## Statement Parameters |
||||
|
||||
The `sqlserver` driver uses normal MS SQL Server syntax and expects parameters in |
||||
the sql query to be in the form of either `@Name` or `@p1` to `@pN` (ordinal position). |
||||
|
||||
```go |
||||
db.QueryContext(ctx, `select * from t where ID = @ID;`, sql.Named("ID", 6)) |
||||
``` |
||||
|
||||
|
||||
For the `mssql` driver, the SQL statement text will be processed and literals will |
||||
be replaced by a parameter that matches one of the following: |
||||
|
||||
* ? |
||||
* ?nnn |
||||
* :nnn |
||||
* $nnn |
||||
|
||||
where nnn represents an integer that specifies a 1-indexed positional parameter. Ex: |
||||
|
||||
```go |
||||
db.Query("SELECT * FROM t WHERE a = ?3, b = ?2, c = ?1", "x", "y", "z") |
||||
``` |
||||
|
||||
will expand to roughly |
||||
|
||||
```sql |
||||
SELECT * FROM t WHERE a = 'z', b = 'y', c = 'x' |
||||
``` |
||||
|
||||
## Features |
||||
|
||||
* Can be used with SQL Server 2005 or newer |
||||
* Can be used with Microsoft Azure SQL Database |
||||
* Can be used on all go supported platforms (e.g. Linux, Mac OS X and Windows) |
||||
* Supports new date/time types: date, time, datetime2, datetimeoffset |
||||
* Supports string parameters longer than 8000 characters |
||||
* Supports encryption using SSL/TLS |
||||
* Supports SQL Server and Windows Authentication |
||||
* Supports Single-Sign-On on Windows |
||||
* Supports connections to AlwaysOn Availability Group listeners, including re-direction to read-only replicas. |
||||
* Supports query notifications |
||||
|
||||
## Tests |
||||
|
||||
`go test` is used for testing. A running instance of MSSQL server is required. |
||||
Environment variables are used to pass login information. |
||||
|
||||
Example: |
||||
|
||||
env HOST=localhost SQLUSER=sa SQLPASSWORD=sa DATABASE=test go test |
||||
|
||||
## Known Issues |
||||
|
||||
* SQL Server 2008 and 2008 R2 engine cannot handle login records when SSL encryption is not disabled. |
||||
To fix SQL Server 2008 R2 issue, install SQL Server 2008 R2 Service Pack 2. |
||||
To fix SQL Server 2008 issue, install Microsoft SQL Server 2008 Service Pack 3 and Cumulative update package 3 for SQL Server 2008 SP3. |
||||
More information: http://support.microsoft.com/kb/2653857 |
@ -0,0 +1,255 @@
|
||||
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 spearate to make sending attn signals
|
||||
// possible without locks. Currently attn signals are only sent during
|
||||
// reads, not writes.
|
||||
type tdsBuffer struct { |
||||
transport io.ReadWriteCloser |
||||
|
||||
// Write fields.
|
||||
wbuf []byte |
||||
wpos uint16 |
||||
|
||||
// Read fields.
|
||||
rbuf []byte |
||||
rpos uint16 |
||||
rsize uint16 |
||||
final bool |
||||
packet_type packetType |
||||
|
||||
// afterFirst is assigned to right after tdsBuffer is created and
|
||||
// before the first use. It is executed after the first packet is
|
||||
// writen and then removed.
|
||||
afterFirst func() |
||||
} |
||||
|
||||
func newTdsBuffer(bufsize int, transport io.ReadWriteCloser) *tdsBuffer { |
||||
w := new(tdsBuffer) |
||||
w.wbuf = make([]byte, bufsize) |
||||
w.rbuf = make([]byte, bufsize) |
||||
w.wpos = 0 |
||||
w.rpos = 8 |
||||
w.transport = transport |
||||
return w |
||||
} |
||||
|
||||
func (rw *tdsBuffer) ResizeBuffer(packetsizei int) { |
||||
if len(rw.rbuf) != packetsizei { |
||||
newbuf := make([]byte, packetsizei) |
||||
copy(newbuf, rw.rbuf) |
||||
rw.rbuf = newbuf |
||||
} |
||||
if len(rw.wbuf) != packetsizei { |
||||
newbuf := make([]byte, packetsizei) |
||||
copy(newbuf, rw.wbuf) |
||||
rw.wbuf = newbuf |
||||
} |
||||
} |
||||
|
||||
func (w *tdsBuffer) PackageSize() uint32 { |
||||
return uint32(len(w.wbuf)) |
||||
} |
||||
|
||||
func (w *tdsBuffer) flush() (err error) { |
||||
// writing packet size
|
||||
binary.BigEndian.PutUint16(w.wbuf[2:], w.wpos) |
||||
|
||||
// writing packet into underlying transport
|
||||
if _, err = w.transport.Write(w.wbuf[:w.wpos]); err != nil { |
||||
return err |
||||
} |
||||
|
||||
// execute afterFirst hook if it is set
|
||||
if w.afterFirst != nil { |
||||
w.afterFirst() |
||||
w.afterFirst = nil |
||||
} |
||||
|
||||
w.wpos = 8 |
||||
// packet number
|
||||
w.wbuf[6] += 1 |
||||
return nil |
||||
} |
||||
|
||||
func (w *tdsBuffer) Write(p []byte) (total int, err error) { |
||||
total = 0 |
||||
for { |
||||
copied := copy(w.wbuf[w.wpos:], p) |
||||
w.wpos += uint16(copied) |
||||
total += copied |
||||
if copied == len(p) { |
||||
break |
||||
} |
||||
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(packet_type packetType) { |
||||
w.wbuf[0] = byte(packet_type) |
||||
w.wbuf[1] = 0 // packet is incomplete
|
||||
w.wbuf[4] = 0 // spid
|
||||
w.wbuf[5] = 0 |
||||
w.wbuf[6] = 1 // packet id
|
||||
w.wbuf[7] = 0 // window
|
||||
w.wpos = 8 |
||||
} |
||||
|
||||
func (w *tdsBuffer) FinishPacket() error { |
||||
w.wbuf[1] = 1 // this is last packet
|
||||
return w.flush() |
||||
} |
||||
|
||||
func (r *tdsBuffer) readNextPacket() error { |
||||
header := header{} |
||||
var err error |
||||
err = binary.Read(r.transport, binary.BigEndian, &header) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
offset := uint16(binary.Size(header)) |
||||
if int(header.Size) > len(r.rbuf) { |
||||
return errors.New("Invalid packet size, it is longer than buffer size") |
||||
} |
||||
if int(offset) > int(header.Size) { |
||||
return errors.New("Invalid packet size, it is shorter than header size") |
||||
} |
||||
_, err = io.ReadFull(r.transport, r.rbuf[offset:header.Size]) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
r.rpos = offset |
||||
r.rsize = header.Size |
||||
r.final = header.Status != 0 |
||||
r.packet_type = header.PacketType |
||||
return nil |
||||
} |
||||
|
||||
func (r *tdsBuffer) BeginRead() (packetType, error) { |
||||
err := r.readNextPacket() |
||||
if err != nil { |
||||
return 0, err |
||||
} |
||||
return r.packet_type, 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 += uint16(copied) |
||||
return |
||||
} |
@ -0,0 +1,113 @@
|
||||
package mssql |
||||
|
||||
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 charset2utf8(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) |
||||
} |
@ -0,0 +1,39 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"encoding/binary" |
||||
"io" |
||||
) |
||||
|
||||
// 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 |
||||
} |
||||
|
||||
func readCollation(r *tdsBuffer) (res collation) { |
||||
res.lcidAndFlags = r.uint32() |
||||
res.sortId = r.byte() |
||||
return |
||||
} |
||||
|
||||
func writeCollation(w io.Writer, col collation) (err error) { |
||||
if err = binary.Write(w, binary.LittleEndian, col.lcidAndFlags); err != nil { |
||||
return |
||||
} |
||||
err = binary.Write(w, binary.LittleEndian, col.sortId) |
||||
return |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
@ -0,0 +1,262 @@
|
||||
package mssql |
||||
|
||||
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
|
||||
}, |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,115 @@
|
||||
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 |
||||
} |
||||
|
||||
func Float64ToDecimal(f float64) (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 <= 20; dec.scale++ { |
||||
integer = f * scaletblflt64[dec.scale] |
||||
_, frac := math.Modf(integer) |
||||
if frac == 0 { |
||||
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) Bytes() []byte { |
||||
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 scaleBytes(x.String(), d.scale) |
||||
} |
||||
|
||||
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()) |
||||
} |
@ -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 REAME for the format of the DSN.
|
||||
package mssql |
@ -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...)) |
||||
} |
@ -0,0 +1,30 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"log" |
||||
) |
||||
|
||||
type Logger interface { |
||||
Printf(format string, v ...interface{}) |
||||
Println(v ...interface{}) |
||||
} |
||||
|
||||
type optionalLogger struct { |
||||
logger Logger |
||||
} |
||||
|
||||
func (o optionalLogger) Printf(format string, v ...interface{}) { |
||||
if o.logger != nil { |
||||
o.logger.Printf(format, v...) |
||||
} else { |
||||
log.Printf(format, v...) |
||||
} |
||||
} |
||||
|
||||
func (o optionalLogger) Println(v ...interface{}) { |
||||
if o.logger != nil { |
||||
o.logger.Println(v...) |
||||
} else { |
||||
log.Println(v...) |
||||
} |
||||
} |
@ -0,0 +1,609 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"database/sql" |
||||
"database/sql/driver" |
||||
"encoding/binary" |
||||
"errors" |
||||
"fmt" |
||||
"io" |
||||
"math" |
||||
"net" |
||||
"reflect" |
||||
"strings" |
||||
"time" |
||||
"golang.org/x/net/context" // use the "x/net/context" for backwards compatibility.
|
||||
) |
||||
|
||||
var driverInstance = &MssqlDriver{processQueryText: true} |
||||
var driverInstanceNoProcess = &MssqlDriver{processQueryText: false} |
||||
|
||||
func init() { |
||||
sql.Register("mssql", driverInstance) |
||||
sql.Register("sqlserver", driverInstanceNoProcess) |
||||
} |
||||
|
||||
// Abstract the dialer for testing and for non-TCP based connections.
|
||||
type dialer interface { |
||||
Dial(addr string) (net.Conn, error) |
||||
} |
||||
|
||||
var createDialer func(p *connectParams) dialer |
||||
|
||||
type tcpDialer struct { |
||||
nd *net.Dialer |
||||
} |
||||
|
||||
func (d tcpDialer) Dial(addr string) (net.Conn, error) { |
||||
return d.nd.Dial("tcp", addr) |
||||
} |
||||
|
||||
type MssqlDriver struct { |
||||
log optionalLogger |
||||
|
||||
processQueryText bool |
||||
} |
||||
|
||||
func SetLogger(logger Logger) { |
||||
driverInstance.SetLogger(logger) |
||||
driverInstanceNoProcess.SetLogger(logger) |
||||
} |
||||
|
||||
func (d *MssqlDriver) SetLogger(logger Logger) { |
||||
d.log = optionalLogger{logger} |
||||
} |
||||
|
||||
type MssqlConn struct { |
||||
sess *tdsSession |
||||
transactionCtx context.Context |
||||
|
||||
processQueryText bool |
||||
} |
||||
|
||||
func (c *MssqlConn) simpleProcessResp(ctx context.Context) error { |
||||
tokchan := make(chan tokenStruct, 5) |
||||
go processResponse(ctx, c.sess, tokchan) |
||||
for tok := range tokchan { |
||||
switch token := tok.(type) { |
||||
case doneStruct: |
||||
if token.isError() { |
||||
return token.getError() |
||||
} |
||||
case error: |
||||
return token |
||||
} |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (c *MssqlConn) Commit() error { |
||||
if err := c.sendCommitRequest(); err != nil { |
||||
return err |
||||
} |
||||
return c.simpleProcessResp(c.transactionCtx) |
||||
} |
||||
|
||||
func (c *MssqlConn) sendCommitRequest() error { |
||||
headers := []headerStruct{ |
||||
{hdrtype: dataStmHdrTransDescr, |
||||
data: transDescrHdr{c.sess.tranid, 1}.pack()}, |
||||
} |
||||
if err := sendCommitXact(c.sess.buf, headers, "", 0, 0, ""); err != nil { |
||||
if c.sess.logFlags&logErrors != 0 { |
||||
c.sess.log.Printf("Failed to send CommitXact with %v", err) |
||||
} |
||||
return driver.ErrBadConn |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (c *MssqlConn) Rollback() error { |
||||
if err := c.sendRollbackRequest(); err != nil { |
||||
return err |
||||
} |
||||
return c.simpleProcessResp(c.transactionCtx) |
||||
} |
||||
|
||||
func (c *MssqlConn) sendRollbackRequest() error { |
||||
headers := []headerStruct{ |
||||
{hdrtype: dataStmHdrTransDescr, |
||||
data: transDescrHdr{c.sess.tranid, 1}.pack()}, |
||||
} |
||||
if err := sendRollbackXact(c.sess.buf, headers, "", 0, 0, ""); err != nil { |
||||
if c.sess.logFlags&logErrors != 0 { |
||||
c.sess.log.Printf("Failed to send RollbackXact with %v", err) |
||||
} |
||||
return driver.ErrBadConn |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (c *MssqlConn) Begin() (driver.Tx, error) { |
||||
return c.begin(context.Background(), isolationUseCurrent) |
||||
} |
||||
|
||||
func (c *MssqlConn) begin(ctx context.Context, tdsIsolation isoLevel) (driver.Tx, error) { |
||||
err := c.sendBeginRequest(ctx, tdsIsolation) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
return c.processBeginResponse(ctx) |
||||
} |
||||
|
||||
func (c *MssqlConn) sendBeginRequest(ctx context.Context, tdsIsolation isoLevel) error { |
||||
c.transactionCtx = ctx |
||||
headers := []headerStruct{ |
||||
{hdrtype: dataStmHdrTransDescr, |
||||
data: transDescrHdr{0, 1}.pack()}, |
||||
} |
||||
if err := sendBeginXact(c.sess.buf, headers, tdsIsolation, ""); err != nil { |
||||
if c.sess.logFlags&logErrors != 0 { |
||||
c.sess.log.Printf("Failed to send BeginXact with %v", err) |
||||
} |
||||
return driver.ErrBadConn |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (c *MssqlConn) processBeginResponse(ctx context.Context) (driver.Tx, error) { |
||||
if err := c.simpleProcessResp(ctx); err != nil { |
||||
return nil, err |
||||
} |
||||
// successful BEGINXACT request will return sess.tranid
|
||||
// for started transaction
|
||||
return c, nil |
||||
} |
||||
|
||||
func (d *MssqlDriver) Open(dsn string) (driver.Conn, error) { |
||||
return d.open(dsn) |
||||
} |
||||
|
||||
func (d *MssqlDriver) open(dsn string) (*MssqlConn, error) { |
||||
params, err := parseConnectParams(dsn) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
sess, err := connect(d.log, params) |
||||
if err != nil { |
||||
// main server failed, try fail-over partner
|
||||
if params.failOverPartner == "" { |
||||
return nil, err |
||||
} |
||||
|
||||
params.host = params.failOverPartner |
||||
if params.failOverPort != 0 { |
||||
params.port = params.failOverPort |
||||
} |
||||
|
||||
sess, err = connect(d.log, params) |
||||
if err != nil { |
||||
// fail-over partner also failed, now fail
|
||||
return nil, err |
||||
} |
||||
} |
||||
|
||||
conn := &MssqlConn{sess, context.Background(), d.processQueryText} |
||||
conn.sess.log = d.log |
||||
return conn, nil |
||||
} |
||||
|
||||
func (c *MssqlConn) Close() error { |
||||
return c.sess.buf.transport.Close() |
||||
} |
||||
|
||||
type MssqlStmt struct { |
||||
c *MssqlConn |
||||
query string |
||||
paramCount int |
||||
notifSub *queryNotifSub |
||||
} |
||||
|
||||
type queryNotifSub struct { |
||||
msgText string |
||||
options string |
||||
timeout uint32 |
||||
} |
||||
|
||||
func (c *MssqlConn) Prepare(query string) (driver.Stmt, error) { |
||||
return c.prepareContext(context.Background(), query) |
||||
} |
||||
|
||||
func (c *MssqlConn) prepareContext(ctx context.Context, query string) (*MssqlStmt, error) { |
||||
paramCount := -1 |
||||
if c.processQueryText { |
||||
query, paramCount = parseParams(query) |
||||
} |
||||
return &MssqlStmt{c, query, paramCount, nil}, nil |
||||
} |
||||
|
||||
func (s *MssqlStmt) Close() error { |
||||
return nil |
||||
} |
||||
|
||||
func (s *MssqlStmt) SetQueryNotification(id, options string, timeout time.Duration) { |
||||
to := uint32(timeout / time.Second) |
||||
if to < 1 { |
||||
to = 1 |
||||
} |
||||
s.notifSub = &queryNotifSub{id, options, to} |
||||
} |
||||
|
||||
func (s *MssqlStmt) NumInput() int { |
||||
return s.paramCount |
||||
} |
||||
|
||||
func (s *MssqlStmt) sendQuery(args []namedValue) (err error) { |
||||
headers := []headerStruct{ |
||||
{hdrtype: dataStmHdrTransDescr, |
||||
data: transDescrHdr{s.c.sess.tranid, 1}.pack()}, |
||||
} |
||||
|
||||
if s.notifSub != nil { |
||||
headers = append(headers, headerStruct{hdrtype: dataStmHdrQueryNotif, |
||||
data: queryNotifHdr{s.notifSub.msgText, s.notifSub.options, s.notifSub.timeout}.pack()}) |
||||
} |
||||
|
||||
// no need to check number of parameters here, it is checked by database/sql
|
||||
if s.c.sess.logFlags&logSQL != 0 { |
||||
s.c.sess.log.Println(s.query) |
||||
} |
||||
if s.c.sess.logFlags&logParams != 0 && len(args) > 0 { |
||||
for i := 0; i < len(args); i++ { |
||||
s.c.sess.log.Printf("\t@p%d\t%v\n", i+1, args[i]) |
||||
} |
||||
|
||||
} |
||||
if len(args) == 0 { |
||||
if err = sendSqlBatch72(s.c.sess.buf, s.query, headers); err != nil { |
||||
if s.c.sess.logFlags&logErrors != 0 { |
||||
s.c.sess.log.Printf("Failed to send SqlBatch with %v", err) |
||||
} |
||||
return driver.ErrBadConn |
||||
} |
||||
} else { |
||||
params := make([]Param, len(args)+2) |
||||
decls := make([]string, len(args)) |
||||
params[0] = makeStrParam(s.query) |
||||
for i, val := range args { |
||||
params[i+2], err = s.makeParam(val.Value) |
||||
if err != nil { |
||||
return |
||||
} |
||||
var name string |
||||
if len(val.Name) > 0 { |
||||
name = "@" + val.Name |
||||
} else { |
||||
name = fmt.Sprintf("@p%d", val.Ordinal) |
||||
} |
||||
params[i+2].Name = name |
||||
decls[i] = fmt.Sprintf("%s %s", name, makeDecl(params[i+2].ti)) |
||||
} |
||||
params[1] = makeStrParam(strings.Join(decls, ",")) |
||||
if err = sendRpc(s.c.sess.buf, headers, Sp_ExecuteSql, 0, params); err != nil { |
||||
if s.c.sess.logFlags&logErrors != 0 { |
||||
s.c.sess.log.Printf("Failed to send Rpc with %v", err) |
||||
} |
||||
return driver.ErrBadConn |
||||
} |
||||
} |
||||
return |
||||
} |
||||
|
||||
type namedValue struct { |
||||
Name string |
||||
Ordinal int |
||||
Value driver.Value |
||||
} |
||||
|
||||
func convertOldArgs(args []driver.Value) []namedValue { |
||||
list := make([]namedValue, len(args)) |
||||
for i, v := range args { |
||||
list[i] = namedValue{ |
||||
Ordinal: i + 1, |
||||
Value: v, |
||||
} |
||||
} |
||||
return list |
||||
} |
||||
|
||||
func (s *MssqlStmt) Query(args []driver.Value) (driver.Rows, error) { |
||||
return s.queryContext(context.Background(), convertOldArgs(args)) |
||||
} |
||||
|
||||
func (s *MssqlStmt) queryContext(ctx context.Context, args []namedValue) (driver.Rows, error) { |
||||
if err := s.sendQuery(args); err != nil { |
||||
return nil, err |
||||
} |
||||
return s.processQueryResponse(ctx) |
||||
} |
||||
|
||||
func (s *MssqlStmt) processQueryResponse(ctx context.Context) (res driver.Rows, err error) { |
||||
tokchan := make(chan tokenStruct, 5) |
||||
ctx, cancel := context.WithCancel(ctx) |
||||
go processResponse(ctx, s.c.sess, tokchan) |
||||
// process metadata
|
||||
var cols []columnStruct |
||||
loop: |
||||
for tok := range tokchan { |
||||
switch token := tok.(type) { |
||||
// by ignoring DONE token we effectively
|
||||
// skip empty result-sets
|
||||
// this improves results in queryes like that:
|
||||
// set nocount on; select 1
|
||||
// see TestIgnoreEmptyResults test
|
||||
//case doneStruct:
|
||||
//break loop
|
||||
case []columnStruct: |
||||
cols = token |
||||
break loop |
||||
case doneStruct: |
||||
if token.isError() { |
||||
return nil, token.getError() |
||||
} |
||||
case error: |
||||
return nil, token |
||||
} |
||||
} |
||||
res = &MssqlRows{sess: s.c.sess, tokchan: tokchan, cols: cols, cancel: cancel} |
||||
return |
||||
} |
||||
|
||||
func (s *MssqlStmt) Exec(args []driver.Value) (driver.Result, error) { |
||||
return s.exec(context.Background(), convertOldArgs(args)) |
||||
} |
||||
|
||||
func (s *MssqlStmt) exec(ctx context.Context, args []namedValue) (driver.Result, error) { |
||||
if err := s.sendQuery(args); err != nil { |
||||
return nil, err |
||||
} |
||||
return s.processExec(ctx) |
||||
} |
||||
|
||||
func (s *MssqlStmt) processExec(ctx context.Context) (res driver.Result, err error) { |
||||
tokchan := make(chan tokenStruct, 5) |
||||
go processResponse(ctx, s.c.sess, tokchan) |
||||
var rowCount int64 |
||||
for token := range tokchan { |
||||
switch token := token.(type) { |
||||
case doneInProcStruct: |
||||
if token.Status&doneCount != 0 { |
||||
rowCount += int64(token.RowCount) |
||||
} |
||||
case doneStruct: |
||||
if token.Status&doneCount != 0 { |
||||
rowCount += int64(token.RowCount) |
||||
} |
||||
if token.isError() { |
||||
return nil, token.getError() |
||||
} |
||||
case error: |
||||
return nil, token |
||||
} |
||||
} |
||||
return &MssqlResult{s.c, rowCount}, nil |
||||
} |
||||
|
||||
type MssqlRows struct { |
||||
sess *tdsSession |
||||
cols []columnStruct |
||||
tokchan chan tokenStruct |
||||
|
||||
nextCols []columnStruct |
||||
|
||||
cancel func() |
||||
} |
||||
|
||||
func (rc *MssqlRows) Close() error { |
||||
rc.cancel() |
||||
for _ = range rc.tokchan { |
||||
} |
||||
rc.tokchan = nil |
||||
return nil |
||||
} |
||||
|
||||
func (rc *MssqlRows) Columns() (res []string) { |
||||
res = make([]string, len(rc.cols)) |
||||
for i, col := range rc.cols { |
||||
res[i] = col.ColName |
||||
} |
||||
return |
||||
} |
||||
|
||||
func (rc *MssqlRows) Next(dest []driver.Value) error { |
||||
if rc.nextCols != nil { |
||||
return io.EOF |
||||
} |
||||
for tok := range rc.tokchan { |
||||
switch tokdata := tok.(type) { |
||||
case []columnStruct: |
||||
rc.nextCols = tokdata |
||||
return io.EOF |
||||
case []interface{}: |
||||
for i := range dest { |
||||
dest[i] = tokdata[i] |
||||
} |
||||
return nil |
||||
case doneStruct: |
||||
if tokdata.isError() { |
||||
return tokdata.getError() |
||||
} |
||||
case error: |
||||
return tokdata |
||||
} |
||||
} |
||||
return io.EOF |
||||
} |
||||
|
||||
func (rc *MssqlRows) HasNextResultSet() bool { |
||||
return rc.nextCols != nil |
||||
} |
||||
|
||||
func (rc *MssqlRows) NextResultSet() error { |
||||
rc.cols = rc.nextCols |
||||
rc.nextCols = nil |
||||
if rc.cols == nil { |
||||
return io.EOF |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// It should return
|
||||
// the value type that can be used to scan types into. For example, the database
|
||||
// column type "bigint" this should return "reflect.TypeOf(int64(0))".
|
||||
func (r *MssqlRows) ColumnTypeScanType(index int) reflect.Type { |
||||
return makeGoLangScanType(r.cols[index].ti) |
||||
} |
||||
|
||||
// RowsColumnTypeDatabaseTypeName may be implemented by Rows. It should return the
|
||||
// database system type name without the length. Type names should be uppercase.
|
||||
// Examples of returned types: "VARCHAR", "NVARCHAR", "VARCHAR2", "CHAR", "TEXT",
|
||||
// "DECIMAL", "SMALLINT", "INT", "BIGINT", "BOOL", "[]BIGINT", "JSONB", "XML",
|
||||
// "TIMESTAMP".
|
||||
func (r *MssqlRows) ColumnTypeDatabaseTypeName(index int) string { |
||||
return makeGoLangTypeName(r.cols[index].ti) |
||||
} |
||||
|
||||
// RowsColumnTypeLength may be implemented by Rows. It should return the length
|
||||
// of the column type if the column is a variable length type. If the column is
|
||||
// not a variable length type ok should return false.
|
||||
// If length is not limited other than system limits, it should return math.MaxInt64.
|
||||
// The following are examples of returned values for various types:
|
||||
// TEXT (math.MaxInt64, true)
|
||||
// varchar(10) (10, true)
|
||||
// nvarchar(10) (10, true)
|
||||
// decimal (0, false)
|
||||
// int (0, false)
|
||||
// bytea(30) (30, true)
|
||||
func (r *MssqlRows) ColumnTypeLength(index int) (int64, bool) { |
||||
return makeGoLangTypeLength(r.cols[index].ti) |
||||
} |
||||
|
||||
// It should return
|
||||
// the precision and scale for decimal types. If not applicable, ok should be false.
|
||||
// The following are examples of returned values for various types:
|
||||
// decimal(38, 4) (38, 4, true)
|
||||
// int (0, 0, false)
|
||||
// decimal (math.MaxInt64, math.MaxInt64, true)
|
||||
func (r *MssqlRows) ColumnTypePrecisionScale(index int) (int64, int64, bool) { |
||||
return makeGoLangTypePrecisionScale(r.cols[index].ti) |
||||
} |
||||
|
||||
// The nullable value should
|
||||
// be true if it is known the column may be null, or false if the column is known
|
||||
// to be not nullable.
|
||||
// If the column nullability is unknown, ok should be false.
|
||||
func (r *MssqlRows) ColumnTypeNullable(index int) (nullable, ok bool) { |
||||
nullable = r.cols[index].Flags&colFlagNullable != 0 |
||||
ok = true |
||||
return |
||||
} |
||||
|
||||
func makeStrParam(val string) (res Param) { |
||||
res.ti.TypeId = typeNVarChar |
||||
res.buffer = str2ucs2(val) |
||||
res.ti.Size = len(res.buffer) |
||||
return |
||||
} |
||||
|
||||
func (s *MssqlStmt) makeParam(val driver.Value) (res Param, err error) { |
||||
if val == nil { |
||||
res.ti.TypeId = typeNVarChar |
||||
res.buffer = nil |
||||
res.ti.Size = 2 |
||||
return |
||||
} |
||||
switch val := val.(type) { |
||||
case int64: |
||||
res.ti.TypeId = typeIntN |
||||
res.buffer = make([]byte, 8) |
||||
res.ti.Size = 8 |
||||
binary.LittleEndian.PutUint64(res.buffer, uint64(val)) |
||||
case float64: |
||||
res.ti.TypeId = typeFltN |
||||
res.ti.Size = 8 |
||||
res.buffer = make([]byte, 8) |
||||
binary.LittleEndian.PutUint64(res.buffer, math.Float64bits(val)) |
||||
case []byte: |
||||
res.ti.TypeId = typeBigVarBin |
||||
res.ti.Size = len(val) |
||||
res.buffer = val |
||||
case string: |
||||
res = makeStrParam(val) |
||||
case bool: |
||||
res.ti.TypeId = typeBitN |
||||
res.ti.Size = 1 |
||||
res.buffer = make([]byte, 1) |
||||
if val { |
||||
res.buffer[0] = 1 |
||||
} |
||||
case time.Time: |
||||
if s.c.sess.loginAck.TDSVersion >= verTDS73 { |
||||
res.ti.TypeId = typeDateTimeOffsetN |
||||
res.ti.Scale = 7 |
||||
res.ti.Size = 10 |
||||
buf := make([]byte, 10) |
||||
res.buffer = buf |
||||
days, ns := dateTime2(val) |
||||
ns /= 100 |
||||
buf[0] = byte(ns) |
||||
buf[1] = byte(ns >> 8) |
||||
buf[2] = byte(ns >> 16) |
||||
buf[3] = byte(ns >> 24) |
||||
buf[4] = byte(ns >> 32) |
||||
buf[5] = byte(days) |
||||
buf[6] = byte(days >> 8) |
||||
buf[7] = byte(days >> 16) |
||||
_, offset := val.Zone() |
||||
offset /= 60 |
||||
buf[8] = byte(offset) |
||||
buf[9] = byte(offset >> 8) |
||||
} else { |
||||
res.ti.TypeId = typeDateTimeN |
||||
res.ti.Size = 8 |
||||
res.buffer = make([]byte, 8) |
||||
ref := time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC) |
||||
dur := val.Sub(ref) |
||||
days := dur / (24 * time.Hour) |
||||
tm := (300 * (dur % (24 * time.Hour))) / time.Second |
||||
binary.LittleEndian.PutUint32(res.buffer[0:4], uint32(days)) |
||||
binary.LittleEndian.PutUint32(res.buffer[4:8], uint32(tm)) |
||||
} |
||||
default: |
||||
err = fmt.Errorf("mssql: unknown type for %T", val) |
||||
return |
||||
} |
||||
return |
||||
} |
||||
|
||||
type MssqlResult struct { |
||||
c *MssqlConn |
||||
rowsAffected int64 |
||||
} |
||||
|
||||
func (r *MssqlResult) RowsAffected() (int64, error) { |
||||
return r.rowsAffected, nil |
||||
} |
||||
|
||||
func (r *MssqlResult) LastInsertId() (int64, error) { |
||||
s, err := r.c.Prepare("select cast(@@identity as bigint)") |
||||
if err != nil { |
||||
return 0, err |
||||
} |
||||
defer s.Close() |
||||
rows, err := s.Query(nil) |
||||
if err != nil { |
||||
return 0, err |
||||
} |
||||
defer rows.Close() |
||||
dest := make([]driver.Value, 1) |
||||
err = rows.Next(dest) |
||||
if err != nil { |
||||
return 0, err |
||||
} |
||||
if dest[0] == nil { |
||||
return -1, errors.New("There is no generated identity value") |
||||
} |
||||
lastInsertId := dest[0].(int64) |
||||
return lastInsertId, nil |
||||
} |
@ -0,0 +1,13 @@
|
||||
// +build go1.3
|
||||
|
||||
package mssql |
||||
|
||||
import ( |
||||
"net" |
||||
) |
||||
|
||||
func init() { |
||||
createDialer = func(p *connectParams) dialer { |
||||
return tcpDialer{&net.Dialer{Timeout: p.dial_timeout, KeepAlive: p.keepAlive}} |
||||
} |
||||
} |
@ -0,0 +1,13 @@
|
||||
// +build !go1.3
|
||||
|
||||
package mssql |
||||
|
||||
import ( |
||||
"net" |
||||
) |
||||
|
||||
func init() { |
||||
createDialer = func(p *connectParams) dialer { |
||||
return tcpDialer{&net.Dialer{Timeout: p.dial_timeout}} |
||||
} |
||||
} |
@ -0,0 +1,71 @@
|
||||
// +build go1.8
|
||||
|
||||
package mssql |
||||
|
||||
import ( |
||||
"context" |
||||
"database/sql" |
||||
"database/sql/driver" |
||||
"errors" |
||||
) |
||||
|
||||
var _ driver.Pinger = &MssqlConn{} |
||||
|
||||
// Ping is used to check if the remote server is avaiable and satisfies the Pinger interface.
|
||||
func (c *MssqlConn) Ping(ctx context.Context) error { |
||||
stmt := &MssqlStmt{c, `select 1;`, 0, nil} |
||||
_, err := stmt.ExecContext(ctx, nil) |
||||
return err |
||||
} |
||||
|
||||
var _ driver.ConnBeginTx = &MssqlConn{} |
||||
|
||||
// BeginTx satisfies ConnBeginTx.
|
||||
func (c *MssqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { |
||||
if opts.ReadOnly { |
||||
return nil, errors.New("Read-only transactions are not supported") |
||||
} |
||||
|
||||
var tdsIsolation isoLevel |
||||
switch sql.IsolationLevel(opts.Isolation) { |
||||
case sql.LevelDefault: |
||||
tdsIsolation = isolationUseCurrent |
||||
case sql.LevelReadUncommitted: |
||||
tdsIsolation = isolationReadUncommited |
||||
case sql.LevelReadCommitted: |
||||
tdsIsolation = isolationReadCommited |
||||
case sql.LevelWriteCommitted: |
||||
return nil, errors.New("LevelWriteCommitted isolation level is not supported") |
||||
case sql.LevelRepeatableRead: |
||||
tdsIsolation = isolationRepeatableRead |
||||
case sql.LevelSnapshot: |
||||
tdsIsolation = isolationSnapshot |
||||
case sql.LevelSerializable: |
||||
tdsIsolation = isolationSerializable |
||||
case sql.LevelLinearizable: |
||||
return nil, errors.New("LevelLinearizable isolation level is not supported") |
||||
default: |
||||
return nil, errors.New("Isolation level is not supported or unknown") |
||||
} |
||||
return c.begin(ctx, tdsIsolation) |
||||
} |
||||
|
||||
func (c *MssqlConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { |
||||
return c.prepareContext(ctx, query) |
||||
} |
||||
|
||||
func (s *MssqlStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { |
||||
list := make([]namedValue, len(args)) |
||||
for i, nv := range args { |
||||
list[i] = namedValue(nv) |
||||
} |
||||
return s.queryContext(ctx, list) |
||||
} |
||||
|
||||
func (s *MssqlStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { |
||||
list := make([]namedValue, len(args)) |
||||
for i, nv := range args { |
||||
list[i] = namedValue(nv) |
||||
} |
||||
return s.exec(ctx, list) |
||||
} |
@ -0,0 +1,99 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"fmt" |
||||
"net" |
||||
"time" |
||||
) |
||||
|
||||
type timeoutConn struct { |
||||
c net.Conn |
||||
timeout time.Duration |
||||
buf *tdsBuffer |
||||
packetPending bool |
||||
continueRead bool |
||||
} |
||||
|
||||
func NewTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn { |
||||
return &timeoutConn{ |
||||
c: conn, |
||||
timeout: timeout, |
||||
} |
||||
} |
||||
|
||||
func (c *timeoutConn) Read(b []byte) (n int, err error) { |
||||
if c.buf != nil { |
||||
if c.packetPending { |
||||
c.packetPending = false |
||||
err = c.buf.FinishPacket() |
||||
if err != nil { |
||||
err = fmt.Errorf("Cannot send handshake packet: %s", err.Error()) |
||||
return |
||||
} |
||||
c.continueRead = false |
||||
} |
||||
if !c.continueRead { |
||||
var packet packetType |
||||
packet, err = c.buf.BeginRead() |
||||
if err != nil { |
||||
err = fmt.Errorf("Cannot read handshake packet: %s", err.Error()) |
||||
return |
||||
} |
||||
if packet != packPrelogin { |
||||
err = fmt.Errorf("unexpected packet %d, expecting prelogin", packet) |
||||
return |
||||
} |
||||
c.continueRead = true |
||||
} |
||||
n, err = c.buf.Read(b) |
||||
return |
||||
} |
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout)) |
||||
if err != nil { |
||||
return |
||||
} |
||||
return c.c.Read(b) |
||||
} |
||||
|
||||
func (c *timeoutConn) Write(b []byte) (n int, err error) { |
||||
if c.buf != nil { |
||||
if !c.packetPending { |
||||
c.buf.BeginPacket(packPrelogin) |
||||
c.packetPending = true |
||||
} |
||||
n, err = c.buf.Write(b) |
||||
if err != nil { |
||||
return |
||||
} |
||||
return |
||||
} |
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout)) |
||||
if err != nil { |
||||
return |
||||
} |
||||
return c.c.Write(b) |
||||
} |
||||
|
||||
func (c timeoutConn) Close() error { |
||||
return c.c.Close() |
||||
} |
||||
|
||||
func (c timeoutConn) LocalAddr() net.Addr { |
||||
return c.c.LocalAddr() |
||||
} |
||||
|
||||
func (c timeoutConn) RemoteAddr() net.Addr { |
||||
return c.c.RemoteAddr() |
||||
} |
||||
|
||||
func (c timeoutConn) SetDeadline(t time.Time) error { |
||||
panic("Not implemented") |
||||
} |
||||
|
||||
func (c timeoutConn) SetReadDeadline(t time.Time) error { |
||||
panic("Not implemented") |
||||
} |
||||
|
||||
func (c timeoutConn) SetWriteDeadline(t time.Time) error { |
||||
panic("Not implemented") |
||||
} |
@ -0,0 +1,283 @@
|
||||
// +build !windows
|
||||
|
||||
package mssql |
||||
|
||||
import ( |
||||
"crypto/des" |
||||
"crypto/md5" |
||||
"crypto/rand" |
||||
"encoding/binary" |
||||
"errors" |
||||
"strings" |
||||
"unicode/utf16" |
||||
|
||||
"golang.org/x/crypto/md4" |
||||
) |
||||
|
||||
const ( |
||||
NEGOTIATE_MESSAGE = 1 |
||||
CHALLENGE_MESSAGE = 2 |
||||
AUTHENTICATE_MESSAGE = 3 |
||||
) |
||||
|
||||
const ( |
||||
NEGOTIATE_UNICODE = 0x00000001 |
||||
NEGOTIATE_OEM = 0x00000002 |
||||
NEGOTIATE_TARGET = 0x00000004 |
||||
NEGOTIATE_SIGN = 0x00000010 |
||||
NEGOTIATE_SEAL = 0x00000020 |
||||
NEGOTIATE_DATAGRAM = 0x00000040 |
||||
NEGOTIATE_LMKEY = 0x00000080 |
||||
NEGOTIATE_NTLM = 0x00000200 |
||||
NEGOTIATE_ANONYMOUS = 0x00000800 |
||||
NEGOTIATE_OEM_DOMAIN_SUPPLIED = 0x00001000 |
||||
NEGOTIATE_OEM_WORKSTATION_SUPPLIED = 0x00002000 |
||||
NEGOTIATE_ALWAYS_SIGN = 0x00008000 |
||||
NEGOTIATE_TARGET_TYPE_DOMAIN = 0x00010000 |
||||
NEGOTIATE_TARGET_TYPE_SERVER = 0x00020000 |
||||
NEGOTIATE_EXTENDED_SESSIONSECURITY = 0x00080000 |
||||
NEGOTIATE_IDENTIFY = 0x00100000 |
||||
REQUEST_NON_NT_SESSION_KEY = 0x00400000 |
||||
NEGOTIATE_TARGET_INFO = 0x00800000 |
||||
NEGOTIATE_VERSION = 0x02000000 |
||||
NEGOTIATE_128 = 0x20000000 |
||||
NEGOTIATE_KEY_EXCH = 0x40000000 |
||||
NEGOTIATE_56 = 0x80000000 |
||||
) |
||||
|
||||
const NEGOTIATE_FLAGS = NEGOTIATE_UNICODE | |
||||
NEGOTIATE_NTLM | |
||||
NEGOTIATE_OEM_DOMAIN_SUPPLIED | |
||||
NEGOTIATE_OEM_WORKSTATION_SUPPLIED | |
||||
NEGOTIATE_ALWAYS_SIGN | |
||||
NEGOTIATE_EXTENDED_SESSIONSECURITY |
||||
|
||||
type NTLMAuth struct { |
||||
Domain string |
||||
UserName string |
||||
Password string |
||||
Workstation string |
||||
} |
||||
|
||||
func getAuth(user, password, service, workstation string) (Auth, bool) { |
||||
if !strings.ContainsRune(user, '\\') { |
||||
return nil, false |
||||
} |
||||
domain_user := strings.SplitN(user, "\\", 2) |
||||
return &NTLMAuth{ |
||||
Domain: domain_user[0], |
||||
UserName: domain_user[1], |
||||
Password: password, |
||||
Workstation: workstation, |
||||
}, true |
||||
} |
||||
|
||||
func utf16le(val string) []byte { |
||||
var v []byte |
||||
for _, r := range val { |
||||
if utf16.IsSurrogate(r) { |
||||
r1, r2 := utf16.EncodeRune(r) |
||||
v = append(v, byte(r1), byte(r1>>8)) |
||||
v = append(v, byte(r2), byte(r2>>8)) |
||||
} else { |
||||
v = append(v, byte(r), byte(r>>8)) |
||||
} |
||||
} |
||||
return v |
||||
} |
||||
|
||||
func (auth *NTLMAuth) InitialBytes() ([]byte, error) { |
||||
domain_len := len(auth.Domain) |
||||
workstation_len := len(auth.Workstation) |
||||
msg := make([]byte, 40+domain_len+workstation_len) |
||||
copy(msg, []byte("NTLMSSP\x00")) |
||||
binary.LittleEndian.PutUint32(msg[8:], NEGOTIATE_MESSAGE) |
||||
binary.LittleEndian.PutUint32(msg[12:], NEGOTIATE_FLAGS) |
||||
// Domain Name Fields
|
||||
binary.LittleEndian.PutUint16(msg[16:], uint16(domain_len)) |
||||
binary.LittleEndian.PutUint16(msg[18:], uint16(domain_len)) |
||||
binary.LittleEndian.PutUint32(msg[20:], 40) |
||||
// Workstation Fields
|
||||
binary.LittleEndian.PutUint16(msg[24:], uint16(workstation_len)) |
||||
binary.LittleEndian.PutUint16(msg[26:], uint16(workstation_len)) |
||||
binary.LittleEndian.PutUint32(msg[28:], uint32(40+domain_len)) |
||||
// Version
|
||||
binary.LittleEndian.PutUint32(msg[32:], 0) |
||||
binary.LittleEndian.PutUint32(msg[36:], 0) |
||||
// Payload
|
||||
copy(msg[40:], auth.Domain) |
||||
copy(msg[40+domain_len:], auth.Workstation) |
||||
return msg, nil |
||||
} |
||||
|
||||
var errorNTLM = errors.New("NTLM protocol error") |
||||
|
||||
func createDesKey(bytes, material []byte) { |
||||
material[0] = bytes[0] |
||||
material[1] = (byte)(bytes[0]<<7 | (bytes[1]&0xff)>>1) |
||||
material[2] = (byte)(bytes[1]<<6 | (bytes[2]&0xff)>>2) |
||||
material[3] = (byte)(bytes[2]<<5 | (bytes[3]&0xff)>>3) |
||||
material[4] = (byte)(bytes[3]<<4 | (bytes[4]&0xff)>>4) |
||||
material[5] = (byte)(bytes[4]<<3 | (bytes[5]&0xff)>>5) |
||||
material[6] = (byte)(bytes[5]<<2 | (bytes[6]&0xff)>>6) |
||||
material[7] = (byte)(bytes[6] << 1) |
||||
} |
||||
|
||||
func oddParity(bytes []byte) { |
||||
for i := 0; i < len(bytes); i++ { |
||||
b := bytes[i] |
||||
needsParity := (((b >> 7) ^ (b >> 6) ^ (b >> 5) ^ (b >> 4) ^ (b >> 3) ^ (b >> 2) ^ (b >> 1)) & 0x01) == 0 |
||||
if needsParity { |
||||
bytes[i] = bytes[i] | byte(0x01) |
||||
} else { |
||||
bytes[i] = bytes[i] & byte(0xfe) |
||||
} |
||||
} |
||||
} |
||||
|
||||
func encryptDes(key []byte, cleartext []byte, ciphertext []byte) { |
||||
var desKey [8]byte |
||||
createDesKey(key, desKey[:]) |
||||
cipher, err := des.NewCipher(desKey[:]) |
||||
if err != nil { |
||||
panic(err) |
||||
} |
||||
cipher.Encrypt(ciphertext, cleartext) |
||||
} |
||||
|
||||
func response(challenge [8]byte, hash [21]byte) (ret [24]byte) { |
||||
encryptDes(hash[:7], challenge[:], ret[:8]) |
||||
encryptDes(hash[7:14], challenge[:], ret[8:16]) |
||||
encryptDes(hash[14:], challenge[:], ret[16:]) |
||||
return |
||||
} |
||||
|
||||
func lmHash(password string) (hash [21]byte) { |
||||
var lmpass [14]byte |
||||
copy(lmpass[:14], []byte(strings.ToUpper(password))) |
||||
magic := []byte("KGS!@#$%") |
||||
encryptDes(lmpass[:7], magic, hash[:8]) |
||||
encryptDes(lmpass[7:], magic, hash[8:]) |
||||
return |
||||
} |
||||
|
||||
func lmResponse(challenge [8]byte, password string) [24]byte { |
||||
hash := lmHash(password) |
||||
return response(challenge, hash) |
||||
} |
||||
|
||||
func ntlmHash(password string) (hash [21]byte) { |
||||
h := md4.New() |
||||
h.Write(utf16le(password)) |
||||
h.Sum(hash[:0]) |
||||
return |
||||
} |
||||
|
||||
func ntResponse(challenge [8]byte, password string) [24]byte { |
||||
hash := ntlmHash(password) |
||||
return response(challenge, hash) |
||||
} |
||||
|
||||
func clientChallenge() (nonce [8]byte) { |
||||
_, err := rand.Read(nonce[:]) |
||||
if err != nil { |
||||
panic(err) |
||||
} |
||||
return |
||||
} |
||||
|
||||
func ntlmSessionResponse(clientNonce [8]byte, serverChallenge [8]byte, password string) [24]byte { |
||||
var sessionHash [16]byte |
||||
h := md5.New() |
||||
h.Write(serverChallenge[:]) |
||||
h.Write(clientNonce[:]) |
||||
h.Sum(sessionHash[:0]) |
||||
var hash [8]byte |
||||
copy(hash[:], sessionHash[:8]) |
||||
passwordHash := ntlmHash(password) |
||||
return response(hash, passwordHash) |
||||
} |
||||
|
||||
func (auth *NTLMAuth) NextBytes(bytes []byte) ([]byte, error) { |
||||
if string(bytes[0:8]) != "NTLMSSP\x00" { |
||||
return nil, errorNTLM |
||||
} |
||||
if binary.LittleEndian.Uint32(bytes[8:12]) != CHALLENGE_MESSAGE { |
||||
return nil, errorNTLM |
||||
} |
||||
flags := binary.LittleEndian.Uint32(bytes[20:24]) |
||||
var challenge [8]byte |
||||
copy(challenge[:], bytes[24:32]) |
||||
|
||||
var lm, nt []byte |
||||
if (flags & NEGOTIATE_EXTENDED_SESSIONSECURITY) != 0 { |
||||
nonce := clientChallenge() |
||||
var lm_bytes [24]byte |
||||
copy(lm_bytes[:8], nonce[:]) |
||||
lm = lm_bytes[:] |
||||
nt_bytes := ntlmSessionResponse(nonce, challenge, auth.Password) |
||||
nt = nt_bytes[:] |
||||
} else { |
||||
lm_bytes := lmResponse(challenge, auth.Password) |
||||
lm = lm_bytes[:] |
||||
nt_bytes := ntResponse(challenge, auth.Password) |
||||
nt = nt_bytes[:] |
||||
} |
||||
lm_len := len(lm) |
||||
nt_len := len(nt) |
||||
|
||||
domain16 := utf16le(auth.Domain) |
||||
domain_len := len(domain16) |
||||
user16 := utf16le(auth.UserName) |
||||
user_len := len(user16) |
||||
workstation16 := utf16le(auth.Workstation) |
||||
workstation_len := len(workstation16) |
||||
|
||||
msg := make([]byte, 88+lm_len+nt_len+domain_len+user_len+workstation_len) |
||||
copy(msg, []byte("NTLMSSP\x00")) |
||||
binary.LittleEndian.PutUint32(msg[8:], AUTHENTICATE_MESSAGE) |
||||
// Lm Challenge Response Fields
|
||||
binary.LittleEndian.PutUint16(msg[12:], uint16(lm_len)) |
||||
binary.LittleEndian.PutUint16(msg[14:], uint16(lm_len)) |
||||
binary.LittleEndian.PutUint32(msg[16:], 88) |
||||
// Nt Challenge Response Fields
|
||||
binary.LittleEndian.PutUint16(msg[20:], uint16(nt_len)) |
||||
binary.LittleEndian.PutUint16(msg[22:], uint16(nt_len)) |
||||
binary.LittleEndian.PutUint32(msg[24:], uint32(88+lm_len)) |
||||
// Domain Name Fields
|
||||
binary.LittleEndian.PutUint16(msg[28:], uint16(domain_len)) |
||||
binary.LittleEndian.PutUint16(msg[30:], uint16(domain_len)) |
||||
binary.LittleEndian.PutUint32(msg[32:], uint32(88+lm_len+nt_len)) |
||||
// User Name Fields
|
||||
binary.LittleEndian.PutUint16(msg[36:], uint16(user_len)) |
||||
binary.LittleEndian.PutUint16(msg[38:], uint16(user_len)) |
||||
binary.LittleEndian.PutUint32(msg[40:], uint32(88+lm_len+nt_len+domain_len)) |
||||
// Workstation Fields
|
||||
binary.LittleEndian.PutUint16(msg[44:], uint16(workstation_len)) |
||||
binary.LittleEndian.PutUint16(msg[46:], uint16(workstation_len)) |
||||
binary.LittleEndian.PutUint32(msg[48:], uint32(88+lm_len+nt_len+domain_len+user_len)) |
||||
// Encrypted Random Session Key Fields
|
||||
binary.LittleEndian.PutUint16(msg[52:], 0) |
||||
binary.LittleEndian.PutUint16(msg[54:], 0) |
||||
binary.LittleEndian.PutUint32(msg[56:], uint32(88+lm_len+nt_len+domain_len+user_len+workstation_len)) |
||||
// Negotiate Flags
|
||||
binary.LittleEndian.PutUint32(msg[60:], flags) |
||||
// Version
|
||||
binary.LittleEndian.PutUint32(msg[64:], 0) |
||||
binary.LittleEndian.PutUint32(msg[68:], 0) |
||||
// MIC
|
||||
binary.LittleEndian.PutUint32(msg[72:], 0) |
||||
binary.LittleEndian.PutUint32(msg[76:], 0) |
||||
binary.LittleEndian.PutUint32(msg[88:], 0) |
||||
binary.LittleEndian.PutUint32(msg[84:], 0) |
||||
// Payload
|
||||
copy(msg[88:], lm) |
||||
copy(msg[88+lm_len:], nt) |
||||
copy(msg[88+lm_len+nt_len:], domain16) |
||||
copy(msg[88+lm_len+nt_len+domain_len:], user16) |
||||
copy(msg[88+lm_len+nt_len+domain_len+user_len:], workstation16) |
||||
return msg, nil |
||||
} |
||||
|
||||
func (auth *NTLMAuth) Free() { |
||||
} |
@ -0,0 +1,257 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"bytes" |
||||
"io" |
||||
"strconv" |
||||
) |
||||
|
||||
type parser struct { |
||||
r *bytes.Reader |
||||
w bytes.Buffer |
||||
paramCount int |
||||
paramMax int |
||||
|
||||
// using map as a set
|
||||
namedParams map [string]bool |
||||
} |
||||
|
||||
func (p *parser) next() (rune, bool) { |
||||
ch, _, err := p.r.ReadRune() |
||||
if err != nil { |
||||
if err != io.EOF { |
||||
panic(err) |
||||
} |
||||
return 0, false |
||||
} |
||||
return ch, true |
||||
} |
||||
|
||||
func (p *parser) unread() { |
||||
err := p.r.UnreadRune() |
||||
if err != nil { |
||||
panic(err) |
||||
} |
||||
} |
||||
|
||||
func (p *parser) write(ch rune) { |
||||
p.w.WriteRune(ch) |
||||
} |
||||
|
||||
type stateFunc func(*parser) stateFunc |
||||
|
||||
func parseParams(query string) (string, int) { |
||||
p := &parser{ |
||||
r: bytes.NewReader([]byte(query)), |
||||
namedParams: map [string]bool{}, |
||||
} |
||||
state := parseNormal |
||||
for state != nil { |
||||
state = state(p) |
||||
} |
||||
return p.w.String(), p.paramMax + len(p.namedParams) |
||||
} |
||||
|
||||
func parseNormal(p *parser) stateFunc { |
||||
for { |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
if ch == '?' { |
||||
return parseOrdinalParameter |
||||
} else if ch == '$' || ch == ':' { |
||||
ch2, ok := p.next() |
||||
if !ok { |
||||
p.write(ch) |
||||
return nil |
||||
} |
||||
p.unread() |
||||
if ch2 >= '0' && ch2 <= '9' { |
||||
return parseOrdinalParameter |
||||
} else if 'a' <= ch2 && ch2 <= 'z' || 'A' <= ch2 && ch2 <= 'Z' { |
||||
return parseNamedParameter |
||||
} |
||||
} |
||||
p.write(ch) |
||||
switch ch { |
||||
case '\'': |
||||
return parseQuote |
||||
case '"': |
||||
return parseDoubleQuote |
||||
case '[': |
||||
return parseBracket |
||||
case '-': |
||||
return parseLineComment |
||||
case '/': |
||||
return parseComment |
||||
} |
||||
} |
||||
} |
||||
|
||||
func parseOrdinalParameter(p *parser) stateFunc { |
||||
var paramN int |
||||
var ok bool |
||||
for { |
||||
var ch rune |
||||
ch, ok = p.next() |
||||
if ok && ch >= '0' && ch <= '9' { |
||||
paramN = paramN*10 + int(ch-'0') |
||||
} else { |
||||
break |
||||
} |
||||
} |
||||
if ok { |
||||
p.unread() |
||||
} |
||||
if paramN == 0 { |
||||
p.paramCount++ |
||||
paramN = p.paramCount |
||||
} |
||||
if paramN > p.paramMax { |
||||
p.paramMax = paramN |
||||
} |
||||
p.w.WriteString("@p") |
||||
p.w.WriteString(strconv.Itoa(paramN)) |
||||
if !ok { |
||||
return nil |
||||
} |
||||
return parseNormal |
||||
} |
||||
|
||||
func parseNamedParameter(p *parser) stateFunc { |
||||
var paramName string |
||||
var ok bool |
||||
for { |
||||
var ch rune |
||||
ch, ok = p.next() |
||||
if ok && (ch >= '0' && ch <= '9' || 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z') { |
||||
paramName = paramName + string(ch) |
||||
} else { |
||||
break |
||||
} |
||||
} |
||||
if ok { |
||||
p.unread() |
||||
} |
||||
p.namedParams[paramName] = true |
||||
p.w.WriteString("@") |
||||
p.w.WriteString(paramName) |
||||
if !ok { |
||||
return nil |
||||
} |
||||
return parseNormal |
||||
} |
||||
|
||||
func parseQuote(p *parser) stateFunc { |
||||
for { |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == '\'' { |
||||
return parseNormal |
||||
} |
||||
} |
||||
} |
||||
|
||||
func parseDoubleQuote(p *parser) stateFunc { |
||||
for { |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == '"' { |
||||
return parseNormal |
||||
} |
||||
} |
||||
} |
||||
|
||||
func parseBracket(p *parser) stateFunc { |
||||
for { |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == ']' { |
||||
ch, ok = p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
if ch != ']' { |
||||
p.unread() |
||||
return parseNormal |
||||
} |
||||
p.write(ch) |
||||
} |
||||
} |
||||
} |
||||
|
||||
func parseLineComment(p *parser) stateFunc { |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
if ch != '-' { |
||||
p.unread() |
||||
return parseNormal |
||||
} |
||||
p.write(ch) |
||||
for { |
||||
ch, ok = p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == '\n' { |
||||
return parseNormal |
||||
} |
||||
} |
||||
} |
||||
|
||||
func parseComment(p *parser) stateFunc { |
||||
var nested int |
||||
ch, ok := p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
if ch != '*' { |
||||
p.unread() |
||||
return parseNormal |
||||
} |
||||
p.write(ch) |
||||
for { |
||||
ch, ok = p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
for ch == '*' { |
||||
ch, ok = p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == '/' { |
||||
if nested == 0 { |
||||
return parseNormal |
||||
} else { |
||||
nested-- |
||||
} |
||||
} |
||||
} |
||||
for ch == '/' { |
||||
ch, ok = p.next() |
||||
if !ok { |
||||
return nil |
||||
} |
||||
p.write(ch) |
||||
if ch == '*' { |
||||
nested++ |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,100 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"encoding/binary" |
||||
) |
||||
|
||||
type ProcId struct { |
||||
id uint16 |
||||
name string |
||||
} |
||||
|
||||
// parameter flags
|
||||
const ( |
||||
fByRevValue = 1 |
||||
fDefaultValue = 2 |
||||
) |
||||
|
||||
type Param struct { |
||||
Name string |
||||
Flags uint8 |
||||
ti typeInfo |
||||
buffer []byte |
||||
} |
||||
|
||||
func MakeProcId(name string) (res ProcId) { |
||||
res.name = name |
||||
if len(name) == 0 { |
||||
panic("Proc name shouln't be empty") |
||||
} |
||||
if len(name) >= 0xffff { |
||||
panic("Invalid length of procedure name, should be less than 0xffff") |
||||
} |
||||
return res |
||||
} |
||||
|
||||
const ( |
||||
fWithRecomp = 1 |
||||
fNoMetaData = 2 |
||||
fReuseMetaData = 4 |
||||
) |
||||
|
||||
var ( |
||||
Sp_Cursor = ProcId{1, ""} |
||||
Sp_CursorOpen = ProcId{2, ""} |
||||
Sp_CursorPrepare = ProcId{3, ""} |
||||
Sp_CursorExecute = ProcId{4, ""} |
||||
Sp_CursorPrepExec = ProcId{5, ""} |
||||
Sp_CursorUnprepare = ProcId{6, ""} |
||||
Sp_CursorFetch = ProcId{7, ""} |
||||
Sp_CursorOption = ProcId{8, ""} |
||||
Sp_CursorClose = ProcId{9, ""} |
||||
Sp_ExecuteSql = ProcId{10, ""} |
||||
Sp_Prepare = ProcId{11, ""} |
||||
Sp_PrepExec = ProcId{13, ""} |
||||
Sp_PrepExecRpc = ProcId{14, ""} |
||||
Sp_Unprepare = ProcId{15, ""} |
||||
) |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd357576.aspx
|
||||
func sendRpc(buf *tdsBuffer, headers []headerStruct, proc ProcId, flags uint16, params []Param) (err error) { |
||||
buf.BeginPacket(packRPCRequest) |
||||
writeAllHeaders(buf, headers) |
||||
if len(proc.name) == 0 { |
||||
var idswitch uint16 = 0xffff |
||||
err = binary.Write(buf, binary.LittleEndian, &idswitch) |
||||
if err != nil { |
||||
return |
||||
} |
||||
err = binary.Write(buf, binary.LittleEndian, &proc.id) |
||||
if err != nil { |
||||
return |
||||
} |
||||
} else { |
||||
err = writeUsVarChar(buf, proc.name) |
||||
if err != nil { |
||||
return |
||||
} |
||||
} |
||||
err = binary.Write(buf, binary.LittleEndian, &flags) |
||||
if err != nil { |
||||
return |
||||
} |
||||
for _, param := range params { |
||||
if err = writeBVarChar(buf, param.Name); err != nil { |
||||
return |
||||
} |
||||
if err = binary.Write(buf, binary.LittleEndian, param.Flags); err != nil { |
||||
return |
||||
} |
||||
err = writeTypeInfo(buf, ¶m.ti) |
||||
if err != nil { |
||||
return |
||||
} |
||||
err = param.ti.Writer(buf, param.ti, param.buffer) |
||||
if err != nil { |
||||
return |
||||
} |
||||
} |
||||
return buf.FinishPacket() |
||||
} |
@ -0,0 +1,266 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"fmt" |
||||
"strings" |
||||
"syscall" |
||||
"unsafe" |
||||
) |
||||
|
||||
var ( |
||||
secur32_dll = syscall.NewLazyDLL("secur32.dll") |
||||
initSecurityInterface = secur32_dll.NewProc("InitSecurityInterfaceW") |
||||
sec_fn *SecurityFunctionTable |
||||
) |
||||
|
||||
func init() { |
||||
ptr, _, _ := initSecurityInterface.Call() |
||||
sec_fn = (*SecurityFunctionTable)(unsafe.Pointer(ptr)) |
||||
} |
||||
|
||||
const ( |
||||
SEC_E_OK = 0 |
||||
SECPKG_CRED_OUTBOUND = 2 |
||||
SEC_WINNT_AUTH_IDENTITY_UNICODE = 2 |
||||
ISC_REQ_DELEGATE = 0x00000001 |
||||
ISC_REQ_REPLAY_DETECT = 0x00000004 |
||||
ISC_REQ_SEQUENCE_DETECT = 0x00000008 |
||||
ISC_REQ_CONFIDENTIALITY = 0x00000010 |
||||
ISC_REQ_CONNECTION = 0x00000800 |
||||
SECURITY_NETWORK_DREP = 0 |
||||
SEC_I_CONTINUE_NEEDED = 0x00090312 |
||||
SEC_I_COMPLETE_NEEDED = 0x00090313 |
||||
SEC_I_COMPLETE_AND_CONTINUE = 0x00090314 |
||||
SECBUFFER_VERSION = 0 |
||||
SECBUFFER_TOKEN = 2 |
||||
NTLMBUF_LEN = 12000 |
||||
) |
||||
|
||||
const ISC_REQ = ISC_REQ_CONFIDENTIALITY | |
||||
ISC_REQ_REPLAY_DETECT | |
||||
ISC_REQ_SEQUENCE_DETECT | |
||||
ISC_REQ_CONNECTION | |
||||
ISC_REQ_DELEGATE |
||||
|
||||
type SecurityFunctionTable struct { |
||||
dwVersion uint32 |
||||
EnumerateSecurityPackages uintptr |
||||
QueryCredentialsAttributes uintptr |
||||
AcquireCredentialsHandle uintptr |
||||
FreeCredentialsHandle uintptr |
||||
Reserved2 uintptr |
||||
InitializeSecurityContext uintptr |
||||
AcceptSecurityContext uintptr |
||||
CompleteAuthToken uintptr |
||||
DeleteSecurityContext uintptr |
||||
ApplyControlToken uintptr |
||||
QueryContextAttributes uintptr |
||||
ImpersonateSecurityContext uintptr |
||||
RevertSecurityContext uintptr |
||||
MakeSignature uintptr |
||||
VerifySignature uintptr |
||||
FreeContextBuffer uintptr |
||||
QuerySecurityPackageInfo uintptr |
||||
Reserved3 uintptr |
||||
Reserved4 uintptr |
||||
Reserved5 uintptr |
||||
Reserved6 uintptr |
||||
Reserved7 uintptr |
||||
Reserved8 uintptr |
||||
QuerySecurityContextToken uintptr |
||||
EncryptMessage uintptr |
||||
DecryptMessage uintptr |
||||
} |
||||
|
||||
type SEC_WINNT_AUTH_IDENTITY struct { |
||||
User *uint16 |
||||
UserLength uint32 |
||||
Domain *uint16 |
||||
DomainLength uint32 |
||||
Password *uint16 |
||||
PasswordLength uint32 |
||||
Flags uint32 |
||||
} |
||||
|
||||
type TimeStamp struct { |
||||
LowPart uint32 |
||||
HighPart int32 |
||||
} |
||||
|
||||
type SecHandle struct { |
||||
dwLower uintptr |
||||
dwUpper uintptr |
||||
} |
||||
|
||||
type SecBuffer struct { |
||||
cbBuffer uint32 |
||||
BufferType uint32 |
||||
pvBuffer *byte |
||||
} |
||||
|
||||
type SecBufferDesc struct { |
||||
ulVersion uint32 |
||||
cBuffers uint32 |
||||
pBuffers *SecBuffer |
||||
} |
||||
|
||||
type SSPIAuth struct { |
||||
Domain string |
||||
UserName string |
||||
Password string |
||||
Service string |
||||
cred SecHandle |
||||
ctxt SecHandle |
||||
} |
||||
|
||||
func getAuth(user, password, service, workstation string) (Auth, bool) { |
||||
if user == "" { |
||||
return &SSPIAuth{Service: service}, true |
||||
} |
||||
if !strings.ContainsRune(user, '\\') { |
||||
return nil, false |
||||
} |
||||
domain_user := strings.SplitN(user, "\\", 2) |
||||
return &SSPIAuth{ |
||||
Domain: domain_user[0], |
||||
UserName: domain_user[1], |
||||
Password: password, |
||||
Service: service, |
||||
}, true |
||||
} |
||||
|
||||
func (auth *SSPIAuth) InitialBytes() ([]byte, error) { |
||||
var identity *SEC_WINNT_AUTH_IDENTITY |
||||
if auth.UserName != "" { |
||||
identity = &SEC_WINNT_AUTH_IDENTITY{ |
||||
Flags: SEC_WINNT_AUTH_IDENTITY_UNICODE, |
||||
Password: syscall.StringToUTF16Ptr(auth.Password), |
||||
PasswordLength: uint32(len(auth.Password)), |
||||
Domain: syscall.StringToUTF16Ptr(auth.Domain), |
||||
DomainLength: uint32(len(auth.Domain)), |
||||
User: syscall.StringToUTF16Ptr(auth.UserName), |
||||
UserLength: uint32(len(auth.UserName)), |
||||
} |
||||
} |
||||
var ts TimeStamp |
||||
sec_ok, _, _ := syscall.Syscall9(sec_fn.AcquireCredentialsHandle, |
||||
9, |
||||
0, |
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("Negotiate"))), |
||||
SECPKG_CRED_OUTBOUND, |
||||
0, |
||||
uintptr(unsafe.Pointer(identity)), |
||||
0, |
||||
0, |
||||
uintptr(unsafe.Pointer(&auth.cred)), |
||||
uintptr(unsafe.Pointer(&ts))) |
||||
if sec_ok != SEC_E_OK { |
||||
return nil, fmt.Errorf("AcquireCredentialsHandle failed %x", sec_ok) |
||||
} |
||||
|
||||
var buf SecBuffer |
||||
var desc SecBufferDesc |
||||
desc.ulVersion = SECBUFFER_VERSION |
||||
desc.cBuffers = 1 |
||||
desc.pBuffers = &buf |
||||
|
||||
outbuf := make([]byte, NTLMBUF_LEN) |
||||
buf.cbBuffer = NTLMBUF_LEN |
||||
buf.BufferType = SECBUFFER_TOKEN |
||||
buf.pvBuffer = &outbuf[0] |
||||
|
||||
var attrs uint32 |
||||
sec_ok, _, _ = syscall.Syscall12(sec_fn.InitializeSecurityContext, |
||||
12, |
||||
uintptr(unsafe.Pointer(&auth.cred)), |
||||
0, |
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(auth.Service))), |
||||
ISC_REQ, |
||||
0, |
||||
SECURITY_NETWORK_DREP, |
||||
0, |
||||
0, |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
uintptr(unsafe.Pointer(&desc)), |
||||
uintptr(unsafe.Pointer(&attrs)), |
||||
uintptr(unsafe.Pointer(&ts))) |
||||
if sec_ok == SEC_I_COMPLETE_AND_CONTINUE || |
||||
sec_ok == SEC_I_COMPLETE_NEEDED { |
||||
syscall.Syscall6(sec_fn.CompleteAuthToken, |
||||
2, |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
uintptr(unsafe.Pointer(&desc)), |
||||
0, 0, 0, 0) |
||||
} else if sec_ok != SEC_E_OK && |
||||
sec_ok != SEC_I_CONTINUE_NEEDED { |
||||
syscall.Syscall6(sec_fn.FreeCredentialsHandle, |
||||
1, |
||||
uintptr(unsafe.Pointer(&auth.cred)), |
||||
0, 0, 0, 0, 0) |
||||
return nil, fmt.Errorf("InitialBytes InitializeSecurityContext failed %x", sec_ok) |
||||
} |
||||
return outbuf[:buf.cbBuffer], nil |
||||
} |
||||
|
||||
func (auth *SSPIAuth) NextBytes(bytes []byte) ([]byte, error) { |
||||
var in_buf, out_buf SecBuffer |
||||
var in_desc, out_desc SecBufferDesc |
||||
|
||||
in_desc.ulVersion = SECBUFFER_VERSION |
||||
in_desc.cBuffers = 1 |
||||
in_desc.pBuffers = &in_buf |
||||
|
||||
out_desc.ulVersion = SECBUFFER_VERSION |
||||
out_desc.cBuffers = 1 |
||||
out_desc.pBuffers = &out_buf |
||||
|
||||
in_buf.BufferType = SECBUFFER_TOKEN |
||||
in_buf.pvBuffer = &bytes[0] |
||||
in_buf.cbBuffer = uint32(len(bytes)) |
||||
|
||||
outbuf := make([]byte, NTLMBUF_LEN) |
||||
out_buf.BufferType = SECBUFFER_TOKEN |
||||
out_buf.pvBuffer = &outbuf[0] |
||||
out_buf.cbBuffer = NTLMBUF_LEN |
||||
|
||||
var attrs uint32 |
||||
var ts TimeStamp |
||||
sec_ok, _, _ := syscall.Syscall12(sec_fn.InitializeSecurityContext, |
||||
12, |
||||
uintptr(unsafe.Pointer(&auth.cred)), |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(auth.Service))), |
||||
ISC_REQ, |
||||
0, |
||||
SECURITY_NETWORK_DREP, |
||||
uintptr(unsafe.Pointer(&in_desc)), |
||||
0, |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
uintptr(unsafe.Pointer(&out_desc)), |
||||
uintptr(unsafe.Pointer(&attrs)), |
||||
uintptr(unsafe.Pointer(&ts))) |
||||
if sec_ok == SEC_I_COMPLETE_AND_CONTINUE || |
||||
sec_ok == SEC_I_COMPLETE_NEEDED { |
||||
syscall.Syscall6(sec_fn.CompleteAuthToken, |
||||
2, |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
uintptr(unsafe.Pointer(&out_desc)), |
||||
0, 0, 0, 0) |
||||
} else if sec_ok != SEC_E_OK && |
||||
sec_ok != SEC_I_CONTINUE_NEEDED { |
||||
return nil, fmt.Errorf("NextBytes InitializeSecurityContext failed %x", sec_ok) |
||||
} |
||||
|
||||
return outbuf[:out_buf.cbBuffer], nil |
||||
} |
||||
|
||||
func (auth *SSPIAuth) Free() { |
||||
syscall.Syscall6(sec_fn.DeleteSecurityContext, |
||||
1, |
||||
uintptr(unsafe.Pointer(&auth.ctxt)), |
||||
0, 0, 0, 0, 0) |
||||
syscall.Syscall6(sec_fn.FreeCredentialsHandle, |
||||
1, |
||||
uintptr(unsafe.Pointer(&auth.cred)), |
||||
0, 0, 0, 0, 0) |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,754 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"encoding/binary" |
||||
"errors" |
||||
"io" |
||||
"net" |
||||
"strconv" |
||||
"strings" |
||||
|
||||
"golang.org/x/net/context" |
||||
) |
||||
|
||||
//go:generate stringer -type token
|
||||
|
||||
type token byte |
||||
|
||||
// token ids
|
||||
const ( |
||||
tokenReturnStatus token = 121 // 0x79
|
||||
tokenColMetadata token = 129 // 0x81
|
||||
tokenOrder token = 169 // 0xA9
|
||||
tokenError token = 170 // 0xAA
|
||||
tokenInfo token = 171 // 0xAB
|
||||
tokenLoginAck token = 173 // 0xad
|
||||
tokenRow token = 209 // 0xd1
|
||||
tokenNbcRow token = 210 // 0xd2
|
||||
tokenEnvChange token = 227 // 0xE3
|
||||
tokenSSPI token = 237 // 0xED
|
||||
tokenDone token = 253 // 0xFD
|
||||
tokenDoneProc token = 254 |
||||
tokenDoneInProc token = 255 |
||||
) |
||||
|
||||
// done flags
|
||||
// https://msdn.microsoft.com/en-us/library/dd340421.aspx
|
||||
const ( |
||||
doneFinal = 0 |
||||
doneMore = 1 |
||||
doneError = 2 |
||||
doneInxact = 4 |
||||
doneCount = 0x10 |
||||
doneAttn = 0x20 |
||||
doneSrvError = 0x100 |
||||
) |
||||
|
||||
// ENVCHANGE types
|
||||
// http://msdn.microsoft.com/en-us/library/dd303449.aspx
|
||||
const ( |
||||
envTypDatabase = 1 |
||||
envTypLanguage = 2 |
||||
envTypCharset = 3 |
||||
envTypPacketSize = 4 |
||||
envSortId = 5 |
||||
envSortFlags = 6 |
||||
envSqlCollation = 7 |
||||
envTypBeginTran = 8 |
||||
envTypCommitTran = 9 |
||||
envTypRollbackTran = 10 |
||||
envEnlistDTC = 11 |
||||
envDefectTran = 12 |
||||
envDatabaseMirrorPartner = 13 |
||||
envPromoteTran = 15 |
||||
envTranMgrAddr = 16 |
||||
envTranEnded = 17 |
||||
envResetConnAck = 18 |
||||
envStartedInstanceName = 19 |
||||
envRouting = 20 |
||||
) |
||||
|
||||
// COLMETADATA flags
|
||||
// https://msdn.microsoft.com/en-us/library/dd357363.aspx
|
||||
const ( |
||||
colFlagNullable = 1 |
||||
// TODO implement more flags
|
||||
) |
||||
|
||||
// interface for all tokens
|
||||
type tokenStruct interface{} |
||||
|
||||
type orderStruct struct { |
||||
ColIds []uint16 |
||||
} |
||||
|
||||
type doneStruct struct { |
||||
Status uint16 |
||||
CurCmd uint16 |
||||
RowCount uint64 |
||||
errors []Error |
||||
} |
||||
|
||||
func (d doneStruct) isError() bool { |
||||
return d.Status&doneError != 0 || len(d.errors) > 0 |
||||
} |
||||
|
||||
func (d doneStruct) getError() Error { |
||||
if len(d.errors) > 0 { |
||||
return d.errors[len(d.errors)-1] |
||||
} else { |
||||
return Error{Message: "Request failed but didn't provide reason"} |
||||
} |
||||
} |
||||
|
||||
type doneInProcStruct doneStruct |
||||
|
||||
var doneFlags2str = map[uint16]string{ |
||||
doneFinal: "final", |
||||
doneMore: "more", |
||||
doneError: "error", |
||||
doneInxact: "inxact", |
||||
doneCount: "count", |
||||
doneAttn: "attn", |
||||
doneSrvError: "srverror", |
||||
} |
||||
|
||||
func doneFlags2Str(flags uint16) string { |
||||
strs := make([]string, 0, len(doneFlags2str)) |
||||
for flag, tag := range doneFlags2str { |
||||
if flags&flag != 0 { |
||||
strs = append(strs, tag) |
||||
} |
||||
} |
||||
return strings.Join(strs, "|") |
||||
} |
||||
|
||||
// ENVCHANGE stream
|
||||
// http://msdn.microsoft.com/en-us/library/dd303449.aspx
|
||||
func processEnvChg(sess *tdsSession) { |
||||
size := sess.buf.uint16() |
||||
r := &io.LimitedReader{R: sess.buf, N: int64(size)} |
||||
for { |
||||
var err error |
||||
var envtype uint8 |
||||
err = binary.Read(r, binary.LittleEndian, &envtype) |
||||
if err == io.EOF { |
||||
return |
||||
} |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
switch envtype { |
||||
case envTypDatabase: |
||||
sess.database, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTypLanguage: |
||||
//currently ignored
|
||||
// old value
|
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTypCharset: |
||||
//currently ignored
|
||||
// old value
|
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTypPacketSize: |
||||
packetsize, err := readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
packetsizei, err := strconv.Atoi(packetsize) |
||||
if err != nil { |
||||
badStreamPanicf("Invalid Packet size value returned from server (%s): %s", packetsize, err.Error()) |
||||
} |
||||
sess.buf.ResizeBuffer(packetsizei) |
||||
case envSortId: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envSortFlags: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envSqlCollation: |
||||
// currently ignored
|
||||
// old value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTypBeginTran: |
||||
tranid, err := readBVarByte(r) |
||||
if len(tranid) != 8 { |
||||
badStreamPanicf("invalid size of transaction identifier: %d", len(tranid)) |
||||
} |
||||
sess.tranid = binary.LittleEndian.Uint64(tranid) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
if sess.logFlags&logTransaction != 0 { |
||||
sess.log.Printf("BEGIN TRANSACTION %x\n", sess.tranid) |
||||
} |
||||
_, err = readBVarByte(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTypCommitTran, envTypRollbackTran: |
||||
_, err = readBVarByte(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
_, err = readBVarByte(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
if sess.logFlags&logTransaction != 0 { |
||||
if envtype == envTypCommitTran { |
||||
sess.log.Printf("COMMIT TRANSACTION %x\n", sess.tranid) |
||||
} else { |
||||
sess.log.Printf("ROLLBACK TRANSACTION %x\n", sess.tranid) |
||||
} |
||||
} |
||||
sess.tranid = 0 |
||||
case envEnlistDTC: |
||||
// currently ignored
|
||||
// old value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envDefectTran: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// new value
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envDatabaseMirrorPartner: |
||||
sess.partner, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
_, err = readBVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envPromoteTran: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// dtc token
|
||||
// spec says it should be L_VARBYTE, so this code might be wrong
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTranMgrAddr: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// XACT_MANAGER_ADDRESS = B_VARBYTE
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envTranEnded: |
||||
// currently ignored
|
||||
// old value, B_VARBYTE
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envResetConnAck: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envStartedInstanceName: |
||||
// currently ignored
|
||||
// old value, should be 0
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// instance name
|
||||
if _, err = readBVarChar(r); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
case envRouting: |
||||
// RoutingData message is:
|
||||
// ValueLength USHORT
|
||||
// Protocol (TCP = 0) BYTE
|
||||
// ProtocolProperty (new port) USHORT
|
||||
// AlternateServer US_VARCHAR
|
||||
_, err := readUshort(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
protocol, err := readByte(r) |
||||
if err != nil || protocol != 0 { |
||||
badStreamPanic(err) |
||||
} |
||||
newPort, err := readUshort(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
newServer, err := readUsVarChar(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
// consume the OLDVALUE = %x00 %x00
|
||||
_, err = readUshort(r) |
||||
if err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
sess.routedServer = newServer |
||||
sess.routedPort = newPort |
||||
default: |
||||
// ignore rest of records because we don't know how to skip those
|
||||
sess.log.Printf("WARN: Unknown ENVCHANGE record detected with type id = %d\n", envtype) |
||||
break |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
type returnStatus int32 |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd358180.aspx
|
||||
func parseReturnStatus(r *tdsBuffer) returnStatus { |
||||
return returnStatus(r.int32()) |
||||
} |
||||
|
||||
func parseOrder(r *tdsBuffer) (res orderStruct) { |
||||
len := int(r.uint16()) |
||||
res.ColIds = make([]uint16, len/2) |
||||
for i := 0; i < len/2; i++ { |
||||
res.ColIds[i] = r.uint16() |
||||
} |
||||
return res |
||||
} |
||||
|
||||
// https://msdn.microsoft.com/en-us/library/dd340421.aspx
|
||||
func parseDone(r *tdsBuffer) (res doneStruct) { |
||||
res.Status = r.uint16() |
||||
res.CurCmd = r.uint16() |
||||
res.RowCount = r.uint64() |
||||
return res |
||||
} |
||||
|
||||
// https://msdn.microsoft.com/en-us/library/dd340553.aspx
|
||||
func parseDoneInProc(r *tdsBuffer) (res doneInProcStruct) { |
||||
res.Status = r.uint16() |
||||
res.CurCmd = r.uint16() |
||||
res.RowCount = r.uint64() |
||||
return res |
||||
} |
||||
|
||||
type sspiMsg []byte |
||||
|
||||
func parseSSPIMsg(r *tdsBuffer) sspiMsg { |
||||
size := r.uint16() |
||||
buf := make([]byte, size) |
||||
r.ReadFull(buf) |
||||
return sspiMsg(buf) |
||||
} |
||||
|
||||
type loginAckStruct struct { |
||||
Interface uint8 |
||||
TDSVersion uint32 |
||||
ProgName string |
||||
ProgVer uint32 |
||||
} |
||||
|
||||
func parseLoginAck(r *tdsBuffer) loginAckStruct { |
||||
size := r.uint16() |
||||
buf := make([]byte, size) |
||||
r.ReadFull(buf) |
||||
var res loginAckStruct |
||||
res.Interface = buf[0] |
||||
res.TDSVersion = binary.BigEndian.Uint32(buf[1:]) |
||||
prognamelen := buf[1+4] |
||||
var err error |
||||
if res.ProgName, err = ucs22str(buf[1+4+1 : 1+4+1+prognamelen*2]); err != nil { |
||||
badStreamPanic(err) |
||||
} |
||||
res.ProgVer = binary.BigEndian.Uint32(buf[size-4:]) |
||||
return res |
||||
} |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd357363.aspx
|
||||
func parseColMetadata72(r *tdsBuffer) (columns []columnStruct) { |
||||
count := r.uint16() |
||||
if count == 0xffff { |
||||
// no metadata is sent
|
||||
return nil |
||||
} |
||||
columns = make([]columnStruct, count) |
||||
for i := range columns { |
||||
column := &columns[i] |
||||
column.UserType = r.uint32() |
||||
column.Flags = r.uint16() |
||||
|
||||
// parsing TYPE_INFO structure
|
||||
column.ti = readTypeInfo(r) |
||||
column.ColName = r.BVarChar() |
||||
} |
||||
return columns |
||||
} |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd357254.aspx
|
||||
func parseRow(r *tdsBuffer, columns []columnStruct, row []interface{}) { |
||||
for i, column := range columns { |
||||
row[i] = column.ti.Reader(&column.ti, r) |
||||
} |
||||
} |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd304783.aspx
|
||||
func parseNbcRow(r *tdsBuffer, columns []columnStruct, row []interface{}) { |
||||
bitlen := (len(columns) + 7) / 8 |
||||
pres := make([]byte, bitlen) |
||||
r.ReadFull(pres) |
||||
for i, col := range columns { |
||||
if pres[i/8]&(1<<(uint(i)%8)) != 0 { |
||||
row[i] = nil |
||||
continue |
||||
} |
||||
row[i] = col.ti.Reader(&col.ti, r) |
||||
} |
||||
} |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd304156.aspx
|
||||
func parseError72(r *tdsBuffer) (res Error) { |
||||
length := r.uint16() |
||||
_ = length // ignore length
|
||||
res.Number = r.int32() |
||||
res.State = r.byte() |
||||
res.Class = r.byte() |
||||
res.Message = r.UsVarChar() |
||||
res.ServerName = r.BVarChar() |
||||
res.ProcName = r.BVarChar() |
||||
res.LineNo = r.int32() |
||||
return |
||||
} |
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd304156.aspx
|
||||
func parseInfo(r *tdsBuffer) (res Error) { |
||||
length := r.uint16() |
||||
_ = length // ignore length
|
||||
res.Number = r.int32() |
||||
res.State = r.byte() |
||||
res.Class = r.byte() |
||||
res.Message = r.UsVarChar() |
||||
res.ServerName = r.BVarChar() |
||||
res.ProcName = r.BVarChar() |
||||
res.LineNo = r.int32() |
||||
return |
||||
} |
||||
|
||||
func processSingleResponse(sess *tdsSession, ch chan tokenStruct) { |
||||
defer func() { |
||||
if err := recover(); err != nil { |
||||
if sess.logFlags&logErrors != 0 { |
||||
sess.log.Printf("ERROR: Intercepted panic %v", err) |
||||
} |
||||
ch <- err |
||||
} |
||||
close(ch) |
||||
}() |
||||
|
||||
packet_type, err := sess.buf.BeginRead() |
||||
if err != nil { |
||||
if sess.logFlags&logErrors != 0 { |
||||
sess.log.Printf("ERROR: BeginRead failed %v", err) |
||||
} |
||||
ch <- err |
||||
return |
||||
} |
||||
if packet_type != packReply { |
||||
badStreamPanicf("invalid response packet type, expected REPLY, actual: %d", packet_type) |
||||
} |
||||
var columns []columnStruct |
||||
errs := make([]Error, 0, 5) |
||||
for { |
||||
token := token(sess.buf.byte()) |
||||
if sess.logFlags&logDebug != 0 { |
||||
sess.log.Printf("got token %v", token) |
||||
} |
||||
switch token { |
||||
case tokenSSPI: |
||||
ch <- parseSSPIMsg(sess.buf) |
||||
return |
||||
case tokenReturnStatus: |
||||
returnStatus := parseReturnStatus(sess.buf) |
||||
ch <- returnStatus |
||||
case tokenLoginAck: |
||||
loginAck := parseLoginAck(sess.buf) |
||||
ch <- loginAck |
||||
case tokenOrder: |
||||
order := parseOrder(sess.buf) |
||||
ch <- order |
||||
case tokenDoneInProc: |
||||
done := parseDoneInProc(sess.buf) |
||||
if sess.logFlags&logRows != 0 && done.Status&doneCount != 0 { |
||||
sess.log.Printf("(%d row(s) affected)\n", done.RowCount) |
||||
} |
||||
ch <- done |
||||
case tokenDone, tokenDoneProc: |
||||
done := parseDone(sess.buf) |
||||
done.errors = errs |
||||
if sess.logFlags&logDebug != 0 { |
||||
sess.log.Printf("got DONE or DONEPROC status=%d", done.Status) |
||||
} |
||||
if done.Status&doneSrvError != 0 { |
||||
ch <- errors.New("SQL Server had internal error") |
||||
return |
||||
} |
||||
if sess.logFlags&logRows != 0 && done.Status&doneCount != 0 { |
||||
sess.log.Printf("(%d row(s) affected)\n", done.RowCount) |
||||
} |
||||
ch <- done |
||||
if done.Status&doneMore == 0 { |
||||
return |
||||
} |
||||
case tokenColMetadata: |
||||
columns = parseColMetadata72(sess.buf) |
||||
ch <- columns |
||||
case tokenRow: |
||||
row := make([]interface{}, len(columns)) |
||||
parseRow(sess.buf, columns, row) |
||||
ch <- row |
||||
case tokenNbcRow: |
||||
row := make([]interface{}, len(columns)) |
||||
parseNbcRow(sess.buf, columns, row) |
||||
ch <- row |
||||
case tokenEnvChange: |
||||
processEnvChg(sess) |
||||
case tokenError: |
||||
err := parseError72(sess.buf) |
||||
if sess.logFlags&logDebug != 0 { |
||||
sess.log.Printf("got ERROR %d %s", err.Number, err.Message) |
||||
} |
||||
errs = append(errs, err) |
||||
if sess.logFlags&logErrors != 0 { |
||||
sess.log.Println(err.Message) |
||||
} |
||||
case tokenInfo: |
||||
info := parseInfo(sess.buf) |
||||
if sess.logFlags&logDebug != 0 { |
||||
sess.log.Printf("got INFO %d %s", info.Number, info.Message) |
||||
} |
||||
if sess.logFlags&logMessages != 0 { |
||||
sess.log.Println(info.Message) |
||||
} |
||||
default: |
||||
badStreamPanicf("Unknown token type: %d", token) |
||||
} |
||||
} |
||||
} |
||||
|
||||
type parseRespIter byte |
||||
|
||||
const ( |
||||
parseRespIterContinue parseRespIter = iota // Continue parsing current token.
|
||||
parseRespIterNext // Fetch the next token.
|
||||
parseRespIterDone // Done with parsing the response.
|
||||
) |
||||
|
||||
type parseRespState byte |
||||
|
||||
const ( |
||||
parseRespStateNormal parseRespState = iota // Normal response state.
|
||||
parseRespStateCancel // Query is canceled, wait for server to confirm.
|
||||
parseRespStateClosing // Waiting for tokens to come through.
|
||||
) |
||||
|
||||
type parseResp struct { |
||||
sess *tdsSession |
||||
ctxDone <-chan struct{} |
||||
state parseRespState |
||||
cancelError error |
||||
} |
||||
|
||||
func (ts *parseResp) sendAttention(ch chan tokenStruct) parseRespIter { |
||||
if err := sendAttention(ts.sess.buf); err != nil { |
||||
ts.dlogf("failed to send attention signal %v", err) |
||||
ch <- err |
||||
return parseRespIterDone |
||||
} |
||||
ts.state = parseRespStateCancel |
||||
return parseRespIterContinue |
||||
} |
||||
|
||||
func (ts *parseResp) dlog(msg string) { |
||||
if ts.sess.logFlags&logDebug != 0 { |
||||
ts.sess.log.Println(msg) |
||||
} |
||||
} |
||||
func (ts *parseResp) dlogf(f string, v ...interface{}) { |
||||
if ts.sess.logFlags&logDebug != 0 { |
||||
ts.sess.log.Printf(f, v...) |
||||
} |
||||
} |
||||
|
||||
func (ts *parseResp) iter(ctx context.Context, ch chan tokenStruct, tokChan chan tokenStruct) parseRespIter { |
||||
switch ts.state { |
||||
default: |
||||
panic("unknown state") |
||||
case parseRespStateNormal: |
||||
select { |
||||
case tok, ok := <-tokChan: |
||||
if !ok { |
||||
ts.dlog("response finished") |
||||
return parseRespIterDone |
||||
} |
||||
if err, ok := tok.(net.Error); ok && err.Timeout() { |
||||
ts.cancelError = err |
||||
ts.dlog("got timeout error, sending attention signal to server") |
||||
return ts.sendAttention(ch) |
||||
} |
||||
// Pass the token along.
|
||||
ch <- tok |
||||
return parseRespIterContinue |
||||
|
||||
case <-ts.ctxDone: |
||||
ts.ctxDone = nil |
||||
ts.dlog("got cancel message, sending attention signal to server") |
||||
return ts.sendAttention(ch) |
||||
} |
||||
case parseRespStateCancel: // Read all responses until a DONE or error is received.Auth
|
||||
select { |
||||
case tok, ok := <-tokChan: |
||||
if !ok { |
||||
ts.dlog("response finished but waiting for attention ack") |
||||
return parseRespIterNext |
||||
} |
||||
switch tok := tok.(type) { |
||||
default: |
||||
// Ignore all other tokens while waiting.
|
||||
// The TDS spec says other tokens may arrive after an attention
|
||||
// signal is sent. Ignore these tokens and continue looking for
|
||||
// a DONE with attention confirm mark.
|
||||
case doneStruct: |
||||
if tok.Status&doneAttn != 0 { |
||||
ts.dlog("got cancellation confirmation from server") |
||||
if ts.cancelError != nil { |
||||
ch <- ts.cancelError |
||||
ts.cancelError = nil |
||||
} else { |
||||
ch <- ctx.Err() |
||||
} |
||||
return parseRespIterDone |
||||
} |
||||
|
||||
// If an error happens during cancel, pass it along and just stop.
|
||||
// We are uncertain to receive more tokens.
|
||||
case error: |
||||
ch <- tok |
||||
ts.state = parseRespStateClosing |
||||
} |
||||
return parseRespIterContinue |
||||
case <-ts.ctxDone: |
||||
ts.ctxDone = nil |
||||
ts.state = parseRespStateClosing |
||||
return parseRespIterContinue |
||||
} |
||||
case parseRespStateClosing: // Wait for current token chan to close.
|
||||
if _, ok := <-tokChan; !ok { |
||||
ts.dlog("response finished") |
||||
return parseRespIterDone |
||||
} |
||||
return parseRespIterContinue |
||||
} |
||||
} |
||||
|
||||
func processResponse(ctx context.Context, sess *tdsSession, ch chan tokenStruct) { |
||||
ts := &parseResp{ |
||||
sess: sess, |
||||
ctxDone: ctx.Done(), |
||||
} |
||||
defer func() { |
||||
// Ensure any remaining error is piped through
|
||||
// or the query may look like it executed when it actually failed.
|
||||
if ts.cancelError != nil { |
||||
ch <- ts.cancelError |
||||
ts.cancelError = nil |
||||
} |
||||
close(ch) |
||||
}() |
||||
|
||||
// Loop over multiple responses.
|
||||
for { |
||||
ts.dlog("initiating resonse reading") |
||||
|
||||
tokChan := make(chan tokenStruct) |
||||
go processSingleResponse(sess, tokChan) |
||||
|
||||
// Loop over multiple tokens in response.
|
||||
tokensLoop: |
||||
for { |
||||
switch ts.iter(ctx, ch, tokChan) { |
||||
case parseRespIterContinue: |
||||
// Nothing, continue to next token.
|
||||
case parseRespIterNext: |
||||
break tokensLoop |
||||
case parseRespIterDone: |
||||
return |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
// Code generated by "stringer -type token"; DO NOT EDIT
|
||||
|
||||
package mssql |
||||
|
||||
import "fmt" |
||||
|
||||
const ( |
||||
_token_name_0 = "tokenReturnStatus" |
||||
_token_name_1 = "tokenColMetadata" |
||||
_token_name_2 = "tokenOrdertokenErrortokenInfo" |
||||
_token_name_3 = "tokenLoginAck" |
||||
_token_name_4 = "tokenRowtokenNbcRow" |
||||
_token_name_5 = "tokenEnvChange" |
||||
_token_name_6 = "tokenSSPI" |
||||
_token_name_7 = "tokenDonetokenDoneProctokenDoneInProc" |
||||
) |
||||
|
||||
var ( |
||||
_token_index_0 = [...]uint8{0, 17} |
||||
_token_index_1 = [...]uint8{0, 16} |
||||
_token_index_2 = [...]uint8{0, 10, 20, 29} |
||||
_token_index_3 = [...]uint8{0, 13} |
||||
_token_index_4 = [...]uint8{0, 8, 19} |
||||
_token_index_5 = [...]uint8{0, 14} |
||||
_token_index_6 = [...]uint8{0, 9} |
||||
_token_index_7 = [...]uint8{0, 9, 22, 37} |
||||
) |
||||
|
||||
func (i token) String() string { |
||||
switch { |
||||
case i == 121: |
||||
return _token_name_0 |
||||
case i == 129: |
||||
return _token_name_1 |
||||
case 169 <= i && i <= 171: |
||||
i -= 169 |
||||
return _token_name_2[_token_index_2[i]:_token_index_2[i+1]] |
||||
case i == 173: |
||||
return _token_name_3 |
||||
case 209 <= i && i <= 210: |
||||
i -= 209 |
||||
return _token_name_4[_token_index_4[i]:_token_index_4[i+1]] |
||||
case i == 227: |
||||
return _token_name_5 |
||||
case i == 237: |
||||
return _token_name_6 |
||||
case 253 <= i && i <= 255: |
||||
i -= 253 |
||||
return _token_name_7[_token_index_7[i]:_token_index_7[i+1]] |
||||
default: |
||||
return fmt.Sprintf("token(%d)", i) |
||||
} |
||||
} |
@ -0,0 +1,111 @@
|
||||
package mssql |
||||
|
||||
// Transaction Manager requests
|
||||
// http://msdn.microsoft.com/en-us/library/dd339887.aspx
|
||||
|
||||
import ( |
||||
"encoding/binary" |
||||
) |
||||
|
||||
const ( |
||||
tmGetDtcAddr = 0 |
||||
tmPropagateXact = 1 |
||||
tmBeginXact = 5 |
||||
tmPromoteXact = 6 |
||||
tmCommitXact = 7 |
||||
tmRollbackXact = 8 |
||||
tmSaveXact = 9 |
||||
) |
||||
|
||||
type isoLevel uint8 |
||||
|
||||
const ( |
||||
isolationUseCurrent isoLevel = 0 |
||||
isolationReadUncommited = 1 |
||||
isolationReadCommited = 2 |
||||
isolationRepeatableRead = 3 |
||||
isolationSerializable = 4 |
||||
isolationSnapshot = 5 |
||||
) |
||||
|
||||
func sendBeginXact(buf *tdsBuffer, headers []headerStruct, isolation isoLevel, |
||||
name string) (err error) { |
||||
buf.BeginPacket(packTransMgrReq) |
||||
writeAllHeaders(buf, headers) |
||||
var rqtype uint16 = tmBeginXact |
||||
err = binary.Write(buf, binary.LittleEndian, &rqtype) |
||||
if err != nil { |
||||
return |
||||
} |
||||
err = binary.Write(buf, binary.LittleEndian, &isolation) |
||||
if err != nil { |
||||
return |
||||
} |
||||
err = writeBVarChar(buf, name) |
||||
if err != nil { |
||||
return |
||||
} |
||||
return buf.FinishPacket() |
||||
} |
||||
|
||||
const ( |
||||
fBeginXact = 1 |
||||
) |
||||
|
||||
func sendCommitXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string) error { |
||||
buf.BeginPacket(packTransMgrReq) |
||||
writeAllHeaders(buf, headers) |
||||
var rqtype uint16 = tmCommitXact |
||||
err := binary.Write(buf, binary.LittleEndian, &rqtype) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = writeBVarChar(buf, name) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = binary.Write(buf, binary.LittleEndian, &flags) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
if flags&fBeginXact != 0 { |
||||
err = binary.Write(buf, binary.LittleEndian, &isolation) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = writeBVarChar(buf, name) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
} |
||||
return buf.FinishPacket() |
||||
} |
||||
|
||||
func sendRollbackXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string) error { |
||||
buf.BeginPacket(packTransMgrReq) |
||||
writeAllHeaders(buf, headers) |
||||
var rqtype uint16 = tmRollbackXact |
||||
err := binary.Write(buf, binary.LittleEndian, &rqtype) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = writeBVarChar(buf, name) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = binary.Write(buf, binary.LittleEndian, &flags) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
if flags&fBeginXact != 0 { |
||||
err = binary.Write(buf, binary.LittleEndian, &isolation) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
err = writeBVarChar(buf, name) |
||||
if err != nil { |
||||
return err |
||||
} |
||||
} |
||||
return buf.FinishPacket() |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,74 @@
|
||||
package mssql |
||||
|
||||
import ( |
||||
"database/sql/driver" |
||||
"encoding/hex" |
||||
"errors" |
||||
"fmt" |
||||
) |
||||
|
||||
type UniqueIdentifier [16]byte |
||||
|
||||
func (u *UniqueIdentifier) Scan(v interface{}) error { |
||||
reverse := func(b []byte) { |
||||
for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { |
||||
b[i], b[j] = b[j], b[i] |
||||
} |
||||
} |
||||
|
||||
switch vt := v.(type) { |
||||
case []byte: |
||||
if len(vt) != 16 { |
||||
return errors.New("mssql: invalid UniqueIdentifier length") |
||||
} |
||||
|
||||
var raw UniqueIdentifier |
||||
|
||||
copy(raw[:], vt) |
||||
|
||||
reverse(raw[0:4]) |
||||
reverse(raw[4:6]) |
||||
reverse(raw[6:8]) |
||||
*u = raw |
||||
|
||||
return nil |
||||
case string: |
||||
if len(vt) != 36 { |
||||
return errors.New("mssql: invalid UniqueIdentifier string length") |
||||
} |
||||
|
||||
b := []byte(vt) |
||||
for i, c := range b { |
||||
switch c { |
||||
case '-': |
||||
b = append(b[:i], b[i+1:]...) |
||||
} |
||||
} |
||||
|
||||
_, err := hex.Decode(u[:], []byte(b)) |
||||
return err |
||||
default: |
||||
return fmt.Errorf("mssql: cannot convert %T to UniqueIdentifier", v) |
||||
} |
||||
} |
||||
|
||||
func (u UniqueIdentifier) Value() (driver.Value, error) { |
||||
reverse := func(b []byte) { |
||||
for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { |
||||
b[i], b[j] = b[j], b[i] |
||||
} |
||||
} |
||||
|
||||
raw := make([]byte, len(u)) |
||||
copy(raw, u[:]) |
||||
|
||||
reverse(raw[0:4]) |
||||
reverse(raw[4:6]) |
||||
reverse(raw[6:8]) |
||||
|
||||
return raw, nil |
||||
} |
||||
|
||||
func (u UniqueIdentifier) String() string { |
||||
return fmt.Sprintf("%X-%X-%X-%X-%X", u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) |
||||
} |
Loading…
Reference in new issue