EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DBRowDescriptor Class Reference

Python object "blue.DBRowDescriptor". More...

#include "PyDatabase.h"

Inheritance diagram for DBRowDescriptor:
Collaboration diagram for DBRowDescriptor:

Public Member Functions

 DBRowDescriptor ()
 
 DBRowDescriptor (PyList *keywords)
 
 DBRowDescriptor (const DBQueryResult &res)
 
 DBRowDescriptor (const DBResultRow &row)
 
uint32 ColumnCount () const
 
PyStringGetColumnName (uint32 index) const
 
DBTYPE GetColumnType (uint32 index) const
 
uint32 FindColumn (const char *name) const
 
bool VerifyValue (uint32 index, PyRep *value)
 Verifies value for certain column. More...
 
void AddColumn (const char *name, DBTYPE type)
 
- Public Member Functions inherited from PyObjectEx_Type1
 PyObjectEx_Type1 (PyToken *type, PyTuple *args, bool enclosed=false)
 
 PyObjectEx_Type1 (PyObjectEx_Type1 *args1, PyTuple *args2, bool enclosed=false)
 
 PyObjectEx_Type1 (PyToken *type, PyTuple *args, PyDict *keywords, bool enclosed=false)
 
 PyObjectEx_Type1 (PyToken *type, PyTuple *args, PyList *keywords, bool enclosed=false)
 
PyTokenGetType () const
 
PyTupleGetArgs () const
 
PyDictGetKeywords () const
 
PyRepFindKeyword (const char *keyword) const
 
- Public Member Functions inherited from PyObjectEx
 PyObjectEx (bool is_type_2, PyRep *header)
 
 PyObjectEx (const PyObjectEx &oth)
 
 PyObjectEx (PyObjectEx &&oth)=delete
 
PyObjectExoperator= (const PyObjectEx &oth)
 
PyObjectExoperator= (PyObjectEx &&oth)=delete
 
PyRepClone () const
 Clones object. More...
 
bool visit (PyVisitor &v) const
 Visits object. More...
 
PyRepheader () const
 
bool isType2 () const
 
list_typelist ()
 
const list_typelist () const
 
dict_typedict ()
 
const dict_typedict () const
 
- Public Member Functions inherited from PyRep
PyType GetType () const
 
bool IsInt () const
 
bool IsLong () const
 
bool IsFloat () const
 
bool IsBool () const
 
bool IsBuffer () const
 
bool IsString () const
 
bool IsWString () const
 
bool IsToken () const
 
bool IsTuple () const
 
bool IsList () const
 
bool IsDict () const
 
bool IsNone () const
 
bool IsSubStruct () const
 
bool IsSubStream () const
 
bool IsChecksumedStream () const
 
bool IsObject () const
 
bool IsObjectEx () const
 
bool IsPackedRow () const
 
const char * TypeString () const
 
PyIntAsInt ()
 
const PyIntAsInt () const
 
PyLongAsLong ()
 
const PyLongAsLong () const
 
PyFloatAsFloat ()
 
const PyFloatAsFloat () const
 
PyBoolAsBool ()
 
const PyBoolAsBool () const
 
PyBufferAsBuffer ()
 
const PyBufferAsBuffer () const
 
PyStringAsString ()
 
const PyStringAsString () const
 
PyWStringAsWString ()
 
const PyWStringAsWString () const
 
PyTokenAsToken ()
 
const PyTokenAsToken () const
 
PyTupleAsTuple ()
 
const PyTupleAsTuple () const
 
PyListAsList ()
 
const PyListAsList () const
 
PyDictAsDict ()
 
const PyDictAsDict () const
 
PyNoneAsNone ()
 
const PyNoneAsNone () const
 
PySubStructAsSubStruct ()
 
const PySubStructAsSubStruct () const
 
PySubStreamAsSubStream ()
 
const PySubStreamAsSubStream () const
 
PyChecksumedStreamAsChecksumedStream ()
 
const PyChecksumedStreamAsChecksumedStream () const
 
PyObjectAsObject ()
 
const PyObjectAsObject () const
 
PyObjectExAsObjectEx ()
 
const PyObjectExAsObjectEx () const
 
PyPackedRowAsPackedRow ()
 
const PyPackedRowAsPackedRow () const
 
void Dump (FILE *into, const char *pfx) const
 Dumps object to file. More...
 
void Dump (LogType type, const char *pfx) const
 Dumps object to console. More...
 
