sanatgersappa / odbc

Automatically exported from code.google.com/p/odbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Error on NVARCHAR columns #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To duplicate add the following test in []typeTest:

{"select cast('' as nvarchar(5))", match("")}

The stack trace should be:
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x432ba8]

goroutine 3 [running]:
testing.func┬╖004()
        E:/Go/GoTip/src/pkg/testing/testing.go:348 +0xd0
code.google.com/p/odbc.(*BaseColumn).Value(0xc080098560, 0xc08007dba0, 0x0, 0xc,
 0x1, ...)
        E:/Go/GoExternal/src/code.google.com/p/odbc/column.go:118 +0x7e8
code.google.com/p/odbc.(*BindableColumn).Value(0xc080099540, 0x2b7fb0, 0x0, 0xc0
8007dbb0, 0x41a1bd, ...)
        E:/Go/GoExternal/src/code.google.com/p/odbc/column.go:223 +0x336
code.google.com/p/odbc.(*Rows).Next(0xc080090a28, 0xc08007dbc0, 0x1, 0x1, 0x1, .
..)

I investigated the issue and found that buf(len) is 0 in the case of 
api.SQL_C_WCHAR.  Additionally, in func (c *BindableColumn) Value(...), c.Len 
is 0 but c.Size is 12.  I think c.Size is 12 because 5 unicode characters (10 
bytes) + 1 unicode termination character.  However, why is the length 0?

Original issue reported on code.google.com by lukemaul...@gmail.com on 20 May 2013 at 7:48

GoogleCodeExporter commented 9 years ago
How about this change https://codereview.appspot.com/9473047/ ?

Alex

Original comment by alex.bra...@gmail.com on 21 May 2013 at 12:59

GoogleCodeExporter commented 9 years ago
This issue was closed by revision d6c8ba201097.

Original comment by alex.bra...@gmail.com on 21 May 2013 at 11:21