dbTalk Databases Forums  

DBD::Sybase wrong tabular output format ?

comp.databases.sybase comp.databases.sybase


Discuss DBD::Sybase wrong tabular output format ? in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mihalis Miliarakis
 
Posts: n/a

Default DBD::Sybase wrong tabular output format ? - 07-19-2004 , 07:58 AM






Using DBD::Sybase I execute this query:
select convert(char(3),spid), convert(char(20),object_name(id,dbid)), class
from master..syslocks
where object_name(id,dbid) not like '#%'
order by spid

The output is ok
39 1356531866 Non Cursor Lock
39 1356531866 Non Cursor Lock
39 1500532379 Non Cursor Lock
39 1600008731 Non Cursor Lock
39 848006052 Non Cursor Lock
122 384004399 Non Cursor Lock
122 384004399 Non Cursor Lock
122 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock

When I change 2nd output field to its object name (leaving everything else the
same):
select convert(char(3),spid), convert(char(20),object_name(id,dbid)), class
......

I get this output (without the fixed format output that I am asking for and I
was getting before):
39 contract Non Cursor Lock
39 customer Non Cursor Lock
39 portal_statistics Non Cursor Lock
39 invoice_record_list Non Cursor Lock
39 invoice_record_list Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock

Is this a bug or a feature??

Reply With Quote
  #2  
Old   
Mihalis Miliarakis
 
Posts: n/a

Default Re: DBD::Sybase wrong tabular output format ? - 07-19-2004 , 08:03 AM






copy-paste mistake...
The first query should say:
select convert(char(3),spid), convert(char(20),id), class
from master..syslocks
where object_name(id,dbid) not like '#%'
order by spid


On 19/7/2004 3:58 μμ, Mihalis Miliarakis wrote:

Quote:
Using DBD::Sybase I execute this query:
select convert(char(3),spid), convert(char(20),object_name(id,dbid)), class
from master..syslocks
where object_name(id,dbid) not like '#%'
order by spid

The output is ok
39 1356531866 Non Cursor Lock
39 1356531866 Non Cursor Lock
39 1500532379 Non Cursor Lock
39 1600008731 Non Cursor Lock
39 848006052 Non Cursor Lock
122 384004399 Non Cursor Lock
122 384004399 Non Cursor Lock
122 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock
137 384004399 Non Cursor Lock

When I change 2nd output field to its object name (leaving everything
else the same):
select convert(char(3),spid), convert(char(20),object_name(id,dbid)), class
.....

I get this output (without the fixed format output that I am asking for
and I was getting before):
39 contract Non Cursor Lock
39 customer Non Cursor Lock
39 portal_statistics Non Cursor Lock
39 invoice_record_list Non Cursor Lock
39 invoice_record_list Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 balance Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock
50 invoice Non Cursor Lock

Is this a bug or a feature??


Reply With Quote
  #3  
Old   
Michael Peppler
 
Posts: n/a

Default Re: DBD::Sybase wrong tabular output format ? - 07-19-2004 , 12:23 PM



On Mon, 19 Jul 2004 16:03:58 +0300, Mihalis Miliarakis wrote:

Quote:
On 19/7/2004 3:58 ìì, Mihalis Miliarakis wrote:


Using DBD::Sybase I execute this query: select convert(char(3),spid),
convert(char(20),object_name(id,dbid)), class from master..syslocks
where object_name(id,dbid) not like '#%' order by spid

The output is ok
39 1356531866 Non Cursor Lock 39 1356531866 Non
Cursor Lock 39 1500532379 Non Cursor Lock 39 1600008731
Non Cursor Lock 39 848006052 Non Cursor Lock 122
384004399 Non Cursor Lock 122 384004399 Non
Cursor Lock 122 384004399 Non Cursor Lock 137 384004399 Non
Cursor Lock 137 384004399 Non Cursor Lock 137 384004399
Non Cursor Lock

When I change 2nd output field to its object name (leaving everything
else the same):
select convert(char(3),spid), convert(char(20),object_name(id,dbid)),
class .....

I get this output (without the fixed format output that I am asking for
and I was getting before):
39 contract Non Cursor Lock

Is this a bug or a feature??
Actually the issue is the object_name() returns a varchar() datatype (or
maybe a NULLable char datatype), and this probably propagates up
(especially the NULLable attribute). And as a NULLable CHAR item is the
same thing (behaves the same way) as a VARCHAR you get this situation.

Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler (AT) peppler (DOT) org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.