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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
23 + 48 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 17:01:30 2024 UTC