2011-04-14 03:03:43 +02:00
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Initial
|
|
|
|
* Developer's Public License Version 1.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed AS IS,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing rights
|
|
|
|
* and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Adriano dos Santos Fernandes
|
|
|
|
* for the Firebird Open Source RDBMS project.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Adriano dos Santos Fernandes <adrianosf at gmail.com>
|
|
|
|
* and all contributors signed below.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
2013-02-17 13:08:53 +01:00
|
|
|
* Alex Peshkov
|
2011-04-14 03:03:43 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMMON_STATEMENT_METADATA_H
|
|
|
|
#define COMMON_STATEMENT_METADATA_H
|
|
|
|
|
2011-06-02 17:57:08 +02:00
|
|
|
#include "firebird/Provider.h"
|
2011-04-14 03:03:43 +02:00
|
|
|
#include "iberror.h"
|
|
|
|
#include "../common/classes/Nullable.h"
|
|
|
|
#include "../common/classes/array.h"
|
|
|
|
#include "../common/classes/fb_string.h"
|
|
|
|
#include "../common/classes/objects_array.h"
|
2013-02-17 13:08:53 +01:00
|
|
|
#include "../common/MsgMetadata.h"
|
2011-04-14 03:03:43 +02:00
|
|
|
|
|
|
|
namespace Firebird {
|
|
|
|
|
|
|
|
|
|
|
|
// Make new metadata support work together with old info-based buffers.
|
|
|
|
class StatementMetadata : public PermanentStorage
|
|
|
|
{
|
|
|
|
public:
|
2013-07-19 15:51:54 +02:00
|
|
|
class Parameters : public AttMetadata
|
2011-04-14 03:03:43 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-12-29 01:35:50 +01:00
|
|
|
explicit Parameters(IAttachment* att)
|
2013-07-19 15:51:54 +02:00
|
|
|
: AttMetadata(att),
|
2013-02-18 00:06:40 +01:00
|
|
|
fetched(false)
|
|
|
|
{
|
|
|
|
}
|
2011-04-14 03:03:43 +02:00
|
|
|
|
|
|
|
bool fetched;
|
|
|
|
};
|
|
|
|
|
2013-07-19 15:51:54 +02:00
|
|
|
StatementMetadata(MemoryPool& pool, IStatement* aStatement, IAttachment* att)
|
2011-04-14 03:03:43 +02:00
|
|
|
: PermanentStorage(pool),
|
|
|
|
statement(aStatement),
|
|
|
|
legacyPlan(pool),
|
|
|
|
detailedPlan(pool),
|
2013-07-19 15:51:54 +02:00
|
|
|
inputParameters(new Parameters(att)),
|
|
|
|
outputParameters(new Parameters(att))
|
2011-04-14 03:03:43 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned buildInfoItems(Array<UCHAR>& items, unsigned flags);
|
|
|
|
static unsigned buildInfoFlags(unsigned itemsLength, const UCHAR* items);
|
|
|
|
|
|
|
|
unsigned getType();
|
2013-02-19 12:20:49 +01:00
|
|
|
unsigned getFlags();
|
2011-04-14 03:03:43 +02:00
|
|
|
const char* getPlan(bool detailed);
|
2013-02-17 13:08:53 +01:00
|
|
|
IMessageMetadata* getInputMetadata();
|
|
|
|
IMessageMetadata* getOutputMetadata();
|
2011-04-14 03:03:43 +02:00
|
|
|
ISC_UINT64 getAffectedRecords();
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
void parse(unsigned bufferLength, const UCHAR* buffer);
|
|
|
|
void getAndParse(unsigned itemsLength, const UCHAR* items, unsigned bufferLength, UCHAR* buffer);
|
|
|
|
bool fillFromCache(unsigned itemsLength, const UCHAR* items, unsigned bufferLength, UCHAR* buffer);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void fetchParameters(UCHAR code, Parameters* parameters);
|
|
|
|
|
|
|
|
private:
|
|
|
|
IStatement* statement;
|
2013-02-19 12:20:49 +01:00
|
|
|
Nullable<unsigned> type, flags;
|
2011-04-14 03:03:43 +02:00
|
|
|
string legacyPlan, detailedPlan;
|
2013-02-17 13:08:53 +01:00
|
|
|
RefPtr<Parameters> inputParameters, outputParameters;
|
2011-04-14 03:03:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Firebird
|
|
|
|
|
|
|
|
#endif // COMMON_STATEMENT_METADATA_H
|