Skip to content

Commit b734d12

Browse files
committed
Fixed #9086: Firebird 6.0.0 error "Data type unknown" running udf which returns string using returns parameter <n> - patch from Dimitry Sibiryakov <sd@ibphoenix.com>
1 parent bebf3b7 commit b734d12

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/common/dsc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,12 @@ void dsc::getSqlInfo(SLONG* sqlLength, SLONG* sqlSubType, SLONG* sqlScale, SLONG
17131713
*sqlScale = dsc_scale;
17141714
break;
17151715

1716+
case dtype_cstring:
1717+
*sqlType = SQL_VARYING;
1718+
*sqlLength -= 1; // Zero-terminator
1719+
*sqlSubType = dsc_sub_type;
1720+
break;
1721+
17161722
case dtype_varying:
17171723
*sqlType = SQL_VARYING;
17181724
*sqlLength -= sizeof(USHORT);

src/dsql/gen.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,20 @@ void GEN_descriptor( DsqlCompilerScratch* dsqlScratch, const dsc* desc, bool tex
345345
dsqlScratch->appendUShort(desc->dsc_length);
346346
break;
347347

348+
case dtype_cstring:
349+
if (texttype || desc->getTextType() == ttype_binary || desc->getTextType() == ttype_none)
350+
{
351+
dsqlScratch->appendUChar(blr_varying2);
352+
dsqlScratch->appendUShort(desc->getTextType());
353+
}
354+
else
355+
{
356+
dsqlScratch->appendUChar(blr_varying2); // automatic transliteration
357+
dsqlScratch->appendUShort(ttype_dynamic);
358+
}
359+
dsqlScratch->appendUShort(desc->dsc_length - 1);
360+
break;
361+
348362
case dtype_varying:
349363
if (texttype || desc->getTextType() == ttype_binary || desc->getTextType() == ttype_none)
350364
{

0 commit comments

Comments
 (0)