Ejemplo n.º 1
0
 /**
  * Returns true if line is definition of one of the indexes.
  *
  * @param string $line The line from CREATE STATEMENT.
  *
  * @return bool
  */
 public static function isIndexDef($line)
 {
     if (Str::startsWith($line, 'PRIMARY KEY')) {
         return true;
     }
     if (Str::startsWith($line, 'UNIQUE KEY')) {
         return true;
     }
     if (Str::startsWith($line, 'KEY')) {
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider startsWithProvider
  *
  * @covers ::startsWith
  *
  * @param string $str
  * @param string $needle
  * @param bool   $expected
  */
 public function test_startsWith($str, $needle, $expected)
 {
     // When
     $got = Str::startsWith($str, $needle);
     // Then
     $this->assertSame($expected, $got);
 }
Ejemplo n.º 3
0
 /**
  * Returns true if line is definition of one of the index constraints.
  *
  * @param string $line The line from CREATE STATEMENT.
  *
  * @return bool
  */
 public static function isConstraintDef($line)
 {
     if (Str::startsWith($line, 'CONSTRAINT')) {
         return true;
     }
     return false;
 }