Commit c55af15c authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent a2bbb164
......@@ -58,10 +58,17 @@ BaseObjectPtr DConn::clone()
void DConn::readFields(CFRecord& record)
{
unsigned short flags1, reserved1;
unsigned char flags2, reserved2;
unsigned char flags2, reserved2, reserved3;
record >> frtHeaderOld >> dbt >> flags1 >> cParams >> reserved1 >> flags2 >> reserved2;
//DBT_ODBC 0x0001 ODBC-based source
//DBT_DAO 0x0002 DAO-based source
//DBT_WEB 0x0004 Web query
//DBT_OLEDB 0x0005 OLE DB-based source
//DBT_TXT 0x0006 Text-based source created via text query
//DBT_ADO 0x0007 ADO record set
fSavePwd = GETBIT(flags1, 0);
fTablesOnlyHtml = GETBIT(flags1, 1);
fTableNames = GETBIT(flags1, 2);
......@@ -84,17 +91,39 @@ void DConn::readFields(CFRecord& record)
case 4: grbitDbt.reset(new ConnGrbitDbtWeb); break;
case 5: grbitDbt.reset(new ConnGrbitDbtOledb); break;
case 7: grbitDbt.reset(new ConnGrbitDbtAdo); break;
default:
break;
}
if (grbitDbt)
{
record >> *grbitDbt;
}
else
{
unsigned short unused;
record >> unused;
}
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> wHtmlFmt >> rcc >> credMethod;
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> rcc >> credMethod >> reserved3;
record >> rgchSourceDataFile >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc >> rgchSSOApplicationID >> tableNames;
if (dbt == 5)
{
record >> rgchSourceDataFile;
}
record >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc;
for ( unsigned short i = 0; i < cParams; i++)
if (dbt == 1 || dbt == 5)
{
record >> rgchSSOApplicationID;
}
if (fTableNames)
{
record >> tableNames;
}
for ( unsigned short i = 0; fStandAlone && i < cParams; i++)
{
DConnParameter val;
params.push_back(val);
......@@ -111,7 +140,22 @@ void DConn::readFields(CFRecord& record)
if (connection)
record >> *connection;
record >> rgbSQL >> rgbSQLSav >> rgbEditWebPage >> id;
if (dbt == 1 || dbt == 5)
{
record >> rgbSQL;
}
if (dbt == 1)
{
record >> rgbSQLSav;
}
if (dbt == 4)
{
record >> rgbEditWebPage;
}
record >> id;
int skip = record.getDataSize() - record.getRdPtr();
......
......@@ -215,20 +215,30 @@ void XLUnicodeStringSegmented::load(CFRecord& record)
record >> cchTotal;
if (cchTotal < 1) return;
if (cchTotal > record.getDataSize() - record.getRdPtr())
{
cchTotal = cchTotal >> 8;
}
_UINT32 cchTotal_test = 0;
while(true)
{
if (record.isEOF())
break;
if (cchTotal_test >= cchTotal)
break;
_UINT32 max_string_size = cchTotal - cchTotal_test;
XLUnicodeString string;
record >> string;
cchTotal_test += string.value().length();
arStrings.push_back(string.value());
strTotal += string.value();
cchTotal_test += arStrings.back().length();
strTotal += arStrings.back();
}
}
......
......@@ -71,6 +71,10 @@ void PtgStr::loadFields(CFRecord& record)
{
string_ = string_.substr(1, string_.length() - 2);
}
else if (pos1 > 0)
{
boost::algorithm::replace_all(string_, L"\"", L"\"\"");
}
string_ = L"\"" + string_ + L"\"";
}
......
......@@ -67,6 +67,10 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
if ((name) && (name->ifdb >= 0 && name->ifdb < global_info->arPivotCacheSxNames.size()))
{
_Name = global_info->arPivotCacheSxNames[name->ifdb];
if (std::wstring::npos != _Name.find(L" "))
{
_Name = L"'" + _Name + L"'";
}
}
else if (!global_info->arPivotSxNames[sxIndex].pair.empty())
{
......
......@@ -97,7 +97,7 @@ int DBB::serialize(std::wostream & strm)
for (size_t i = 0; i < arPivotCacheFields.size(); i++)
{
if(arPivotCacheFields[i] == false)
if(arPivotCacheFields[i] == false && indexOPER < m_arSXOPER.size())
{
m_arSXOPER[indexOPER++]->serialize(CP_XML_STREAM());
}
......
......@@ -206,8 +206,8 @@ int DBQUERY::serialize_connection(std::wostream & strm)
{
CP_XML_NODE(L"connection")
{
CP_XML_ATTR(L"id", 1); //connectionId in connections(root)
CP_XML_ATTR(L"name", L"Connection");
CP_XML_ATTR(L"id", connectionId);
CP_XML_ATTR(L"name", L"Connection" + std::to_wstring(connectionId));
CP_XML_ATTR(L"type", queryOrParam->query.dbt);
//switch(queryOrParam->query.dbt)
......@@ -222,22 +222,24 @@ int DBQUERY::serialize_connection(std::wostream & strm)
//}
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"savePassword", 1);
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"refreshedVersion", 1);
CP_XML_ATTR(L"refreshedVersion", 1);
int index = 0;
CP_XML_NODE(L"dbPr")
{
if (index < m_arSXString.size())
std::wstring command, connection;
for (index = 0; index < queryOrParam->query.cstQuery; index++)
{
CP_XML_ATTR(L"command", m_arSXString[index]);
command += m_arSXString[index];
}
index++;
if (index < m_arSXString.size())
for (; index < queryOrParam->query.cstQuery + queryOrParam->query.cstOdbcConn; index++)
{
CP_XML_ATTR(L"connection", m_arSXString[index]);
connection += m_arSXString[index];
}
index++;
CP_XML_ATTR(L"connection", connection);
CP_XML_ATTR(L"command", command);
}
}
}
......
......@@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc)
return true;
}
int FDB::serialize(std::wostream & strm)
int FDB::serialize(std::wostream & strm, bool bSql)
{
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
......@@ -189,14 +189,21 @@ int FDB::serialize(std::wostream & strm)
CP_XML_NODE(L"cacheField")
{
CP_XML_ATTR(L"name", fdb->stFieldName.value());
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
//CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql); //in db
if (bSql)
{
CP_XML_ATTR(L"numFmtId", 0);
if (fdb_type->wTypeSql > 0)
CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql);
}
else
{
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
}
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
{
CP_XML_ATTR(L"databaseField", 0);
}
switch(fdb_type->wTypeSql)//format code
{
case 0x0000:
......
......@@ -47,7 +47,7 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
int serialize(std::wostream & strm, bool bSql);
static const ElementType type = typeFDB;
......
......@@ -34,6 +34,7 @@
#include "PIVOTCACHE.h"
#include "SXSRC.h"
#include "SXADDLCACHE.h"
#include "FDB.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/SXVS.h"
......@@ -110,6 +111,8 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
if (!db || !db_ex)return 0;
bool bSql = false;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotCacheDefinition")
......@@ -124,13 +127,16 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
CP_XML_ATTR(L"enableRefresh", 1);
CP_XML_ATTR(L"refreshedBy", db->rgb.value());
CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
CP_XML_ATTR(L"recordCount", db->crdbUsed);
CP_XML_ATTR(L"recordCount", db->crdbdb);
//createdVersion="1"
//refreshedVersion="2"
//upgradeOnRefresh="1">
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
if (src)
{
bSql = src->bSql;
src->serialize(CP_XML_STREAM());
}
if (pivot_cache->m_arFDB.empty() == false)
{
......@@ -140,7 +146,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
{
pivot_cache->m_arFDB[i]->serialize(CP_XML_STREAM());
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
if (!field) continue;
field->serialize(CP_XML_STREAM(), bSql);
}
}
}
......
......@@ -82,7 +82,10 @@ const bool SXOPER::loadContent(BinProcessor& proc)
}
bNumber = !bInteger;
node = L"n";
value = std::to_wstring(num->num.data.value);
if (bInteger)
value = std::to_wstring((int)num->num.data.value);
else
value = std::to_wstring(num->num.data.value);
}
else if(proc.optional<SxBool>())
{
......
......@@ -38,9 +38,9 @@
namespace XLS
{
SXSRC::SXSRC()
{
bSql = false;
}
......@@ -57,6 +57,7 @@ BaseObjectPtr SXSRC::clone()
// SXSRC = DREF / SXTBL / DBQUERY
const bool SXSRC::loadContent(BinProcessor& proc)
{
bSql = false;
if(!proc.optional<DREF>())
{
if(!proc.optional<SXTBL>())
......@@ -65,6 +66,7 @@ const bool SXSRC::loadContent(BinProcessor& proc)
{
return false;
}
bSql = true;
}
}
m_source = elements_.back();
......
......@@ -52,6 +52,7 @@ public:
static const ElementType type = typeSXSRC;
BaseObjectPtr m_source;
bool bSql;
};
} // namespace XLS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment