Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inserting a TEXT LOB with a size of zero gives a NULL value in the database

1 view
Skip to first unread message

sebflaesch

unread,
Jul 22, 2010, 5:47:38 AM7/22/10
to
Hi all,

Using Sybase ASE 15.5 Developer Edition, Linux x86 32b:

I think there is a bug regarding LOB insertion in TEXT (or IMAGE)
columns with SQL_DATA_AT_EXEC, when passing an empty buffer with
SQLPutData():

Normally, this code:

rcode = SQLPutData(m_hstmt, "", 0);

Should insert a NOT NULL empty text.

To insert a NULL text, you use:

rcode = SQLPutData(m_hstmt, NULL, SQL_NULL_DATA);

I wonder also about this:

1> create table t1 ( k int, t text )
2> go
1> insert into t1 values ( 1, null )
2> go
(1 row affected)
1> insert into t1 values ( 2, '' )
2> go
(1 row affected)

1> select k, len(t) from t1
2> go
k
----------- -----------
1 NULL
2 1

(2 rows affected)


Why does the second row show a text value with a size of 1?

That would make sens when there is one character in the column:

1> insert into t1 values ( 3, 'a' )
2> go
(1 row affected)
1> select k, len(t) from t1
2> go
k
----------- -----------
1 NULL
2 1
3 1

(3 rows affected)

Thanks for reading.
Seb

0 new messages