| 335 | } |
| 336 | |
| 337 | void ASTCreateQuery::formatQueryImpl(WriteBuffer & ostr, const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const |
| 338 | { |
| 339 | if (database && !table) |
| 340 | { |
| 341 | ostr |
| 342 | << (attach ? "ATTACH DATABASE " : "CREATE DATABASE ") |
| 343 | << (if_not_exists ? "IF NOT EXISTS " : ""); |
| 344 | |
| 345 | database->format(ostr, settings, state, frame); |
| 346 | |
| 347 | if (uuid != UUIDHelpers::Nil) |
| 348 | ostr << " UUID " << quoteString(toString(uuid)); |
| 349 | |
| 350 | formatOnCluster(ostr, settings); |
| 351 | |
| 352 | if (storage) |
| 353 | storage->format(ostr, settings, state, frame); |
| 354 | |
| 355 | if (table_overrides) |
| 356 | { |
| 357 | ostr << settings.nl_or_ws; |
| 358 | table_overrides->format(ostr, settings, state, frame); |
| 359 | } |
| 360 | |
| 361 | if (comment) |
| 362 | { |
| 363 | ostr << settings.nl_or_ws << "COMMENT "; |
| 364 | comment->format(ostr, settings, state, frame); |
| 365 | } |
| 366 | |
| 367 | return; |
| 368 | } |
| 369 | |
| 370 | if (!is_dictionary) |
| 371 | { |
| 372 | String action = "CREATE"; |
| 373 | if (attach) |
| 374 | action = "ATTACH"; |
| 375 | else if (replace_view) |
| 376 | action = "CREATE OR REPLACE"; |
| 377 | else if (replace_table && create_or_replace) |
| 378 | action = "CREATE OR REPLACE"; |
| 379 | else if (replace_table) |
| 380 | action = "REPLACE"; |
| 381 | |
| 382 | String what = "TABLE"; |
| 383 | if (is_ordinary_view) |
| 384 | what = "VIEW"; |
| 385 | else if (is_materialized_view) |
| 386 | what = "MATERIALIZED VIEW"; |
| 387 | else if (is_window_view) |
| 388 | what = "WINDOW VIEW"; |
| 389 | |
| 390 | ostr << action; |
| 391 | ostr << " "; |
| 392 | ostr << (isTemporary() ? "TEMPORARY " : "") |
| 393 | << what << " " |
| 394 | << (if_not_exists ? "IF NOT EXISTS " : "") |
nothing calls this directly
no test coverage detected