|
drizzle
C++ MySQL-protocol-compatible database server
|
#include <config.h>#include <boost/lexical_cast.hpp>#include <drizzled/charset.h>#include <drizzled/message.h>#include <drizzled/message/statement_transform.h>#include <drizzled/message/transaction.pb.h>#include <drizzled/message/access.h>#include <string>#include <vector>#include <sstream>#include <cstdio>Go to the source code of this file.
Namespaces | |
| namespace | drizzled |
| TODO: Rename this file - func.h is stupid. | |
Implementation of various routines that can be used to convert Statement messages to other formats, including SQL strings.
Definition in file statement_transform.cc.
|
static |
Definition at line 70 of file statement_transform.cc.
|
static |
Definition at line 55 of file statement_transform.cc.
| drizzled::message::Table::Field::FieldType drizzled::message::internalFieldTypeToFieldProtoType | ( | enum enum_field_types | type | ) |
Definition at line 1582 of file statement_transform.cc.
| bool drizzled::message::shouldQuoteFieldValue | ( | Table::Field::FieldType | in_type | ) |
Returns true if the supplied message::Table::Field::FieldType should have its values quoted when modifying values.
| [in] | type | of field |
Definition at line 1568 of file statement_transform.cc.
| bool drizzled::message::transactionContainsBulkSegment | ( | const Transaction & | transaction | ) |
Returns true if the transaction contains any Statement messages which are not end segments (i.e. a bulk statement has previously been sent to replicators).
| The | transaction to check |
Definition at line 1623 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformAlterSchemaStatementToSql | ( | const AlterSchemaStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied AlterSchemaStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| AlterSchemaStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 820 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformCreateSchemaStatementToSql | ( | const CreateSchemaStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied CreateSchemaStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| CreateSchemaStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 868 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformCreateTableStatementToSql | ( | const CreateTableStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Appends to supplied string an SQL expression containing the supplied CreateTableStatement's appropriate CREATE TABLE SQL statement.
Definition at line 984 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformDeleteHeaderToSql | ( | const DeleteHeader & | header, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Helper function to construct the header portion of a DELETE SQL statement from an DeleteHeader message.
| DeleteHeader | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 664 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformDeleteRecordToSql | ( | const DeleteHeader & | header, |
| const DeleteRecord & | record, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied DeleteHeader and a single DeleteRecord message and constructs a correctly-formatted SQL statement to the supplied destination string.
| DeleteHeader | message to transform |
| DeleteRecord | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 685 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformDeleteStatementToSql | ( | const DeleteHeader & | header, |
| const DeleteData & | data, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied DeleteHeader and DeleteData message and constructs a correctly-formatted SQL statement to the supplied destination string.
This function constructs a single SQL statement for all keys in the DeleteData message.
| DeleteHeader | message to transform |
| DeleteData | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 747 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformDropSchemaStatementToSql | ( | const DropSchemaStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied DropSchemaStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| DropSchemaStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 851 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformDropTableStatementToSql | ( | const DropTableStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied DropTableStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| DropTableStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 906 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformFieldDefinitionToSql | ( | const Table::Field & | field, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Appends to the supplied string an SQL expression representing the field's attributes. The built string corresponds to the SQL in a CREATE TABLE statement.
| [in] | Field | message |
| [out] | String | to append to |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 1357 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformForeignKeyConstraintDefinitionToSql | ( | const Table::ForeignKeyConstraint & | fkey, |
| const Table & | table, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Appends to the supplied string an SQL expression representing the foreign key attributes. The built string corresponds to the SQL in a CREATE TABLE statement.
| [in] | Foreign | Key Constraint message |
| [in] | Table | containing this foregin key (used to get field names...) |
| [out] | String | to append to |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 1295 of file statement_transform.cc.
|
static |
Definition at line 1271 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformIndexDefinitionToSql | ( | const Table::Index & | index, |
| const Table & | table, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Appends to the supplied string an SQL expression representing the index's attributes. The built string corresponds to the SQL in a CREATE INDEX statement.
| [in] | Index | message |
| [in] | Table | containing this index (used to get field names...) |
| [out] | String | to append to |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 1180 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformInsertHeaderToSql | ( | const InsertHeader & | header, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Helper function to construct the header portion of an INSERT SQL statement from an InsertHeader message.
| InsertHeader | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 359 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformInsertRecordToSql | ( | const InsertHeader & | header, |
| const InsertRecord & | record, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied InsertHeader and a single InsertRecord message and constructs a correctly-formatted SQL statement to the supplied destination string.
| InsertHeader | message to transform |
| InsertRecord | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 396 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformInsertStatementToSql | ( | const InsertHeader & | header, |
| const InsertData & | data, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied InsertHeader and InsertData message and constructs a correctly-formatted SQL statement to the supplied destination string.
This function is used when you want to construct a single SQL statement from an entire InsertHeader and InsertData message. If there are many records in the InsertData message, the SQL statement will be a multi-value INSERT statement.
| InsertHeader | message to transform |
| InsertData | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 465 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformSetVariableStatementToSql | ( | const SetVariableStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied SetVariableStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| SetVariableStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 960 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformStatementToSql | ( | const Statement & | source, |
| std::vector< std::string > & | sql_strings, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE, | ||
| bool | already_in_transaction = false ) |
This function looks at the Statement message and appends one or more correctly-formatted SQL strings to the supplied vector of strings.
| Statement | message to transform |
| Vector | of strings to append SQL statements to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 121 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformTableDefinitionToSql | ( | const Table & | table, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE, | ||
| bool | with_schema = true ) |
Appends to the supplied string an SQL expression representing the table for a CREATE TABLE expression.
| [in] | Table | message |
| [out] | String | to append to |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 992 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformTableOptionsToSql | ( | const Table::TableOptions & | table_options, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Appends to the supplied string an SQL expression representing the table's optional attributes.
This function will eventually be a much simpler listing of key/value pairs.
| [in] | TableOptions | message |
| [out] | String | to append to |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 1112 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformTruncateTableStatementToSql | ( | const TruncateTableStatement & | statement, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied TruncateTableStatement and constructs a correctly-formatted SQL statement to the supplied destination string.
| TruncateTableStatement | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 937 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformUpdateHeaderToSql | ( | const UpdateHeader & | header, |
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
Helper function to construct the header portion of an UPDATE SQL statement from an UpdateHeader message.
| UpdateHeader | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 527 of file statement_transform.cc.
| enum TransformSqlError drizzled::message::transformUpdateRecordToSql | ( | const UpdateHeader & | header, |
| const UpdateRecord & | record, | ||
| std::string & | destination, | ||
| enum TransformSqlVariant | sql_variant = DRIZZLE ) |
This function looks at a supplied UpdateHeader and a single UpdateRecord message and constructs a correctly-formatted SQL statement to the supplied destination string.
| UpdateHeader | message to transform |
| UpdateRecord | message to transform |
| Destination | string to append SQL to |
| Variation | of SQL to generate |
| NONE | if successful transformation |
| Error | code (see enum TransformSqlError definition) if failure |
Definition at line 549 of file statement_transform.cc.