PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Simon Haven <Simon dot Haven at wdr dot com>
Subject: Re: where does it come from? help please.
Date: Sep 27 1999 3:30PM

It could be that you have your password column declared as a CHAR(xx), where xx is longer than the length of the password.
Sybase will space-fill to the length of a CHAR value, but not for a VARCHAR.

For example:

1> declare @test1 char(10), @test2 varchar(10)
2> select @test1 = "FRED", @test2 = "FRED"
3> select "TEST1 [" + @test1 + "] TEST2 [" + @test2 + "]"
4> select "TEST1 [" + rtrim(@test1) + "] TEST2 [" + @test2 + "]"
5> select "TEST1 [" + convert(varchar,@test1) + "] TEST2 [" + convert(char(10), @test2) + "]"
6> go
(1 row affected)
                                       
 ------------------------------------- 
 TEST1 [FRED      ] TEST2 [FRED]       

(1 row affected)
                                       
 ------------------------------------- 
 TEST1 [FRED] TEST2 [FRED]             

(1 row affected)
                                                           
 --------------------------------------------------------- 
 TEST1 [FRED] TEST2 [FRED      ]                           

(1 row affected)

Maybe you could try adding rtrim() in the query, or else declaring the password field as a varchar, or converting to varchar in the query.

You should be able to remove trailing spaces in perl using chop(), but be careful.
NB, make sure you're using chop, not chomp, which only removes a newline.


Simon


Begin forwarded message:

Sender: owner-SYBPERL-L@listproc.net
Date: Mon, 27 Sep 1999 18:13:39 +0200
From: Konrad Zak 
Organization: University of Wroclaw
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586)
X-Accept-Language: en
To: SybPerl Discussion List 
Subject: where does it come from? help please.
Reply-To: SYBPERL-L@listproc.net
X-Sender: konrad@szermierz
X-Listprocessor-Version: 8.2.07 -- ListProc(tm) by CREN

Hello.
    I'm a little new to perl and sybperl and I think it's why I'm in
trouble.
I'm trying to provide simple login procedure. Problem is, that PASSWORD,
read
from table USERS in the way shown below (in order to compare with typed
one),
has some additional char. Printed, it looks like that: 'my_pass ', real
password doesn't have anything like that.                      ^
                                                            here is
problem

I've tried to remove it with chop() function, it doesn't work, do anyone
know
what's wrong, please?

[...]

use Sybase::CTlib;
$d = new Sybase::CTlib okis_www_guest,my_passwd;

$SQL_query = "select PASSWORD from USERS where LOGIN =
\"$frmFlds{'login'}\"";
$ref = $d->ct_sql($SQL_query);

if (@$ref->[0][0] eq $frmFlds{'password'})
{

[...]

----------------------------------------------------------
  Konrad Zak
  The Interfaculty Lab of Computer Networks and Software
  University of Wroclaw, Wroclaw, POLAND
  +48 71 3201416


This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.