[fdo-internals] Please review http://trac.osgeo.org/fdo/attachment/ticket/907/Fix907.patch

Christine Bao Christine.Bao at autodesk.com
Mon May 11 20:31:28 PDT 2015


Hi Greg,

The function context is below. Check if (m_nTotalProps == 0) because m_nTotalProps can be setup above.

SltReader::SltReader(SltConnection* connection, FdoIdentifierCollection* props, FdoParameterValueCollection*  parmValues, const char* fcname, const char* sql)
: m_refCount(1),
m_pStmt(0),
m_class(NULL),
m_sprops(NULL),
m_closeOpcode(-1),
m_curfid(0),
m_nMaxProps(0),
m_nTotalProps(0),
m_eGeomFormat(eFGF),
m_wkbBuffer(NULL),
m_wkbBufferLen(0),
m_closeDB(ReaderCloseType_None),
m_useFastStepping(false),
m_ri(NULL),
m_aPropNames(NULL),
m_filter(NULL),
m_fromwhere(),
m_isViewSelect(false),
m_canAddSelectProps(false)
{
       m_connection = FDO_SAFE_ADDREF(connection);
    m_parmValues  = FDO_SAFE_ADDREF(parmValues);

    SltMetadata* md = m_connection->GetMetadata(fcname);
    if (!md)
        throw FdoCommandException::Create(L"Requested feature class does not exist in the database.");

       if (props && props->GetCount())
       {
        FdoPtr<FdoClassDefinition> clsDef = md->ToClass();
        SltExpressionTranslator exTrans(props, clsDef);
              int nProps = props->GetCount();
        m_reissueProps.Reserve(nProps);
              for (int i=0; i<nProps; i++)
              {
                     FdoPtr<FdoIdentifier> id = props->GetItem(i);
            exTrans.Reset();
            id->Process(&exTrans);
            StringBuffer* exp = exTrans.GetExpression();
            m_reissueProps.Add(exp->Data(), exp->Length());
        }
        m_nTotalProps = nProps;
       }
    //remember the geometry encoding format
    m_eGeomFormat = md->GetGeomFormat();

    m_mainClassName = fcname;
    m_sql.Append(sql);
    m_pStmt = m_connection->GetCachedParsedStatement(m_sql.Data());
    InitPropIndex(m_pStmt);
       if (m_nTotalProps == 0)
       {
              m_nTotalProps = sqlite3_column_count(m_pStmt);
       }
}

Thanks & regards,
Christine

From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Greg Boone
Sent: Tuesday, May 12, 2015 6:50 AM
To: FDO Internals Mail List
Subject: Re: [fdo-internals] Please review http://trac.osgeo.org/fdo/attachment/ticket/907/Fix907.patch

Regarding....

if (m_nTotalProps == 0)
{
    m_nTotalProps = sqlite3_column_count(m_pStmt);
}

Why is the m_nTotalProps check for 0 needed? Why not directly call sqlite3_column_count(m_pStmt) ?  m_pStmt has just been reset in the statement above.

m_pStmt = m_connection->GetCachedParsedStatement(m_sql.Data());

Greg

From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Romica Dascalescu
Sent: Monday, May 11, 2015 11:28 AM
To: FDO Internals Mail List
Subject: Re: [fdo-internals] Please review http://trac.osgeo.org/fdo/attachment/ticket/907/Fix907.patch

+1

From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Christine Bao
Sent: Monday, May 11, 2015 6:00 AM
To: fdo-internals at lists.osgeo.org
Subject: [fdo-internals] Please review http://trac.osgeo.org/fdo/attachment/ticket/907/Fix907.patch

Hi all,

Please review http://trac.osgeo.org/fdo/attachment/ticket/907/Fix907.patch for fixing ticket http://trac.osgeo.org/fdo/ticket/907.

Thanks & regards,
Christine

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/fdo-internals/attachments/20150512/d7640c9e/attachment-0001.html>


More information about the fdo-internals mailing list