php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2879 Tinyint and bit fields return extra garbage on Sybase ASE on Linux and MS SQL 6
Submitted: 1999-11-30 18:13 UTC Modified: 1999-11-30 18:18 UTC
From: adam_wilkinson at sehamerica dot com Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 3.0.12 OS: Linux 2.2.5
Private report: No CVE-ID: None
 [1999-11-30 18:13 UTC] adam_wilkinson at sehamerica dot com
Create a table that contains a tinyint and/or a bit:

create table TestTab(ID varchar(10), Verified bit, Slot tinyint)

If you return the bit or tinyint fields, you get garbage appended to the end.  This is the same on MS SQL Server 6.5 on NT as well as Sybase ASE 11.0.3 for Linux (The free unsupported one).  

You can work around it by converting the results to a varchar field, then you can read them normally.

So you can use:

SELECT ID, CONVERT(char(1), Verified) AS Verified, 
CONVERT(varchar(2), Slot) AS Slot FROM TestTab

Instead of:

SELECT * FROM TestTab;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-30 18:18 UTC] rasmus at cvs dot php dot net
This is fixed in CVS and will be in 3.0.13
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 10:01:28 2024 UTC