~drizzle-trunk/drizzle/development

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
 *
4
 *  Copyright (C) 2009 Sun Microsystems
1308.2.7 by Jay Pipes
Add function to statement transform library which constructs INDEX clause
5
 *  Copyright (c) 2010 Jay Pipes <jayjpipes@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
32
#ifndef DRIZZLED_MESSAGE_STATEMENT_TRANSFORM_H
33
#define DRIZZLED_MESSAGE_STATEMENT_TRANSFORM_H
34
35
#include <drizzled/message/table.pb.h>
36
#include <string>
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
37
#include <vector>
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
38
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.
39
#include "drizzled/common.h"
40
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
41
namespace drizzled
42
{
43
namespace message
44
{
45
/* some forward declarations */
1336.2.1 by Jay Pipes
Move transactionContainsBulkSegment() to statement transform library.
46
class Transaction;
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
47
class Statement;
48
class InsertHeader;
49
class InsertData;
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
50
class InsertRecord;
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
51
class UpdateHeader;
52
class UpdateData;
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
53
class UpdateRecord;
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
54
class DeleteHeader;
55
class DeleteData;
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
56
class DeleteRecord;
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
57
class DropTableStatement;
1308.2.9 by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc
58
class CreateTableStatement;
1143.4.6 by Jay Pipes
Adds test case to transaction log for TRUNCATE TABLE.
59
class TruncateTableStatement;
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.
60
class CreateSchemaStatement;
1308.2.3 by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream.
61
class DropSchemaStatement;
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
62
class SetVariableStatement;
63
64
/** A Variation of SQL to be output during transformation */
65
enum TransformSqlVariant
66
{
67
  ANSI,
68
  MYSQL_4,
69
  MYSQL_5,
70
  DRIZZLE
71
};
72
73
/** Error codes which can happen during tranformations */
74
enum TransformSqlError
75
{
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
76
  NONE= 0,
77
  MISSING_HEADER= 1, /* A data segment without a header segment was found */
78
  MISSING_DATA= 2 /* A header segment without a data segment was found */
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
79
};
80
81
/**
82
 * This function looks at the Statement
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
83
 * message and appends one or more correctly-formatted SQL
84
 * strings to the supplied vector of strings.
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
85
 *
86
 * @param Statement message to transform
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
87
 * @param Vector of strings to append SQL statements to
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
88
 * @param Variation of SQL to generate
89
 *
90
 * @retval
91
 *  NONE if successful transformation
92
 * @retval
93
 *  Error code (see enum TransformSqlError definition) if failure
94
 */
95
enum TransformSqlError
96
transformStatementToSql(const Statement &source,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
97
                        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.
98
                        enum TransformSqlVariant sql_variant= DRIZZLE,
99
                        bool already_in_transaction= false);
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
100
101
/**
102
 * This function looks at a supplied InsertHeader
103
 * and InsertData message and constructs a correctly-formatted SQL
104
 * statement to the supplied destination string.
105
 *
106
 * @note
107
 *
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
108
 * This function is used when you want to construct a <strong>
109
 * single SQL statement</strong> from an entire InsertHeader and
110
 * InsertData message.  If there are many records in the InsertData
111
 * 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
112
 *
113
 * @param InsertHeader message to transform
114
 * @param InsertData message to transform
115
 * @param Destination string to append SQL to
116
 * @param Variation of SQL to generate
117
 *
118
 * @retval
119
 *  NONE if successful transformation
120
 * @retval
121
 *  Error code (see enum TransformSqlError definition) if failure
122
 */
123
enum TransformSqlError
124
transformInsertStatementToSql(const InsertHeader &header,
125
                              const InsertData &data,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
126
                              std::string &destination,
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
127
                              enum TransformSqlVariant sql_variant= DRIZZLE);
128
129
/**
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
130
 * This function looks at a supplied InsertHeader
131
 * and a single InsertRecord message and constructs a correctly-formatted
132
 * SQL statement to the supplied destination string.
133
 *
134
 * @param InsertHeader message to transform
135
 * @param InsertRecord message to transform
136
 * @param Destination string to append SQL to
137
 * @param Variation of SQL to generate
138
 *
139
 * @retval
140
 *  NONE if successful transformation
141
 * @retval
142
 *  Error code (see enum TransformSqlError definition) if failure
143
 */
144
enum TransformSqlError
145
transformInsertRecordToSql(const InsertHeader &header,
146
                           const InsertRecord &record,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
147
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
148
                           enum TransformSqlVariant sql_variant= DRIZZLE);
149
150
/**
151
 * Helper function to construct the header portion of an INSERT
152
 * SQL statement from an InsertHeader message.
153
 *
154
 * @param InsertHeader message to transform
155
 * @param Destination string to append SQL to
156
 * @param Variation of SQL to generate
157
 *
158
 * @retval
159
 *  NONE if successful transformation
160
 * @retval
161
 *  Error code (see enum TransformSqlError definition) if failure
162
 */
163
enum TransformSqlError
164
transformInsertHeaderToSql(const InsertHeader &header,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
165
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
166
                           enum TransformSqlVariant sql_variant= DRIZZLE);
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
167
168
/**
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
169
 * Helper function to construct the header portion of an UPDATE
170
 * SQL statement from an UpdateHeader message.
171
 *
172
 * @param UpdateHeader 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
transformUpdateHeaderToSql(const UpdateHeader &header,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
183
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
184
                           enum TransformSqlVariant sql_variant= DRIZZLE);
185
186
/**
187
 * This function looks at a supplied UpdateHeader
188
 * and a single UpdateRecord message and constructs a correctly-formatted
189
 * SQL statement to the supplied destination string.
190
 *
191
 * @param UpdateHeader message to transform
192
 * @param UpdateRecord message to transform
193
 * @param Destination string to append SQL to
194
 * @param Variation of SQL to generate
195
 *
196
 * @retval
197
 *  NONE if successful transformation
198
 * @retval
199
 *  Error code (see enum TransformSqlError definition) if failure
200
 */
201
enum TransformSqlError
202
transformUpdateRecordToSql(const UpdateHeader &header,
203
                           const UpdateRecord &record,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
204
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
205
                           enum TransformSqlVariant sql_variant= DRIZZLE);
206
207
/**
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
208
 * This function looks at a supplied DeleteHeader
209
 * and DeleteData message and constructs a correctly-formatted SQL
210
 * statement to the supplied destination string.
211
 *
212
 * @note
213
 *
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
214
 * This function constructs a <strong>single SQL statement</strong>
215
 * for all keys in the DeleteData message.
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
216
 *
217
 * @param DeleteHeader message to transform
218
 * @param DeleteData message to transform
219
 * @param Destination string to append SQL to
220
 * @param Variation of SQL to generate
221
 *
222
 * @retval
223
 *  NONE if successful transformation
224
 * @retval
225
 *  Error code (see enum TransformSqlError definition) if failure
226
 */
227
enum TransformSqlError
228
transformDeleteStatementToSql(const DeleteHeader &header,
229
                              const DeleteData &data,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
230
                              std::string &destination,
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
231
                              enum TransformSqlVariant sql_variant= DRIZZLE);
232
233
/**
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
234
 * This function looks at a supplied DeleteHeader
235
 * and a single DeleteRecord message and constructs a correctly-formatted
236
 * SQL statement to the supplied destination string.
237
 *
238
 * @param DeleteHeader message to transform
239
 * @param DeleteRecord message to transform
240
 * @param Destination string to append SQL to
241
 * @param Variation of SQL to generate
242
 *
243
 * @retval
244
 *  NONE if successful transformation
245
 * @retval
246
 *  Error code (see enum TransformSqlError definition) if failure
247
 */
248
enum TransformSqlError
249
transformDeleteRecordToSql(const DeleteHeader &header,
250
                           const DeleteRecord &record,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
251
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
252
                           enum TransformSqlVariant sql_variant= DRIZZLE);
253
254
/**
255
 * Helper function to construct the header portion of a DELETE
256
 * SQL statement from an DeleteHeader message.
257
 *
258
 * @param DeleteHeader message to transform
259
 * @param Destination string to append SQL to
260
 * @param Variation of SQL to generate
261
 *
262
 * @retval
263
 *  NONE if successful transformation
264
 * @retval
265
 *  Error code (see enum TransformSqlError definition) if failure
266
 */
267
enum TransformSqlError
268
transformDeleteHeaderToSql(const DeleteHeader &header,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
269
                           std::string &destination,
1143.2.7 by Jay Pipes
Based on IRC discussions with Brian, this patch reworks the Statement
270
                           enum TransformSqlVariant sql_variant= DRIZZLE);
271
272
/**
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
273
 * This function looks at a supplied DropTableStatement
274
 * and constructs a correctly-formatted SQL
275
 * statement to the supplied destination string.
276
 *
277
 * @param DropTableStatement message to transform
278
 * @param Destination string to append SQL to
279
 * @param Variation of SQL to generate
280
 *
281
 * @retval
282
 *  NONE if successful transformation
283
 * @retval
284
 *  Error code (see enum TransformSqlError definition) if failure
285
 */
286
enum TransformSqlError
287
transformDropTableStatementToSql(const DropTableStatement &statement,
288
                                  std::string &destination,
289
                                  enum TransformSqlVariant sql_variant= DRIZZLE);
290
291
/**
1143.4.6 by Jay Pipes
Adds test case to transaction log for TRUNCATE TABLE.
292
 * This function looks at a supplied TruncateTableStatement
293
 * and constructs a correctly-formatted SQL
294
 * statement to the supplied destination string.
295
 *
296
 * @param TruncateTableStatement message to transform
297
 * @param Destination string to append SQL to
298
 * @param Variation of SQL to generate
299
 *
300
 * @retval
301
 *  NONE if successful transformation
302
 * @retval
303
 *  Error code (see enum TransformSqlError definition) if failure
304
 */
305
enum TransformSqlError
306
transformTruncateTableStatementToSql(const TruncateTableStatement &statement,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
307
                                     std::string &destination,
1143.4.6 by Jay Pipes
Adds test case to transaction log for TRUNCATE TABLE.
308
                                     enum TransformSqlVariant sql_variant= DRIZZLE);
309
310
/**
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.
311
 * This function looks at a supplied CreateSchemaStatement
312
 * and constructs a correctly-formatted SQL
313
 * statement to the supplied destination string.
314
 *
315
 * @param CreateSchemaStatement message to transform
316
 * @param Destination string to append SQL to
317
 * @param Variation of SQL to generate
318
 *
319
 * @retval
320
 *  NONE if successful transformation
321
 * @retval
322
 *  Error code (see enum TransformSqlError definition) if failure
323
 */
324
enum TransformSqlError
325
transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
326
                                    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.
327
                                    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
328
1308.2.3 by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream.
329
/**
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
330
 * 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.
331
 * and constructs a correctly-formatted SQL
332
 * statement to the supplied destination string.
333
 *
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
334
 * @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.
335
 * @param Destination string to append SQL to
336
 * @param Variation of SQL to generate
337
 *
338
 * @retval
339
 *  NONE if successful transformation
340
 * @retval
341
 *  Error code (see enum TransformSqlError definition) if failure
342
 */
343
enum TransformSqlError
344
transformDropSchemaStatementToSql(const DropSchemaStatement &statement,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
345
                                  std::string &destination,
1308.2.3 by Jay Pipes
Adds DROP SCHEMA to the list of non RAW_SQL statements in replication stream.
346
                                  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.
347
348
/**
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
349
 * This function looks at a supplied SetVariableStatement
350
 * and constructs a correctly-formatted SQL
351
 * statement to the supplied destination string.
352
 *
353
 * @param SetVariableStatement message to transform
354
 * @param Destination string to append SQL to
355
 * @param Variation of SQL to generate
356
 *
357
 * @retval
358
 *  NONE if successful transformation
359
 * @retval
360
 *  Error code (see enum TransformSqlError definition) if failure
361
 */
362
enum TransformSqlError
363
transformSetVariableStatementToSql(const SetVariableStatement &statement,
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
364
                                   std::string &destination,
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
365
                                   enum TransformSqlVariant sql_variant= DRIZZLE);
366
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
367
/**
1308.2.9 by Jay Pipes
Adds CREATE TABLE work to the statement tranform library. Removes it from /drizzle/message/table_reader.cc
368
 * Appends to supplied string an SQL expression
369
 * containing the supplied CreateTableStatement's
370
 * appropriate CREATE TABLE SQL statement.
371
 */
372
enum TransformSqlError
373
transformCreateTableStatementToSql(const CreateTableStatement &statement,
374
                                   std::string &destination,
375
                                   enum TransformSqlVariant sql_variant= DRIZZLE);
376
377
/**
378
 * Appends to the supplied string an SQL expression
379
 * representing the table for a CREATE TABLE expression.
380
 *
381
 * @param[in]   Table message
382
 * @param[out]  String to append to
383
 *
384
 * @retval
385
 *  NONE if successful transformation
386
 * @retval
387
 *  Error code (see enum TransformSqlError definition) if failure
388
 */
389
enum TransformSqlError
390
transformTableDefinitionToSql(const Table &table,
391
                              std::string &destination,
1389 by Brian Aker
Large reord in ALTER TABLE for RENAME.
392
                              enum TransformSqlVariant sql_variant= DRIZZLE,
1469 by Brian Aker
Stored.
393
                              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
394
395
/**
1308.2.4 by Jay Pipes
Adds DROP TABLE to the list of non RAW_SQL statements in replication stream
396
 * 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...
397
 * representing the table's optional attributes.
398
 *
399
 * @note
400
 *
401
 * This function will eventually be a much simpler
402
 * listing of key/value pairs.
403
 *
404
 * @param[in]   TableOptions message
405
 * @param[out]  String to append to
406
 *
407
 * @retval
408
 *  NONE if successful transformation
409
 * @retval
410
 *  Error code (see enum TransformSqlError definition) if failure
411
 */
412
enum TransformSqlError
413
transformTableOptionsToSql(const Table::TableOptions &table_options,
414
                           std::string &destination,
415
                           enum TransformSqlVariant sql_variant= DRIZZLE);
416
417
/**
418
 * Appends to the supplied string an SQL expression
1308.2.7 by Jay Pipes
Add function to statement transform library which constructs INDEX clause
419
 * representing the index's attributes.  The built string
420
 * corresponds to the SQL in a CREATE INDEX statement.
421
 *
422
 * @param[in]   Index message
423
 * @param[in]   Table containing this index (used to get field names...)
424
 * @param[out]  String to append to
425
 *
426
 * @retval
427
 *  NONE if successful transformation
428
 * @retval
429
 *  Error code (see enum TransformSqlError definition) if failure
430
 */
431
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
432
transformIndexDefinitionToSql(const Table::Index &index,
433
                              const Table &table,
434
                              std::string &destination,
435
                              enum TransformSqlVariant sql_variant= DRIZZLE);
1308.2.7 by Jay Pipes
Add function to statement transform library which constructs INDEX clause
436
437
/**
438
 * 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).
439
 * representing the foreign key attributes.  The built string
440
 * corresponds to the SQL in a CREATE TABLE statement.
441
 *
442
 * @param[in]   Foreign Key Constraint message
443
 * @param[in]   Table containing this foregin key (used to get field names...)
444
 * @param[out]  String to append to
445
 *
446
 * @retval
447
 *  NONE if successful transformation
448
 * @retval
449
 *  Error code (see enum TransformSqlError definition) if failure
450
 */
451
enum TransformSqlError
452
transformForeignKeyConstraintDefinitionToSql(const Table::ForeignKeyConstraint &fkey,
453
                                             const Table &table,
454
                                             std::string &destination,
455
                                             enum TransformSqlVariant sql_variant = DRIZZLE);
456
457
/**
458
 * 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
459
 * representing the field's attributes.  The built string
460
 * corresponds to the SQL in a CREATE TABLE statement.
461
 *
462
 * @param[in]   Field message
463
 * @param[out]  String to append to
464
 *
465
 * @retval
466
 *  NONE if successful transformation
467
 * @retval
468
 *  Error code (see enum TransformSqlError definition) if failure
469
 */
470
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
471
transformFieldDefinitionToSql(const Table::Field &field,
472
                              std::string &destination,
473
                              enum TransformSqlVariant sql_variant= DRIZZLE);
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
474
475
/**
476
 * Returns true if the supplied message::Table::Field::FieldType
477
 * should have its values quoted when modifying values.
478
 *
479
 * @param[in] type of field
480
 */
481
bool shouldQuoteFieldValue(Table::Field::FieldType in_type);
482
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.
483
drizzled::message::Table::Field::FieldType internalFieldTypeToFieldProtoType(enum enum_field_types type);
484
1336.2.1 by Jay Pipes
Move transactionContainsBulkSegment() to statement transform library.
485
/**
486
 * Returns true if the transaction contains any Statement
487
 * messages which are not end segments (i.e. a bulk statement has
488
 * previously been sent to replicators).
489
 *
490
 * @param The transaction to check
491
 */
492
bool transactionContainsBulkSegment(const Transaction &transaction);
493
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
494
} /* namespace message */
495
} /* namespace drizzled */
1143.2.4 by Jay Pipes
New transaction proto file containing message definitions to be
496
497
#endif /* DRIZZLED_MESSAGE_STATEMENT_TRANSFORM_H */