virtual int32 hash () const
 virtual function to generate a hash value of a object. More...
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Protected Member Functions

virtual ~DBRowDescriptor ()
 
PyTuple_GetColumnList () const
 
PyTuple_GetColumn (size_t index) const
 
- Protected Member Functions inherited from PyObjectEx_Type1
virtual ~PyObjectEx_Type1 ()
 
- Protected Member Functions inherited from PyObjectEx
virtual ~PyObjectEx ()
 
- Protected Member Functions inherited from PyRep
 PyRep (PyType t)
 
 PyRep (const PyRep &oth)
 
 PyRep (PyRep &&oth)=delete
 
PyRepoperator= (const PyRep &oth)=default
 
PyRepoperator= (PyRep &&oth)=default
 
virtual ~PyRep ()
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Static Protected Member Functions

static PyTuple_CreateArgs ()
 
- Static Protected Member Functions inherited from PyObjectEx_Type1
static PyTuple_CreateHeader (PyToken *type, PyTuple *args, bool enclosed=false)
 
static PyTuple_CreateHeader (PyObjectEx_Type1 *args1, PyTuple *args2, bool enclosed=false)
 
static PyTuple_CreateHeader (PyToken *type, PyTuple *args, PyDict *keywords, bool enclosed=false)
 
static PyTuple_CreateHeader (PyToken *type, PyTuple *args, PyList *keywords, bool enclosed=false)
 

Additional Inherited Members

- Public Types inherited from PyObjectEx
typedef PyList list_type
 
typedef list_type::iterator list_iterator
 
typedef list_type::const_iterator const_list_iterator
 
typedef PyDict dict_type
 
typedef dict_type::iterator dict_iterator
 
typedef dict_type::const_iterator const_dict_iterator
 
- Public Types inherited from PyRep
enum  PyType {
  PyTypeMin = 0, PyTypeInt = 1, PyTypeLong = 2, PyTypeFloat = 3,
  PyTypeBool = 4, PyTypeBuffer = 5, PyTypeString = 6, PyTypeWString = 7,
  PyTypeToken = 8, PyTypeTuple = 9, PyTypeList = 10, PyTypeDict = 11,
  PyTypeNone = 12, PyTypeSubStruct = 13, PyTypeSubStream = 14, PyTypeChecksumedStream = 15,
  PyTypeObject = 16, PyTypeObjectEx = 17, PyTypePackedRow = 18, PyTypeError = 19
}
 Python wire object types. More...
 
- Static Public Member Functions inherited from PyRep
static std::string StringContent (PyRep *pRep)
 
static int64 IntegerValue (PyRep *pRep)
 
static uint32 IntegerValueU32 (PyRep *pRep)
 
- Protected Attributes inherited from PyObjectEx
PyRep *const mHeader
 
const bool mIsType2
 
list_type *const mList
 
dict_type *const mDict
 
- Protected Attributes inherited from PyRep
const PyType mType
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

Python object "blue.DBRowDescriptor".

This object is used by PyPackedRow and CRowSet to describe stored columns.

Author
Bloody.Rabbit

Definition at line 41 of file PyDatabase.h.

Constructor & Destructor Documentation

DBRowDescriptor::DBRowDescriptor ( )

Definition at line 34 of file PyDatabase.cpp.

35 : PyObjectEx_Type1( new PyToken( "blue.DBRowDescriptor" ), _CreateArgs() )
36 {
37 }
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:114
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:820
Python token (eg. class name).
Definition: PyRep.h:522
DBRowDescriptor::DBRowDescriptor ( PyList keywords)
Parameters
[in]keywordsSome sort of keyword list.

Definition at line 39 of file PyDatabase.cpp.

40 : PyObjectEx_Type1( new PyToken( "blue.DBRowDescriptor" ), _CreateArgs(), keywords )
41 {
42 }
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:114
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:820
Python token (eg. class name).
Definition: PyRep.h:522
DBRowDescriptor::DBRowDescriptor ( const DBQueryResult res)
Parameters
[in]resultQuery result to build column list from.

Definition at line 44 of file PyDatabase.cpp.

References AddColumn(), DBQueryResult::ColumnCount(), DBQueryResult::ColumnName(), and DBQueryResult::ColumnType().

