39 for(
uint32 i = 0; i < cc; ++i )
65 return std::to_string( GetBool( index ) ? 1 : 0 );
67 return std::to_string( GetInt( index ) );
69 return std::to_string( GetLong( index ) );
73 snprintf( buf, 64,
"%f", GetFloat( index ) );
78 std::string str = GetString( index );
81 str.insert( str.begin(),
'\'' );
82 str.insert( str.end(),
'\'' );
88 std::string str = GetWString( index );
91 str.insert( str.begin(),
'\'' );
92 str.insert( str.end(),
'\'' );
99 snprintf( buf, 64,
"'UNKNOWN TYPE %u'", t );
107 if( _baseReader()->
rowCount() > _rowIndex() )
108 _SetRow( _rowIndex() + 1 );
115 if( 0 < _rowIndex() )
116 _SetRow( _rowIndex() - 1 );
125 else if( _rowIndex() != other.
_rowIndex() )
135 if( NULL == GetRep( index ) )
142 return GetRep( index )->AsBool()->value();
147 return GetRep( index )->AsInt()->value();
152 return GetRep( index )->AsLong()->value();
157 return GetRep( index )->AsFloat()->value();
162 return GetRep( index )->AsString()->content().c_str();
167 return GetRep( index )->AsWString()->content().c_str();
200 if( _rowIndex() != rowIndex )
202 mRow = ( mParent->rowCount() > rowIndex
203 ? mParent->_GetRow( rowIndex )
234 if( _rowIndex() != rowIndex )
236 mRow = ( mParent->rowCount() > rowIndex
237 ? mParent->_GetRow( rowIndex )
249 mKeyField( keyField ),
268 cur = possible_header->
begin();
269 end = possible_header->
end();
270 for(; valid && cur != end; ++cur)
272 if( !(*cur)->IsString() )
276 cur = possible_items->
begin();
277 end = possible_items->
end();
278 for(; valid && cur != end; ++cur)
280 if( !(*cur)->IsList() )
290 util_Tupleset rowset;
294 if( !rowset.Decode( &dup ) )
295 sLog.Error(
"SetSQLDumper",
"Unable to interpret tuple as a tupleset, it may not even be one." );
302 sLog.Error(
"SetSQLDumper",
"Failed to convert tupleset to SQL." );
320 if( !rowset.Decode( &dup ) )
321 sLog.Error(
"SetSQLDumper",
"Unable to load a rowset from the object body!" );
328 sLog.Error(
"SetSQLDumper",
"Failed to convert rowset to SQL." );
std::string GetAsString(size_t index) const
virtual size_t columnCount() const =0
virtual bool VisitTuple(const PyTuple *rep)
the nested types Visitor
PyRep * GetItem(size_t index) const
Returns Python object.
virtual const char * columnName(size_t index) const =0
virtual size_t rowCount() const =0
const iterator & operator++()
bool operator==(const iterator &oth) const
virtual BaseRowsetReader * _baseReader() const =0
const std::string mKeyField
SetSQLDumper(const char *table, const char *keyField, FILE *out)
const_iterator begin() const
storage_type::const_iterator const_iterator
uint32 GetInt(size_t index) const
virtual void _SetRow(size_t rowIndex)
void _SetRow(size_t rowIndex)
PyToken * GetType() const
const iterator & operator--()
#define sLog
Evaluates to a NewLog instance.
TuplesetReader(const util_Tupleset &tupleset)
bool VisitObject(const PyObject *rep)
Object type visitor.
virtual size_t FindColumn(const char *name)
int64 GetLong(size_t index) const
bool GetBool(size_t index) const
virtual size_t _rowIndex() const
bool IsNone(size_t index) const
void _SetRow(size_t rowIndex)
PyType
Python wire object types.
virtual bool VisitObject(const PyObject *rep)
Object type visitor.
const char * GetString(size_t index) const
const_iterator end() const
const char * GetWString(size_t index) const
bool VisitTuple(const PyTuple *rep)
the nested types Visitor
double GetFloat(size_t index) const
const std::string & content() const
Get the PyString content.
void SearchReplace(std::string &subject, const std::string &search, const std::string &replace)
Does search & replace on subject.
virtual bool IsNone(size_t index) const
RowsetReader(const util_Rowset &rowset)