1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2009 Sun Microsystems, Inc.
|
5 |
* Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
6 |
*
|
7 |
* Authors:
|
|
8 |
*
|
|
1308.2.7
by Jay Pipes
Add function to statement transform library which constructs INDEX clause |
9 |
* Jay Pipes <jaypipes@gmail.com>
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or modify
|
|
12 |
* it under the terms of the GNU General Public License as published by
|
|
13 |
* the Free Software Foundation; version 2 of the License.
|
|
14 |
*
|
|
15 |
* This program is distributed in the hope that it will be useful,
|
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 |
* GNU General Public License for more details.
|
|
19 |
*
|
|
20 |
* You should have received a copy of the GNU General Public License
|
|
21 |
* along with this program; if not, write to the Free Software
|
|
22 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
23 |
*/
|
|
24 |
||
25 |
/**
|
|
26 |
* @file
|
|
27 |
*
|
|
28 |
* Declarations of various routines that can be used to convert
|
|
29 |
* Transaction messages to other formats, including SQL statements.
|
|
30 |
*/
|
|
31 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
32 |
#pragma once
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
33 |
|
2252.1.21
by Olaf van der Spek
Common fwd |
34 |
#include <drizzled/common_fwd.h> |
35 |
#include <drizzled/common.h> |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
36 |
#include <drizzled/message/table.pb.h> |
37 |
#include <string> |
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
38 |
#include <vector> |
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
39 |
|
2252.1.21
by Olaf van der Spek
Common fwd |
40 |
namespace drizzled { |
41 |
namespace message { |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
42 |
|
43 |
/** A Variation of SQL to be output during transformation */
|
|
44 |
enum TransformSqlVariant |
|
45 |
{
|
|
46 |
ANSI, |
|
47 |
MYSQL_4, |
|
48 |
MYSQL_5, |
|
49 |
DRIZZLE
|
|
50 |
};
|
|
51 |
||
52 |
/** Error codes which can happen during tranformations */
|
|
53 |
enum TransformSqlError |
|
54 |
{
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
55 |
NONE= 0, |
56 |
MISSING_HEADER= 1, /* A data segment without a header segment was found */ |
|
2078.1.1
by David Shrewsbury
Push ALTER SCHEMA through replication stream as proper GPB message instead of RAW_SQL. |
57 |
MISSING_DATA= 2, /* A header segment without a data segment was found */ |
58 |
UUID_MISMATCH= 3 |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
59 |
};
|
60 |
||
61 |
/**
|
|
62 |
* This function looks at the Statement
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
63 |
* message and appends one or more correctly-formatted SQL
|
64 |
* strings to the supplied vector of strings.
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
65 |
*
|
66 |
* @param Statement message to transform
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
67 |
* @param Vector of strings to append SQL statements to
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
68 |
* @param Variation of SQL to generate
|
69 |
*
|
|
70 |
* @retval
|
|
71 |
* NONE if successful transformation
|
|
72 |
* @retval
|
|
73 |
* Error code (see enum TransformSqlError definition) if failure
|
|
74 |
*/
|
|
75 |
enum TransformSqlError |
|
76 |
transformStatementToSql(const Statement &source, |
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
77 |
std::vector<std::string> &sql_strings, |
1143.4.25
by Jay Pipes
Correctly puts START TRANSACTION; COMMIT; containers around group-related SQL statements in the transaction_reader and ensures that when a different type of Statement message is started in an existing Transaction message, that the active Statement message is finalized. |
78 |
enum TransformSqlVariant sql_variant= DRIZZLE, |
79 |
bool already_in_transaction= false); |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
80 |
|
81 |
/**
|
|
82 |
* This function looks at a supplied InsertHeader
|
|
83 |
* and InsertData message and constructs a correctly-formatted SQL
|
|
84 |
* statement to the supplied destination string.
|
|
85 |
*
|
|
86 |
* @note
|
|
87 |
*
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
88 |
* This function is used when you want to construct a <strong>
|
89 |
* single SQL statement</strong> from an entire InsertHeader and
|
|
90 |
* InsertData message. If there are many records in the InsertData
|
|
91 |
* message, the SQL statement will be a multi-value INSERT statement.
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
92 |
*
|
93 |
* @param InsertHeader message to transform
|
|
94 |
* @param InsertData message to transform
|
|
95 |
* @param Destination string to append SQL to
|
|
96 |
* @param Variation of SQL to generate
|
|
97 |
*
|
|
98 |
* @retval
|
|
99 |
* NONE if successful transformation
|
|
100 |
* @retval
|
|
101 |
* Error code (see enum TransformSqlError definition) if failure
|
|
102 |
*/
|
|
103 |
enum TransformSqlError |
|
104 |
transformInsertStatementToSql(const InsertHeader &header, |
|
105 |
const InsertData &data, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
106 |
std::string &destination, |
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
107 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
108 |
||
109 |
/**
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
110 |
* This function looks at a supplied InsertHeader
|
111 |
* and a single InsertRecord message and constructs a correctly-formatted
|
|
112 |
* SQL statement to the supplied destination string.
|
|
113 |
*
|
|
114 |
* @param InsertHeader message to transform
|
|
115 |
* @param InsertRecord message to transform
|
|
116 |
* @param Destination string to append SQL to
|
|
117 |
* @param Variation of SQL to generate
|
|
118 |
*
|
|
119 |
* @retval
|
|
120 |
* NONE if successful transformation
|
|
121 |
* @retval
|
|
122 |
* Error code (see enum TransformSqlError definition) if failure
|
|
123 |
*/
|
|
124 |
enum TransformSqlError |
|
125 |
transformInsertRecordToSql(const InsertHeader &header, |
|
126 |
const InsertRecord &record, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
127 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
128 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
129 |
||
130 |
/**
|
|
131 |
* Helper function to construct the header portion of an INSERT
|
|
132 |
* SQL statement from an InsertHeader message.
|
|
133 |
*
|
|
134 |
* @param InsertHeader message to transform
|
|
135 |
* @param Destination string to append SQL to
|
|
136 |
* @param Variation of SQL to generate
|
|
137 |
*
|
|
138 |
* @retval
|
|
139 |
* NONE if successful transformation
|
|
140 |
* @retval
|
|
141 |
* Error code (see enum TransformSqlError definition) if failure
|
|
142 |
*/
|
|
143 |
enum TransformSqlError |
|
144 |
transformInsertHeaderToSql(const InsertHeader &header, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
145 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
146 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
147 |
|
148 |
/**
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
149 |
* Helper function to construct the header portion of an UPDATE
|
150 |
* SQL statement from an UpdateHeader message.
|
|
151 |
*
|
|
152 |
* @param UpdateHeader message to transform
|
|
153 |
* @param Destination string to append SQL to
|
|
154 |
* @param Variation of SQL to generate
|
|
155 |
*
|
|
156 |
* @retval
|
|
157 |
* NONE if successful transformation
|
|
158 |
* @retval
|
|
159 |
* Error code (see enum TransformSqlError definition) if failure
|
|
160 |
*/
|
|
161 |
enum TransformSqlError |
|
162 |
transformUpdateHeaderToSql(const UpdateHeader &header, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
163 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
164 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
165 |
||
166 |
/**
|
|
167 |
* This function looks at a supplied UpdateHeader
|
|
168 |
* and a single UpdateRecord message and constructs a correctly-formatted
|
|
169 |
* SQL statement to the supplied destination string.
|
|
170 |
*
|
|
171 |
* @param UpdateHeader message to transform
|
|
172 |
* @param UpdateRecord message to transform
|
|
173 |
* @param Destination string to append SQL to
|
|
174 |
* @param Variation of SQL to generate
|
|
175 |
*
|
|
176 |
* @retval
|
|
177 |
* NONE if successful transformation
|
|
178 |
* @retval
|
|
179 |
* Error code (see enum TransformSqlError definition) if failure
|
|
180 |
*/
|
|
181 |
enum TransformSqlError |
|
182 |
transformUpdateRecordToSql(const UpdateHeader &header, |
|
183 |
const UpdateRecord &record, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
184 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
185 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
186 |
||
187 |
/**
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
188 |
* This function looks at a supplied DeleteHeader
|
189 |
* and DeleteData message and constructs a correctly-formatted SQL
|
|
190 |
* statement to the supplied destination string.
|
|
191 |
*
|
|
192 |
* @note
|
|
193 |
*
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
194 |
* This function constructs a <strong>single SQL statement</strong>
|
195 |
* for all keys in the DeleteData message.
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
196 |
*
|
197 |
* @param DeleteHeader message to transform
|
|
198 |
* @param DeleteData message to transform
|
|
199 |
* @param Destination string to append SQL to
|
|
200 |
* @param Variation of SQL to generate
|
|
201 |
*
|
|
202 |
* @retval
|
|
203 |
* NONE if successful transformation
|
|
204 |
* @retval
|
|
205 |
* Error code (see enum TransformSqlError definition) if failure
|
|
206 |
*/
|
|
207 |
enum TransformSqlError |
|
208 |
transformDeleteStatementToSql(const DeleteHeader &header, |
|
209 |
const DeleteData &data, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
210 |
std::string &destination, |
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
211 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
212 |
||
213 |
/**
|
|
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
214 |
* This function looks at a supplied DeleteHeader
|
215 |
* and a single DeleteRecord message and constructs a correctly-formatted
|
|
216 |
* SQL statement to the supplied destination string.
|
|
217 |
*
|
|
218 |
* @param DeleteHeader message to transform
|
|
219 |
* @param DeleteRecord message to transform
|
|
220 |
* @param Destination string to append SQL to
|
|
221 |
* @param Variation of SQL to generate
|
|
222 |
*
|
|
223 |
* @retval
|
|
224 |
* NONE if successful transformation
|
|
225 |
* @retval
|
|
226 |
* Error code (see enum TransformSqlError definition) if failure
|
|
227 |
*/
|
|
228 |
enum TransformSqlError |
|
229 |
transformDeleteRecordToSql(const DeleteHeader &header, |
|
230 |
const DeleteRecord &record, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
231 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
232 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
233 |
||
234 |
/**
|
|
235 |
* Helper function to construct the header portion of a DELETE
|
|
236 |
* SQL statement from an DeleteHeader message.
|
|
237 |
*
|
|
238 |
* @param DeleteHeader message to transform
|
|
239 |
* @param Destination string to append SQL to
|
|
240 |
* @param Variation of SQL to generate
|
|
241 |
*
|
|
242 |
* @retval
|
|
243 |
* NONE if successful transformation
|
|
244 |
* @retval
|
|
245 |
* Error code (see enum TransformSqlError definition) if failure
|
|
246 |
*/
|
|
247 |
enum TransformSqlError |
|
248 |
transformDeleteHeaderToSql(const DeleteHeader &header, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
249 |
std::string &destination, |
1143.2.7
by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement |
250 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
251 |
||
252 |
/**
|
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
253 |
* This function looks at a supplied DropTableStatement
|
254 |
* and constructs a correctly-formatted SQL
|
|
255 |
* statement to the supplied destination string.
|
|
256 |
*
|
|
257 |
* @param DropTableStatement message to transform
|
|
258 |
* @param Destination string to append SQL to
|
|
259 |
* @param Variation of SQL to generate
|
|
260 |
*
|
|
261 |
* @retval
|
|
262 |
* NONE if successful transformation
|
|
263 |
* @retval
|
|
264 |
* Error code (see enum TransformSqlError definition) if failure
|
|
265 |
*/
|
|
266 |
enum TransformSqlError |
|
267 |
transformDropTableStatementToSql(const DropTableStatement &statement, |
|
268 |
std::string &destination, |
|
269 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
270 |
||
271 |
/**
|
|
1143.4.6
by Jay Pipes
Adds test case to transaction log for TRUNCATE TABLE. |
272 |
* This function looks at a supplied TruncateTableStatement
|
273 |
* and constructs a correctly-formatted SQL
|
|
274 |
* statement to the supplied destination string.
|
|
275 |
*
|
|
276 |
* @param TruncateTableStatement message to transform
|
|
277 |
* @param Destination string to append SQL to
|
|
278 |
* @param Variation of SQL to generate
|
|
279 |
*
|
|
280 |
* @retval
|
|
281 |
* NONE if successful transformation
|
|
282 |
* @retval
|
|
283 |
* Error code (see enum TransformSqlError definition) if failure
|
|
284 |
*/
|
|
285 |
enum TransformSqlError |
|
286 |
transformTruncateTableStatementToSql(const TruncateTableStatement &statement, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
287 |
std::string &destination, |
1143.4.6
by Jay Pipes
Adds test case to transaction log for TRUNCATE TABLE. |
288 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
289 |
||
290 |
/**
|
|
1308.2.2
by Jay Pipes
Fixes transaction log/replication for multi-column primary keys. Changes CREATE SCHEMA to not use statement-base RAW_SQL and instead use a derived message::Statement subclass. |
291 |
* This function looks at a supplied CreateSchemaStatement
|
292 |
* and constructs a correctly-formatted SQL
|
|
293 |
* statement to the supplied destination string.
|
|
294 |
*
|
|
295 |
* @param CreateSchemaStatement message to transform
|
|
296 |
* @param Destination string to append SQL to
|
|
297 |
* @param Variation of SQL to generate
|
|
298 |
*
|
|
299 |
* @retval
|
|
300 |
* NONE if successful transformation
|
|
301 |
* @retval
|
|
302 |
* Error code (see enum TransformSqlError definition) if failure
|
|
303 |
*/
|
|
304 |
enum TransformSqlError |
|
305 |
transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
306 |
std::string &destination, |
1308.2.2
by Jay Pipes
Fixes transaction log/replication for multi-column primary keys. Changes CREATE SCHEMA to not use statement-base RAW_SQL and instead use a derived message::Statement subclass. |
307 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
308 |
|
1308.2.3
by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream. |
309 |
/**
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
310 |
* This function looks at a supplied DropSchemaStatement
|
1308.2.3
by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream. |
311 |
* and constructs a correctly-formatted SQL
|
312 |
* statement to the supplied destination string.
|
|
313 |
*
|
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
314 |
* @param DropSchemaStatement message to transform
|
1308.2.3
by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream. |
315 |
* @param Destination string to append SQL to
|
316 |
* @param Variation of SQL to generate
|
|
317 |
*
|
|
318 |
* @retval
|
|
319 |
* NONE if successful transformation
|
|
320 |
* @retval
|
|
321 |
* Error code (see enum TransformSqlError definition) if failure
|
|
322 |
*/
|
|
323 |
enum TransformSqlError |
|
324 |
transformDropSchemaStatementToSql(const DropSchemaStatement &statement, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
325 |
std::string &destination, |
1308.2.3
by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream. |
326 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
1308.2.2
by Jay Pipes
Fixes transaction log/replication for multi-column primary keys. Changes CREATE SCHEMA to not use statement-base RAW_SQL and instead use a derived message::Statement subclass. |
327 |
|
328 |
/**
|
|
2078.1.1
by David Shrewsbury
Push ALTER SCHEMA through replication stream as proper GPB message instead of RAW_SQL. |
329 |
* This function looks at a supplied AlterSchemaStatement
|
330 |
* and constructs a correctly-formatted SQL
|
|
331 |
* statement to the supplied destination string.
|
|
332 |
*
|
|
333 |
* @param AlterSchemaStatement message to transform
|
|
334 |
* @param Destination string to append SQL to
|
|
335 |
* @param Variation of SQL to generate
|
|
336 |
*
|
|
337 |
* @retval
|
|
338 |
* NONE if successful transformation
|
|
339 |
* @retval
|
|
340 |
* Error code (see enum TransformSqlError definition) if failure
|
|
341 |
*/
|
|
342 |
enum TransformSqlError |
|
343 |
transformAlterSchemaStatementToSql(const AlterSchemaStatement &statement, |
|
344 |
std::string &destination, |
|
345 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
346 |
||
347 |
/**
|
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
348 |
* This function looks at a supplied SetVariableStatement
|
349 |
* and constructs a correctly-formatted SQL
|
|
350 |
* statement to the supplied destination string.
|
|
351 |
*
|
|
352 |
* @param SetVariableStatement message to transform
|
|
353 |
* @param Destination string to append SQL to
|
|
354 |
* @param Variation of SQL to generate
|
|
355 |
*
|
|
356 |
* @retval
|
|
357 |
* NONE if successful transformation
|
|
358 |
* @retval
|
|
359 |
* Error code (see enum TransformSqlError definition) if failure
|
|
360 |
*/
|
|
361 |
enum TransformSqlError |
|
362 |
transformSetVariableStatementToSql(const SetVariableStatement &statement, |
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
363 |
std::string &destination, |
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
364 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
365 |
||
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
366 |
/**
|
1308.2.9
by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc |
367 |
* Appends to supplied string an SQL expression
|
368 |
* containing the supplied CreateTableStatement's
|
|
369 |
* appropriate CREATE TABLE SQL statement.
|
|
370 |
*/
|
|
371 |
enum TransformSqlError |
|
372 |
transformCreateTableStatementToSql(const CreateTableStatement &statement, |
|
373 |
std::string &destination, |
|
374 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
375 |
||
376 |
/**
|
|
377 |
* Appends to the supplied string an SQL expression
|
|
378 |
* representing the table for a CREATE TABLE expression.
|
|
379 |
*
|
|
380 |
* @param[in] Table message
|
|
381 |
* @param[out] String to append to
|
|
382 |
*
|
|
383 |
* @retval
|
|
384 |
* NONE if successful transformation
|
|
385 |
* @retval
|
|
386 |
* Error code (see enum TransformSqlError definition) if failure
|
|
387 |
*/
|
|
388 |
enum TransformSqlError |
|
389 |
transformTableDefinitionToSql(const Table &table, |
|
390 |
std::string &destination, |
|
1389
by Brian Aker
Large reord in ALTER TABLE for RENAME. |
391 |
enum TransformSqlVariant sql_variant= DRIZZLE, |
1469
by Brian Aker
Stored. |
392 |
bool with_schema= true); |
1308.2.9
by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc |
393 |
|
394 |
/**
|
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
395 |
* Appends to the supplied string an SQL expression
|
1308.2.8
by Jay Pipes
Adds method to statement_transform library to output CREATE TABLE options properly... |
396 |
* representing the table's optional attributes.
|
397 |
*
|
|
398 |
* @note
|
|
399 |
*
|
|
400 |
* This function will eventually be a much simpler
|
|
401 |
* listing of key/value pairs.
|
|
402 |
*
|
|
403 |
* @param[in] TableOptions message
|
|
404 |
* @param[out] String to append to
|
|
405 |
*
|
|
406 |
* @retval
|
|
407 |
* NONE if successful transformation
|
|
408 |
* @retval
|
|
409 |
* Error code (see enum TransformSqlError definition) if failure
|
|
410 |
*/
|
|
411 |
enum TransformSqlError |
|
412 |
transformTableOptionsToSql(const Table::TableOptions &table_options, |
|
413 |
std::string &destination, |
|
414 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
415 |
||
416 |
/**
|
|
417 |
* Appends to the supplied string an SQL expression
|
|
1308.2.7
by Jay Pipes
Add function to statement transform library which constructs INDEX clause |
418 |
* representing the index's attributes. The built string
|
419 |
* corresponds to the SQL in a CREATE INDEX statement.
|
|
420 |
*
|
|
421 |
* @param[in] Index message
|
|
422 |
* @param[in] Table containing this index (used to get field names...)
|
|
423 |
* @param[out] String to append to
|
|
424 |
*
|
|
425 |
* @retval
|
|
426 |
* NONE if successful transformation
|
|
427 |
* @retval
|
|
428 |
* Error code (see enum TransformSqlError definition) if failure
|
|
429 |
*/
|
|
430 |
enum TransformSqlError |
|
1308.2.9
by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc |
431 |
transformIndexDefinitionToSql(const Table::Index &index, |
432 |
const Table &table, |
|
433 |
std::string &destination, |
|
434 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
1308.2.7
by Jay Pipes
Add function to statement transform library which constructs INDEX clause |
435 |
|
436 |
/**
|
|
437 |
* Appends to the supplied string an SQL expression
|
|
1638.9.1
by Stewart Smith
Add FOREIGN KEY constraints to the table proto. set them, add code in statement_transform for them, which means we now get foreign keys in the transaction_log. We don't go changing any existing code manipulating foreign key data structures and instead just create our own (minimal changes FTW). |
438 |
* representing the foreign key attributes. The built string
|
439 |
* corresponds to the SQL in a CREATE TABLE statement.
|
|
440 |
*
|
|
441 |
* @param[in] Foreign Key Constraint message
|
|
442 |
* @param[in] Table containing this foregin key (used to get field names...)
|
|
443 |
* @param[out] String to append to
|
|
444 |
*
|
|
445 |
* @retval
|
|
446 |
* NONE if successful transformation
|
|
447 |
* @retval
|
|
448 |
* Error code (see enum TransformSqlError definition) if failure
|
|
449 |
*/
|
|
450 |
enum TransformSqlError |
|
451 |
transformForeignKeyConstraintDefinitionToSql(const Table::ForeignKeyConstraint &fkey, |
|
452 |
const Table &table, |
|
453 |
std::string &destination, |
|
454 |
enum TransformSqlVariant sql_variant = DRIZZLE); |
|
455 |
||
456 |
/**
|
|
457 |
* Appends to the supplied string an SQL expression
|
|
1308.2.4
by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream |
458 |
* representing the field's attributes. The built string
|
459 |
* corresponds to the SQL in a CREATE TABLE statement.
|
|
460 |
*
|
|
461 |
* @param[in] Field message
|
|
462 |
* @param[out] String to append to
|
|
463 |
*
|
|
464 |
* @retval
|
|
465 |
* NONE if successful transformation
|
|
466 |
* @retval
|
|
467 |
* Error code (see enum TransformSqlError definition) if failure
|
|
468 |
*/
|
|
469 |
enum TransformSqlError |
|
1308.2.9
by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc |
470 |
transformFieldDefinitionToSql(const Table::Field &field, |
471 |
std::string &destination, |
|
472 |
enum TransformSqlVariant sql_variant= DRIZZLE); |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
473 |
|
474 |
/**
|
|
475 |
* Returns true if the supplied message::Table::Field::FieldType
|
|
476 |
* should have its values quoted when modifying values.
|
|
477 |
*
|
|
478 |
* @param[in] type of field
|
|
479 |
*/
|
|
480 |
bool shouldQuoteFieldValue(Table::Field::FieldType in_type); |
|
481 |
||
1273.10.2
by Stewart Smith
de-duplicate internal field type to field proto field type code. Consolidate that in replication_services and table_proto_write and now just have it in statement_transform. |
482 |
drizzled::message::Table::Field::FieldType internalFieldTypeToFieldProtoType(enum enum_field_types type); |
483 |
||
1336.2.1
by Jay Pipes
Move transactionContainsBulkSegment() to statement transform library. |
484 |
/**
|
485 |
* Returns true if the transaction contains any Statement
|
|
486 |
* messages which are not end segments (i.e. a bulk statement has
|
|
487 |
* previously been sent to replicators).
|
|
488 |
*
|
|
489 |
* @param The transaction to check
|
|
490 |
*/
|
|
491 |
bool transactionContainsBulkSegment(const Transaction &transaction); |
|
492 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
493 |
} /* namespace message */ |
494 |
} /* namespace drizzled */ |
|
1143.2.4
by Jay Pipes
New transaction proto file containing message definitions to be |
495 |