You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db\oci;
  8. use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
  9. /**
  10. * ColumnSchemaBuilder is the schema builder for Oracle databases.
  11. *
  12. * @author Vasenin Matvey <vaseninm@gmail.com>
  13. * @author Chris Harris <chris@buckshotsoftware.com>
  14. * @since 2.0.6
  15. */
  16. class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
  17. {
  18. /**
  19. * @inheritdoc
  20. */
  21. protected function buildUnsignedString()
  22. {
  23. return $this->isUnsigned ? ' UNSIGNED' : '';
  24. }
  25. /**
  26. * @inheritdoc
  27. */
  28. protected function buildAfterString()
  29. {
  30. return $this->after !== null ?
  31. ' AFTER ' . $this->db->quoteColumnName($this->after) :
  32. '';
  33. }
  34. /**
  35. * @inheritdoc
  36. */
  37. protected function buildFirstString()
  38. {
  39. return $this->isFirst ? ' FIRST' : '';
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function __toString()
  45. {
  46. switch ($this->getTypeCategory()) {
  47. case self::CATEGORY_PK:
  48. $format = '{type}{length}{check}{pos}{append}';
  49. break;
  50. case self::CATEGORY_NUMERIC:
  51. $format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{append}';
  52. break;
  53. default:
  54. $format = '{type}{length}{default}{notnull}{check}{pos}{append}';
  55. }
  56. return $this->buildCompleteString($format);
  57. }
  58. }