|
From: <asf...@us...> - 2013-06-18 15:50:52
|
Revision: 58203
http://sourceforge.net/p/firebird/code/58203
Author: asfernandes
Date: 2013-06-18 15:50:48 +0000 (Tue, 18 Jun 2013)
Log Message:
-----------
Improvements and corrections to message builder and UDR.
Modified Paths:
--------------
firebird/trunk/examples/udr/UdrCppExample.cpp
firebird/trunk/src/common/MsgMetadata.cpp
firebird/trunk/src/common/MsgMetadata.h
firebird/trunk/src/common/classes/InternalMessageBuffer.cpp
firebird/trunk/src/dsql/dsql.cpp
firebird/trunk/src/include/firebird/Message.h
firebird/trunk/src/include/firebird/Provider.h
firebird/trunk/src/jrd/ExtEngineManager.cpp
firebird/trunk/src/jrd/PreparedStatement.cpp
firebird/trunk/src/jrd/Routine.cpp
firebird/trunk/src/remote/client/BlrFromMessage.cpp
Modified: firebird/trunk/examples/udr/UdrCppExample.cpp
===================================================================
--- firebird/trunk/examples/udr/UdrCppExample.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/examples/udr/UdrCppExample.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -690,7 +690,7 @@
FB_TRIGGER_MESSAGE(FieldsMessage,
(FB_INTEGER, id, "ID")
(FB_BLOB, info, "INFO")
- (FB_VARCHAR(60 * 4), address, "ADDRESS")
+ ///(FB_VARCHAR(60 * 4), address, "ADDRESS")
(FB_VARCHAR(60 * 4), name, "NAME")
);
@@ -753,13 +753,13 @@
"execute block (\n"
" id type of column PERSONS.ID = ?,\n"
" info type of column PERSONS.INFO = ?,\n"
- " address type of column PERSONS.ADDRESS = ?,\n"
+ ///" address type of column PERSONS.ADDRESS = ?,\n"
" name type of column PERSONS.NAME = ?\n"
")"
"as\n"
"begin\n"
- " execute statement ('insert into persons (id, name, address, info)\n"
- " values (?, ?, ?, ?)') (:id, :name, :address, :info)\n"
+ " execute statement ('insert into persons (id, name/***, address***/, info)\n"
+ " values (?, ?/***, ?***/, ?)') (:id, :name/***, :address***/, :info)\n"
" on external data source '");
strcat(buffer, outSqlDa->sqlvar[0].sqldata + sizeof(short));
strcat(buffer, "';\nend");
Modified: firebird/trunk/src/common/MsgMetadata.cpp
===================================================================
--- firebird/trunk/src/common/MsgMetadata.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/common/MsgMetadata.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -114,6 +114,21 @@
}
}
+ virtual void FB_CARG setCharSet(IStatus* status, unsigned index, unsigned charSet)
+ {
+ try
+ {
+ MutexLockGuard g(mtx, FB_FUNCTION);
+
+ indexError(index, "setCharSet");
+ msgMetadata->items[index].charSet = charSet;
+ }
+ catch (const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ }
+
virtual void FB_CARG setScale(IStatus* status, unsigned index, unsigned scale)
{
try
@@ -129,6 +144,23 @@
}
}
+ virtual void FB_CARG truncate(IStatus* status, unsigned count)
+ {
+ try
+ {
+ MutexLockGuard g(mtx, FB_FUNCTION);
+
+ if (count != 0)
+ indexError(count - 1, "truncate");
+
+ msgMetadata->items.shrink(count);
+ }
+ catch (const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ }
+
virtual void FB_CARG moveNameToIndex(IStatus* status, const char* name, unsigned index)
{
try
Modified: firebird/trunk/src/common/MsgMetadata.h
===================================================================
--- firebird/trunk/src/common/MsgMetadata.h 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/common/MsgMetadata.h 2013-06-18 15:50:48 UTC (rev 58203)
@@ -49,7 +49,7 @@
subType(0),
length(0),
scale(0),
- charset(0),
+ charSet(0),
offset(0),
nullInd(0),
nullable(false),
@@ -66,7 +66,7 @@
subType(v.subType),
length(v.length),
scale(v.scale),
- charset(v.charset),
+ charSet(v.charSet),
offset(v.offset),
nullInd(v.nullInd),
nullable(v.nullable),
@@ -82,7 +82,7 @@
unsigned subType;
unsigned length;
unsigned scale;
- unsigned charset;
+ unsigned charSet;
unsigned offset;
unsigned nullInd;
bool nullable;
@@ -193,12 +193,12 @@
return 0;
}
- virtual unsigned FB_CARG getCharset(IStatus* status, unsigned index) const
+ virtual unsigned FB_CARG getCharSet(IStatus* status, unsigned index) const
{
if (index < items.getCount())
- return items[index].charset;
+ return items[index].charSet;
- raiseIndexError(status, index, "getCharset");
+ raiseIndexError(status, index, "getCharSet");
return 0;
}
Modified: firebird/trunk/src/common/classes/InternalMessageBuffer.cpp
===================================================================
--- firebird/trunk/src/common/classes/InternalMessageBuffer.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/common/classes/InternalMessageBuffer.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -89,25 +89,25 @@
{
case blr_text:
item->type = SQL_TEXT;
- item->charset = CS_dynamic;
+ item->charSet = CS_dynamic;
item->length = rdr.getWord();
break;
case blr_varying:
item->type = SQL_VARYING;
- item->charset = CS_dynamic;
+ item->charSet = CS_dynamic;
item->length = rdr.getWord();
break;
case blr_text2:
item->type = SQL_TEXT;
- item->charset = rdr.getWord();
+ item->charSet = rdr.getWord();
item->length = rdr.getWord();
break;
case blr_varying2:
item->type = SQL_VARYING;
- item->charset = rdr.getWord();
+ item->charSet = rdr.getWord();
item->length = rdr.getWord();
break;
@@ -165,7 +165,7 @@
item->type = SQL_BLOB;
item->length = sizeof(ISC_QUAD);
item->subType = rdr.getWord();
- item->charset = rdr.getWord();
+ item->charSet = rdr.getWord();
break;
case blr_bool:
Modified: firebird/trunk/src/dsql/dsql.cpp
===================================================================
--- firebird/trunk/src/dsql/dsql.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/dsql/dsql.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -1266,7 +1266,7 @@
check(&st);
desc.dsc_sub_type = meta->getSubType(&st, index);
check(&st);
- unsigned textType = meta->getCharset(&st, index);
+ unsigned textType = meta->getCharSet(&st, index);
check(&st);
desc.setTextType(textType);
desc.dsc_address = (UCHAR*)(IPTR) dataOffset;
Modified: firebird/trunk/src/include/firebird/Message.h
===================================================================
--- firebird/trunk/src/include/firebird/Message.h 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/include/firebird/Message.h 2013-06-18 15:50:48 UTC (rev 58203)
@@ -58,9 +58,8 @@
static void setup(::Firebird::IStatus* status, ::Firebird::IMetadataBuilder* builder) \
{ \
unsigned index = 0; \
+ moveNames \
FB_BOOST_PP_SEQ_FOR_EACH_I(FB__MESSAGE_META, size, fields) \
- \
- moveNames \
} \
\
name(::Firebird::IMaster* master) \
@@ -163,6 +162,16 @@
builder->setType(status, index, SQL_VARYING); \
builder->setLength(status, index, len);
+#define FB__META_FB_INTL_CHAR(len, charSet) \
+ builder->setType(status, index, SQL_TEXT); \
+ builder->setLength(status, index, len); \
+ builder->setCharSet(status, index, charSet);
+
+#define FB__META_FB_INTL_VARCHAR(len, charSet) \
+ builder->setType(status, index, SQL_VARYING); \
+ builder->setLength(status, index, len); \
+ builder->setCharSet(status, index, charSet);
+
#define FB__META_FB_SMALLINT FB__META_FB_SCALED_SMALLINT(0)
#define FB__META_FB_INTEGER FB__META_FB_SCALED_INTEGER(0)
#define FB__META_FB_BIGINT FB__META_FB_SCALED_BIGINT(0)
@@ -194,8 +203,9 @@
#define FB_TRIGGER_MESSAGE_MOVE_NAMES_Y0
#define FB_TRIGGER_MESSAGE_MOVE_NAMES_I(name, size, fields) \
- index = 0; \
- FB_BOOST_PP_SEQ_FOR_EACH_I(FB_TRIGGER_MESSAGE_MOVE_NAME, size, fields)
+ FB_BOOST_PP_SEQ_FOR_EACH_I(FB_TRIGGER_MESSAGE_MOVE_NAME, size, fields) \
+ builder->truncate(status, index); \
+ index = 0;
#define FB_TRIGGER_MESSAGE_MOVE_NAME(r, _, i, xy) \
builder->moveNameToIndex(status, FB_BOOST_PP_TUPLE_ELEM(_, 2, xy), index++);
Modified: firebird/trunk/src/include/firebird/Provider.h
===================================================================
--- firebird/trunk/src/include/firebird/Provider.h 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/include/firebird/Provider.h 2013-06-18 15:50:48 UTC (rev 58203)
@@ -103,7 +103,7 @@
virtual unsigned FB_CARG getSubType(IStatus* status, unsigned index) const = 0;
virtual unsigned FB_CARG getLength(IStatus* status, unsigned index) const = 0;
virtual unsigned FB_CARG getScale(IStatus* status, unsigned index) const = 0;
- virtual unsigned FB_CARG getCharset(IStatus* status, unsigned index) const = 0;
+ virtual unsigned FB_CARG getCharSet(IStatus* status, unsigned index) const = 0;
virtual unsigned FB_CARG getOffset(IStatus* status, unsigned index) const = 0;
virtual unsigned FB_CARG getNullOffset(IStatus* status, unsigned index) const = 0;
@@ -118,13 +118,15 @@
virtual void FB_CARG setType(IStatus* status, unsigned index, unsigned type) = 0;
virtual void FB_CARG setSubType(IStatus* status, unsigned index, unsigned subType) = 0;
virtual void FB_CARG setLength(IStatus* status, unsigned index, unsigned length) = 0;
+ virtual void FB_CARG setCharSet(IStatus* status, unsigned index, unsigned charSet) = 0;
virtual void FB_CARG setScale(IStatus* status, unsigned index, unsigned scale) = 0;
+ virtual void FB_CARG truncate(IStatus* status, unsigned count) = 0;
virtual void FB_CARG moveNameToIndex(IStatus* status, const char* name, unsigned index) = 0;
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status) = 0;
};
-#define FB_METADATA_BUILDER_VERSION (FB_REFCOUNTED_VERSION + 6)
+#define FB_METADATA_BUILDER_VERSION (FB_REFCOUNTED_VERSION + 8)
class IResultSet : public IRefCounted
{
Modified: firebird/trunk/src/jrd/ExtEngineManager.cpp
===================================================================
--- firebird/trunk/src/jrd/ExtEngineManager.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/jrd/ExtEngineManager.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -896,7 +896,7 @@
LocalStatus status;
trigger->execute(&status, attInfo->context, action,
- (oldRpb ? oldMsg.begin() : NULL), (newRpb ? newMsg.begin() : NULL));
+ (oldMsg.hasData() ? oldMsg.begin() : NULL), (newMsg.hasData() ? newMsg.begin() : NULL));
status.check();
}
@@ -941,7 +941,7 @@
return;
UCHAR* p = msgBuffer.getBuffer(format->fmt_length);
- ///memset(p, 0, format->fmt_length);
+ memset(p, 0, format->fmt_length);
for (unsigned i = 0; i < format->fmt_count / 2; ++i)
{
Modified: firebird/trunk/src/jrd/PreparedStatement.cpp
===================================================================
--- firebird/trunk/src/jrd/PreparedStatement.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/jrd/PreparedStatement.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -54,13 +54,13 @@
{
case dtype_text:
item.type = SQL_TEXT;
- item.charset = desc->dsc_ttype();
+ item.charSet = desc->dsc_ttype();
item.length = desc->dsc_length;
break;
case dtype_varying:
item.type = SQL_VARYING;
- item.charset = desc->dsc_ttype();
+ item.charSet = desc->dsc_ttype();
fb_assert(desc->dsc_length >= sizeof(USHORT));
item.length = desc->dsc_length - sizeof(USHORT);
break;
@@ -123,7 +123,7 @@
item.type = SQL_BLOB;
item.length = sizeof(ISC_QUAD);
item.subType = desc->dsc_sub_type;
- item.charset = desc->getTextType();
+ item.charSet = desc->getTextType();
break;
case dtype_boolean:
Modified: firebird/trunk/src/jrd/Routine.cpp
===================================================================
--- firebird/trunk/src/jrd/Routine.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/jrd/Routine.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -75,7 +75,7 @@
desc->dsc_length = descLength;
desc->dsc_scale = params->getScale(&status, i);
desc->dsc_sub_type = params->getSubType(&status, i);
- desc->setTextType(params->getCharset(&status, i));
+ desc->setTextType(params->getCharSet(&status, i));
desc->dsc_address = (UCHAR*)(IPTR) descOffset;
desc->dsc_flags = (params->isNullable(&status, i) ? DSC_nullable : 0);
Modified: firebird/trunk/src/remote/client/BlrFromMessage.cpp
===================================================================
--- firebird/trunk/src/remote/client/BlrFromMessage.cpp 2013-06-18 13:17:08 UTC (rev 58202)
+++ firebird/trunk/src/remote/client/BlrFromMessage.cpp 2013-06-18 15:50:48 UTC (rev 58203)
@@ -105,14 +105,14 @@
checkStatus(&st);
unsigned scale = metadata->getScale(&st, i);
checkStatus(&st);
- unsigned charset = metadata->getCharset(&st, i);
+ unsigned charSet = metadata->getCharSet(&st, i);
checkStatus(&st);
switch (dtype)
{
case SQL_VARYING:
appendUChar(blr_varying2);
- appendUShort(charset);
+ appendUShort(charSet);
appendUShort(len);
dtype = dtype_varying;
len += sizeof(USHORT);
@@ -120,7 +120,7 @@
case SQL_TEXT:
appendUChar(blr_text2);
- appendUShort(charset);
+ appendUShort(charSet);
appendUShort(len);
dtype = dtype_text;
break;
@@ -158,7 +158,7 @@
case SQL_BLOB:
appendUChar(blr_blob2);
appendUShort(metadata->getSubType(&st, i));
- appendUShort(charset);
+ appendUShort(charSet);
dtype = dtype_blob;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|