Stored Proc not returning empty strings in new v4.25.9

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
kt
Posts: 2
Joined: Thu 26 Jun 2008 02:42

Stored Proc not returning empty strings in new v4.25.9

Post by kt » Thu 26 Jun 2008 03:22

I upgraded from BDS2006 to Rad Studio 2007. Downloaded trial version of the new dbexpsda40.dll version 4.25.0.9 of 6/19/2008.

I'm using the C++ Builder flavor in both versions of the IDE.

I have this stored procedure on MS SQL Server 2005 Express that worked fine with dbexpsda30.dll and BDS2006 TSQLStoredProc.

It returns strange results with the new dbexpsda40.dll in Rad Studio 2007 TSQLStoredProc.

USE [MyDataStorageBase]
GO
/****** Object: StoredProcedure [dbo].[READ_ZADDR] Script Date: 06/25/2008 22:45:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[READ_ZADDR]
@I_ACCTNO char(8),
@I_ZTYPE char(1),
@O_ACCTNO char(8) OUT,
@O_ZTYPE char(1) OUT,
@O_NAME varchar(34) OUT,
@O_ADDR1 varchar(30) OUT,
@O_ADDR2 varchar(30) OUT,
@O_CITY varchar(20) OUT,
@O_STATE varchar(2) OUT,
@O_ZIP varchar(10) OUT,
@O_PHONEAREA smallint OUT,
@O_PHONENO int OUT,
@O_SSN int OUT,
@O_DOB smalldatetime OUT,
@O_GENDER varchar(1) OUT,
@O_MARITALSTATUS varchar(1) OUT
AS
set @O_ACCTNO = '';
select
@O_ACCTNO = ACCTNO,
@O_ZTYPE = ZTYPE,
@O_NAME = NAME,
@O_ADDR1 = ADDR1,
@O_ADDR2 = ADDR2,
@O_CITY = CITY,
@O_STATE = STATE,
@O_ZIP = ZIP,
@O_PHONEAREA = PHONEAREA,
@O_PHONENO = PHONENO,
@O_SSN = SSN,
@O_DOB = DOB,
@O_GENDER = GENDER,
@O_MARITALSTATUS = MARITALSTATUS
from zAddr where AcctNo = @I_ACCTNO and zType = @I_ZTYPE

Problem is when the column 'ADDR2' (varchar(30) null) contains an empty string '', (NOT a NULL value, but an empty string), the TSQLStoredProc returns a string of length 4 with strange characters in the 'O_ADDR2' parameter using SQLStoredProc1->ParamByName("O_ADDR2")->AsString. I also get strange results in the 'O_MARITALSTATUS' parameter when the MARITALSTATUS column is an empty string. There are no other columns in my database that have empty strings. I'd imagine if they did have emtpy strings they would also return strange results.

If I remove the line

@O_ADDR2 = ADDR2,

from the select statement in the stored procedure and insert

set @O_ADDR2 = 'CHIP';

above the select statement, the 'O_ADDR2' parameter of TSQLStoredProc properly returns 'CHIP'.

If I change that line to

set @O_ADDR2 = '';

the 'O_ADDR2' parameter of TSQLStoredProc once again returns a string of length 4 with strange characters.

Might this be a bug in the new version of dbexpsda40.dll?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 27 Jun 2008 14:47

Thank you for information. We have reproduced the problem. The investigation is in progress. As soon as we get more information about the problem we will let you know.

kt
Posts: 2
Joined: Thu 26 Jun 2008 02:42

Post by kt » Mon 14 Jul 2008 22:43

Has there been any progress on this issue? Any idea as to when there might be a resolution?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 16 Jul 2008 06:57

We have already fixed this problem. This fix will be included in the next build of DbxSda. Thank you for your help.

Post Reply