mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-09-04 06:04:50 -06:00
support PG11
Поддержка PostgreSQL 11 только для Windows
This commit is contained in:
commit
4af765213c
1765 changed files with 407959 additions and 0 deletions
22
include/pgscript/objects/module.mk
Normal file
22
include/pgscript/objects/module.mk
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/pgscript/objects/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/pgscript/objects/pgsGenerator.h \
|
||||
include/pgscript/objects/pgsNumber.h \
|
||||
include/pgscript/objects/pgsObjects.h \
|
||||
include/pgscript/objects/pgsRecord.h \
|
||||
include/pgscript/objects/pgsString.h \
|
||||
include/pgscript/objects/pgsVariable.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/pgscript/objects/module.mk
|
||||
|
||||
94
include/pgscript/objects/pgsGenerator.h
Normal file
94
include/pgscript/objects/pgsGenerator.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSGENERATOR_H_
|
||||
#define PGSGENERATOR_H_
|
||||
|
||||
#include "pgscript/pgScript.h"
|
||||
#include "pgscript/generators/pgsObjectGen.h"
|
||||
#include "pgscript/objects/pgsVariable.h"
|
||||
#include "pgscript/utilities/pgsSharedPtr.h"
|
||||
|
||||
class pgsNumber;
|
||||
class pgsRecord;
|
||||
class pgsString;
|
||||
|
||||
class pgsGenerator : public pgsVariable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsOperand pgs_plus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_minus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_times(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_over(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_modulo(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_different(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_not() const;
|
||||
|
||||
virtual bool pgs_is_true() const;
|
||||
|
||||
virtual pgsOperand pgs_almost_equal(const pgsVariable &rhs) const;
|
||||
|
||||
protected:
|
||||
|
||||
typedef pgsSharedPtr<pgsObjectGen> pgsRandomizer;
|
||||
|
||||
mutable pgsRandomizer m_randomizer;
|
||||
|
||||
public:
|
||||
|
||||
pgsGenerator(const pgsTypes &generator_type, pgsObjectGen *randomizer);
|
||||
|
||||
virtual ~pgsGenerator();
|
||||
|
||||
virtual pgsVariable *clone() const;
|
||||
|
||||
/* pgsGenerator(const pgsGenerator & that); */
|
||||
|
||||
/* pgsGenerator & operator =(const pgsGenerator & that); */
|
||||
|
||||
public:
|
||||
|
||||
virtual wxString value() const;
|
||||
|
||||
virtual pgsOperand eval(pgsVarMap &vars) const;
|
||||
|
||||
protected:
|
||||
|
||||
pgsOperand operand() const;
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsNumber number() const;
|
||||
|
||||
virtual pgsRecord record() const;
|
||||
|
||||
virtual pgsString string() const;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PGSGENERATOR_H_*/
|
||||
98
include/pgscript/objects/pgsNumber.h
Normal file
98
include/pgscript/objects/pgsNumber.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSNUMBER_H_
|
||||
#define PGSNUMBER_H_
|
||||
|
||||
#include "pgscript/pgScript.h"
|
||||
#include "pgscript/objects/pgsVariable.h"
|
||||
|
||||
class pgsRecord;
|
||||
class pgsString;
|
||||
|
||||
/**
|
||||
* A pgsNumber represents either a number or a string. If the data (a string)
|
||||
* matches with a regular expression that represents a number then it is a
|
||||
* number otherwise it is a string. The difference between a string stored
|
||||
* in this object and a string stored in pgsString is that a string in pgsNumber
|
||||
* cannot be concatenated with another one in pgsPlus.
|
||||
*/
|
||||
class pgsNumber : public pgsVariable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsOperand pgs_plus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_minus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_times(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_over(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_modulo(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_different(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_not() const;
|
||||
|
||||
virtual bool pgs_is_true() const;
|
||||
|
||||
virtual pgsOperand pgs_almost_equal(const pgsVariable &rhs) const;
|
||||
|
||||
protected:
|
||||
|
||||
wxString m_data;
|
||||
|
||||
public:
|
||||
|
||||
explicit pgsNumber(const wxString &data, const bool &is_real = pgsInt);
|
||||
|
||||
virtual ~pgsNumber();
|
||||
|
||||
virtual pgsVariable *clone() const;
|
||||
|
||||
pgsNumber(const pgsNumber &that);
|
||||
|
||||
pgsNumber &operator =(const pgsNumber &that);
|
||||
|
||||
public:
|
||||
|
||||
virtual wxString value() const;
|
||||
|
||||
virtual pgsOperand eval(pgsVarMap &vars) const;
|
||||
|
||||
public:
|
||||
|
||||
bool is_valid() const;
|
||||
|
||||
static pgsTypes num_type(const wxString &num);
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsNumber number() const;
|
||||
|
||||
virtual pgsRecord record() const;
|
||||
|
||||
virtual pgsString string() const;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PGSNUMBER_H_*/
|
||||
20
include/pgscript/objects/pgsObjects.h
Normal file
20
include/pgscript/objects/pgsObjects.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSOBJECTS_H_
|
||||
#define PGSOBJECTS_H_
|
||||
|
||||
#include "pgsGenerator.h"
|
||||
#include "pgsNumber.h"
|
||||
#include "pgsRecord.h"
|
||||
#include "pgsString.h"
|
||||
#include "pgsVariable.h"
|
||||
|
||||
#endif /*PGSOBJECTS_H_*/
|
||||
155
include/pgscript/objects/pgsRecord.h
Normal file
155
include/pgscript/objects/pgsRecord.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSRECORD_H_
|
||||
#define PGSRECORD_H_
|
||||
|
||||
#include "pgscript/pgScript.h"
|
||||
#include "pgscript/objects/pgsVariable.h"
|
||||
|
||||
WX_DECLARE_OBJARRAY(pgsOperand, pgsVectorRecordLine);
|
||||
WX_DECLARE_OBJARRAY(pgsVectorRecordLine, pgsVectorRecord);
|
||||
|
||||
class pgsNumber;
|
||||
class pgsString;
|
||||
|
||||
class pgsRecord : public pgsVariable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsOperand pgs_plus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_minus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_times(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_over(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_modulo(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_different(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_not() const;
|
||||
|
||||
virtual bool pgs_is_true() const;
|
||||
|
||||
virtual pgsOperand pgs_almost_equal(const pgsVariable &rhs) const;
|
||||
|
||||
protected:
|
||||
|
||||
pgsVectorRecord m_record;
|
||||
|
||||
wxArrayString m_columns;
|
||||
|
||||
public:
|
||||
|
||||
explicit pgsRecord(const USHORT &nb_columns);
|
||||
|
||||
virtual ~pgsRecord();
|
||||
|
||||
virtual pgsVariable *clone() const;
|
||||
|
||||
/* pgsRecord(const pgsRecord & that); */
|
||||
|
||||
/* pgsRecord & operator =(const pgsRecord & that); */
|
||||
|
||||
virtual wxString value() const;
|
||||
|
||||
virtual pgsOperand eval(pgsVarMap &vars) const;
|
||||
|
||||
public:
|
||||
|
||||
USHORT count_lines() const;
|
||||
|
||||
USHORT count_columns() const;
|
||||
|
||||
/**
|
||||
* Inserts a new element at line.column. If there is something then
|
||||
* it is deleted before inserting the new element.
|
||||
*/
|
||||
bool insert(const USHORT &line, const USHORT &column,
|
||||
pgsOperand value);
|
||||
|
||||
/**
|
||||
* Retrieves the element at line.column. If it does not exist it
|
||||
* returns an empty string.
|
||||
*/
|
||||
pgsOperand get(const USHORT &line,
|
||||
const USHORT &column) const;
|
||||
|
||||
pgsOperand get_line(const USHORT &line) const;
|
||||
|
||||
/**
|
||||
* Sets the name of a column. If the index is too high or if the name
|
||||
* already exists then false is returned.
|
||||
*/
|
||||
bool set_column_name(const USHORT &column, wxString name);
|
||||
|
||||
/**
|
||||
* Gets the index of a given column. If this column does not exist then it
|
||||
* returns count_columns() (the number of columns) which means that this value
|
||||
* is unusable. So if get_column(...) == count_colums() an error occurred.
|
||||
*/
|
||||
USHORT get_column(wxString name) const;
|
||||
|
||||
bool remove_line(const USHORT &line);
|
||||
|
||||
private:
|
||||
|
||||
bool newline();
|
||||
|
||||
bool valid() const;
|
||||
|
||||
public:
|
||||
|
||||
bool operator==(const pgsRecord &rhs) const;
|
||||
|
||||
bool operator!=(const pgsRecord &rhs) const;
|
||||
|
||||
bool operator<(const pgsRecord &rhs) const;
|
||||
|
||||
bool operator>(const pgsRecord &rhs) const;
|
||||
|
||||
bool operator<=(const pgsRecord &rhs) const;
|
||||
|
||||
bool operator>=(const pgsRecord &rhs) const;
|
||||
|
||||
bool almost_equal(const pgsRecord &rhs) const;
|
||||
|
||||
private:
|
||||
|
||||
bool records_equal(const pgsRecord &lhs, const pgsRecord &rhs,
|
||||
bool case_sensitive = true) const;
|
||||
|
||||
bool lines_equal(const pgsVectorRecordLine &lhs,
|
||||
const pgsVectorRecordLine &rhs, bool case_sensitive = true) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsNumber number() const;
|
||||
|
||||
virtual pgsRecord record() const;
|
||||
|
||||
virtual pgsString string() const;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PGSRECORD_H_*/
|
||||
85
include/pgscript/objects/pgsString.h
Normal file
85
include/pgscript/objects/pgsString.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSSTRING_H_
|
||||
#define PGSSTRING_H_
|
||||
|
||||
#include "pgscript/pgScript.h"
|
||||
#include "pgscript/objects/pgsVariable.h"
|
||||
|
||||
class pgsRecord;
|
||||
class pgsString;
|
||||
|
||||
class pgsString : public pgsVariable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsOperand pgs_plus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_minus(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_times(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_over(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_modulo(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_different(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_lower_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_greater_equal(const pgsVariable &rhs) const;
|
||||
|
||||
virtual pgsOperand pgs_not() const;
|
||||
|
||||
virtual bool pgs_is_true() const;
|
||||
|
||||
virtual pgsOperand pgs_almost_equal(const pgsVariable &rhs) const;
|
||||
|
||||
protected:
|
||||
|
||||
wxString m_data;
|
||||
|
||||
public:
|
||||
|
||||
explicit pgsString(const wxString &data);
|
||||
|
||||
virtual ~pgsString();
|
||||
|
||||
virtual pgsVariable *clone() const;
|
||||
|
||||
/* pgsString(const pgsString & that); */
|
||||
|
||||
/* pgsString & operator =(const pgsString & that); */
|
||||
|
||||
public:
|
||||
|
||||
virtual wxString value() const;
|
||||
|
||||
virtual pgsOperand eval(pgsVarMap &vars) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsNumber number() const;
|
||||
|
||||
virtual pgsRecord record() const;
|
||||
|
||||
virtual pgsString string() const;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PGSSTRING_H_*/
|
||||
138
include/pgscript/objects/pgsVariable.h
Normal file
138
include/pgscript/objects/pgsVariable.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgScript - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef PGSVARIABLE_H_
|
||||
#define PGSVARIABLE_H_
|
||||
|
||||
#include "pgscript/pgScript.h"
|
||||
#include "pgscript/utilities/pgsMapm.h"
|
||||
#include "pgscript/expressions/pgsExpression.h"
|
||||
|
||||
class pgsNumber;
|
||||
class pgsRecord;
|
||||
class pgsString;
|
||||
|
||||
class pgsVariable : public pgsExpression
|
||||
{
|
||||
|
||||
friend pgsOperand operator+(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator-(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator*(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator/(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator%(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator==(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator!=(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator<(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator>(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator<=(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator>=(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
friend pgsOperand operator!(const pgsVariable &lhs);
|
||||
|
||||
friend pgsOperand operator&=(const pgsVariable &lhs, const pgsVariable &rhs);
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsOperand pgs_plus(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_minus(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_times(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_over(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_modulo(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_equal(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_different(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_greater(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_lower(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_lower_equal(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_greater_equal(const pgsVariable &rhs) const = 0;
|
||||
|
||||
virtual pgsOperand pgs_not() const = 0;
|
||||
|
||||
virtual bool pgs_is_true() const = 0;
|
||||
|
||||
virtual pgsOperand pgs_almost_equal(const pgsVariable &rhs) const = 0;
|
||||
|
||||
public:
|
||||
|
||||
enum pgsTypes
|
||||
{
|
||||
pgsTReal, pgsTInt, pgsTString, pgsTRecord
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
pgsVariable(const pgsTypes &type);
|
||||
|
||||
pgsTypes m_type;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~pgsVariable();
|
||||
|
||||
virtual pgsVariable *clone() const = 0;
|
||||
|
||||
/* pgsVariable(const pgsVariable & that); */
|
||||
|
||||
/* pgsVariable & operator =(const pgsVariable & that); */
|
||||
|
||||
static MAPM num(const pgsOperand &var);
|
||||
|
||||
static MAPM num(const wxString &var);
|
||||
|
||||
public:
|
||||
|
||||
virtual wxString value() const = 0;
|
||||
|
||||
virtual pgsOperand eval(pgsVarMap &vars) const = 0;
|
||||
|
||||
public:
|
||||
|
||||
bool is_number() const;
|
||||
|
||||
bool is_integer() const;
|
||||
|
||||
bool is_real() const;
|
||||
|
||||
bool is_string() const;
|
||||
|
||||
bool is_record() const;
|
||||
|
||||
const pgsTypes &type() const;
|
||||
|
||||
public:
|
||||
|
||||
virtual pgsNumber number() const = 0;
|
||||
|
||||
virtual pgsRecord record() const = 0;
|
||||
|
||||
virtual pgsString string() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PGSVARIABLE_H_*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue