ORAField.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use Wikimedia\Rdbms\Field;
  3. class ORAField implements Field {
  4. private $name, $tablename, $default, $max_length, $nullable,
  5. $is_pk, $is_unique, $is_multiple, $is_key, $type;
  6. function __construct( $info ) {
  7. $this->name = $info['column_name'];
  8. $this->tablename = $info['table_name'];
  9. $this->default = $info['data_default'];
  10. $this->max_length = $info['data_length'];
  11. $this->nullable = $info['not_null'];
  12. $this->is_pk = isset( $info['prim'] ) && $info['prim'] == 1 ? 1 : 0;
  13. $this->is_unique = isset( $info['uniq'] ) && $info['uniq'] == 1 ? 1 : 0;
  14. $this->is_multiple = isset( $info['nonuniq'] ) && $info['nonuniq'] == 1 ? 1 : 0;
  15. $this->is_key = ( $this->is_pk || $this->is_unique || $this->is_multiple );
  16. $this->type = $info['data_type'];
  17. }
  18. function name() {
  19. return $this->name;
  20. }
  21. function tableName() {
  22. return $this->tablename;
  23. }
  24. function defaultValue() {
  25. return $this->default;
  26. }
  27. function maxLength() {
  28. return $this->max_length;
  29. }
  30. function isNullable() {
  31. return $this->nullable;
  32. }
  33. function isKey() {
  34. return $this->is_key;
  35. }
  36. function isMultipleKey() {
  37. return $this->is_multiple;
  38. }
  39. function type() {
  40. return $this->type;
  41. }
  42. }