45 : PyObjectEx_Type1( new PyToken( "blue.DBRowDescriptor" ), _CreateArgs() )
46 {
47  uint32 cc(res.ColumnCount());
48  for (uint32 i(0); i < cc; ++i)
49  AddColumn( res.ColumnName( i ), res.ColumnType( i ) );
50 }
void AddColumn(const char *name, DBTYPE type)
Definition: PyDatabase.cpp:96
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:114
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:820
uint32 ColumnCount() const
Definition: dbcore.h:76
const char * ColumnName(uint32 index) const
Definition: dbcore.cpp:569
unsigned __int32 uint32
Definition: eve-compat.h:50
Python token (eg. class name).
Definition: PyRep.h:522
DBTYPE ColumnType(uint32 index) const
Definition: dbcore.cpp:580

Here is the call graph for this function:

DBRowDescriptor::DBRowDescriptor ( const DBResultRow row)
Parameters
[in]resultRow to build column list from.

Definition at line 52 of file PyDatabase.cpp.

References AddColumn(), DBResultRow::ColumnCount(), DBResultRow::ColumnName(), and DBResultRow::ColumnType().

53 : PyObjectEx_Type1( new PyToken( "blue.DBRowDescriptor" ), _CreateArgs() )
54 {
55  uint32 cc(row.ColumnCount());
56  for (uint32 i(0); i < cc; ++i)
57  AddColumn( row.ColumnName( i ), row.ColumnType( i ) );
58 }
void AddColumn(const char *name, DBTYPE type)
Definition: PyDatabase.cpp:96
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:114
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:820
const char * ColumnName(uint32 index) const
Definition: dbcore.h:114
unsigned __int32 uint32
Definition: eve-compat.h:50
Python token (eg. class name).
Definition: PyRep.h:522
uint32 ColumnCount() const
Definition: dbcore.h:113
DBTYPE ColumnType(uint32 index) const
Definition: dbcore.h:115

Here is the call graph for this function:

virtual DBRowDescriptor::~DBRowDescriptor ( )
inlineprotectedvirtual

Definition at line 103 of file PyDatabase.h.

103 { /* do we need to do anything here? */ }

Member Function Documentation

PyTuple * DBRowDescriptor::_CreateArgs ( )
staticprotected

Definition at line 114 of file PyDatabase.cpp.

References args, and PyTuple::SetItem().

115 {
116  PyTuple* columnList = new PyTuple( 0 );
117  PyTuple* args = new PyTuple( 1 );
118  args->SetItem( 0, columnList );
119 
120  return args;
121 }
Python tuple.
Definition: PyRep.h:567
* args
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

PyTuple * DBRowDescriptor::_GetColumn ( size_t  index) const
protected

Definition at line 109 of file PyDatabase.cpp.

References _GetColumnList(), PyRep::AsTuple(), and PyTuple::GetItem().

Referenced by GetColumnName(), and GetColumnType().

110 {
111  return _GetColumnList()->GetItem( index )->AsTuple();
112 }
PyTuple * AsTuple()
Definition: PyRep.h:138
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
PyTuple * _GetColumnList() const
Definition: PyDatabase.cpp:104

Here is the call graph for this function:

Here is the caller graph for this function:

PyTuple * DBRowDescriptor::_GetColumnList ( ) const
protected

Definition at line 104 of file PyDatabase.cpp.

References PyRep::AsTuple(), PyObjectEx_Type1::GetArgs(), and PyTuple::GetItem().

Referenced by _GetColumn(), AddColumn(), and ColumnCount().

105 {
106  return GetArgs()->GetItem( 0 )->AsTuple();
107 }
PyTuple * AsTuple()
Definition: PyRep.h:138
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
PyTuple * GetArgs() const
Definition: PyRep.cpp:835

Here is the call graph for this function:

Here is the caller graph for this function:

void DBRowDescriptor::AddColumn ( const char *  name,
DBTYPE  type 
)

Adds new column.

Parameters
[in]nameName of new column.
[in]typeType of new column.

Definition at line 96 of file PyDatabase.cpp.

References _GetColumnList(), PyTuple::items, and PyTuple::SetItem().

Referenced by StaticDataMgr::CreateHeader(), DBRowDescriptor(), LiveUpdateDB::GenerateUpdates(), InventoryItem::GetChargeStatusRow(), SovereigntyDataMgr::GetCurrentSovData(), InventoryItem::GetItemStatusRow(), marshal_EVEMarshalTest(), and StaticDataMgr::SetBPMatlType().

