コード例 #1
0
ファイル: GrantQueryTest.php プロジェクト: c9s/sqlbuilder
 public function testGrantToWithUserSpec()
 {
     $specOn = UserSpecification::createWithFormat(NULL, 'localuser@localhost');
     $specTo = UserSpecification::createWithFormat(NULL, 'externaluser@somehost');
     $q = new GrantQuery();
     $q->grant('PROXY')->on($specOn)->to($specTo);
     $this->assertSql('GRANT PROXY ON `localuser`@`localhost` TO `externaluser`@`somehost`', $q);
 }
コード例 #2
0
ファイル: UserSpecTrait.php プロジェクト: Ruyka/SQLBuilder
 public function user($spec = NULL)
 {
     $user = NULL;
     if (is_string($spec) && ($user = UserSpecification::createWithFormat($this, $spec))) {
         $this->userSpecifications[] = $user;
     } else {
         $this->userSpecifications[] = $user = new UserSpecification($this);
     }
     return $user;
 }
コード例 #3
0
ファイル: GrantQuery.php プロジェクト: Ruyka/SQLBuilder
 public function to($spec)
 {
     if ($spec instanceof UserSpecification) {
         $this->to[] = $spec;
     } elseif (strpos($spec, '@') !== false) {
         $user = UserSpecification::createWithFormat($this, $spec);
         $this->to[] = $user;
     } else {
         throw new InvalidArgumentException("Unsupported user specification: {$spec}");
     }
     return $this;
 }
コード例 #4
0
ファイル: SetPasswordQuery.php プロジェクト: Ruyka/SQLBuilder
 public function _for($userspec)
 {
     $this->for = UserSpecification::createWithFormat($this, $userspec);
     return $this;
 }
コード例 #5
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testCreateWithWrongFormat()
 {
     UserSpecification::createWithFormat(NULL, 'localuser_localhost');
 }