97 {
98  PyTuple* col = new PyTuple( 2 );
99  col->SetItem( 0, new PyString( name ) );
100  col->SetItem( 1, new PyInt( type ) );
101  _GetColumnList()->items.push_back( col );
102 }
Python string.
Definition: PyRep.h:430
Python tuple.
Definition: PyRep.h:567
PyTuple * _GetColumnList() const
Definition: PyDatabase.cpp:104
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python integer.
Definition: PyRep.h:231
storage_type items
Definition: PyRep.h:628

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 DBRowDescriptor::ColumnCount ( ) const
Returns
Column count.

Definition at line 60 of file PyDatabase.cpp.

References _GetColumnList(), and PyTuple::size().

Referenced by FindColumn(), MarketDB::GetMarketGroups(), UnmarshalStream::LoadPackedRow(), and PyDumpVisitor::VisitPackedRow().

61 {
62  return _GetColumnList()->size();
63 }
size_t size() const
Definition: PyRep.h:591
PyTuple * _GetColumnList() const
Definition: PyDatabase.cpp:104

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 DBRowDescriptor::FindColumn ( const char *  name) const
Parameters
[in]nameName of column index of which should be returned.
Returns
Index of column; column count if not found.

Definition at line 75 of file PyDatabase.cpp.

References ColumnCount(), GetColumnName(), PyString::hash(), and PyDecRef.

76 {
77  uint32 cc(ColumnCount());
78  PyString* stringName = new PyString( name );
79 
80  for( uint32 i(0); i < cc; ++i ) {
81  if( stringName->hash() == GetColumnName( i )->hash() ) {
82  PyDecRef( stringName );
83  return i;
84  }
85  }
86 
87  PyDecRef( stringName );
88  return cc;
89 }
Python string.
Definition: PyRep.h:430
PyString * GetColumnName(uint32 index) const
Definition: PyDatabase.cpp:65
uint32 ColumnCount() const
Definition: PyDatabase.cpp:60
#define PyDecRef(op)
Definition: PyRep.h:57
unsigned __int32 uint32
Definition: eve-compat.h:50
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:460

Here is the call graph for this function:

PyString * DBRowDescriptor::GetColumnName ( uint32  index) const
Parameters
[in]indexIndex of column name of which should be returned.
Returns
Name of column.

Definition at line 65 of file PyDatabase.cpp.

References _GetColumn(), PyRep::AsString(), and PyTuple::GetItem().

Referenced by CIndexedRowSet::_CreateKeywords(), CFilterRowSet::_CreateKeywords(), FindColumn(), and PyDumpVisitor::VisitPackedRow().

66 {
67  return _GetColumn( index )->GetItem( 0 )->AsString();
68 }
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
PyTuple * _GetColumn(size_t index) const
Definition: PyDatabase.cpp:109
PyString * AsString()
Definition: PyRep.h:132

Here is the call graph for this function:

Here is the caller graph for this function:

DBTYPE DBRowDescriptor::GetColumnType ( uint32  index) const
Parameters
[in]indexIndex of column type of which should be returned.
Returns
Type of column.

Definition at line 70 of file PyDatabase.cpp.

References _GetColumn(), PyRep::AsInt(), PyTuple::GetItem(), and PyInt::value().

Referenced by UnmarshalStream::LoadPackedRow(), and VerifyValue().

71 {
72  return (DBTYPE)_GetColumn( index )->GetItem( 1 )->AsInt()->value();
73 }
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
int32 value() const
Definition: PyRep.h:247
PyTuple * _GetColumn(size_t index) const
Definition: PyDatabase.cpp:109
DBTYPE
Definition: dbtype.h:67
PyInt * AsInt()
Definition: PyRep.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

bool DBRowDescriptor::VerifyValue ( uint32  index,
PyRep value 
)

Verifies value for certain column.

Parameters
[in]indexIndex of the column.
[in]valueThe value.
Return values
trueType of column and type of value are compatible.
falseType of column and type of value aren't compatible.

Definition at line 91 of file PyDatabase.cpp.

References DBTYPE_IsCompatible(), and GetColumnType().

92 {
93  return DBTYPE_IsCompatible( GetColumnType( index ), value );
94 }
bool DBTYPE_IsCompatible(DBTYPE type, const PyRep *rep)
Definition: EVEUtils.cpp:42
DBTYPE GetColumnType(uint32 index) const
Definition: PyDatabase.cpp:70

Here is the call graph for this function:


The documentation for this class was generated from the following files: