/**
  * @param $sub
  * @return \CatLab\OpenIDClient\Models\User|null
  */
 public function getFromSubject($sub)
 {
     $query = new Query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t{$this->table_users}\n\t\t\tWHERE\n\t\t\t\tu_sub = ?\n\t\t");
     $query->bindValue(1, $sub);
     return $this->getSingle($query->execute());
 }
 /**
  * @param $username
  * @return \CatLab\Accounts\Models\User|null
  */
 public function getFromUsername($username)
 {
     $query = new Query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t{$this->table_users}\n\t\t\tWHERE\n\t\t\t\tu_username = ?\n\t\t");
     $query->bindValue(1, $username);
     return $this->getSingle($query->execute());
 }
 /**
  * @test
  */
 public function testStupidZeroBasedQuestionmarks()
 {
     // Insert
     $query = new Query("INSERT INTO `table` SET m_id = ?, m_test = ?, m_next = ?");
     $query->bindValue(0, 1);
     $query->bindValue(1, 'test string with a random :m_next parameter in it.');
     $query->bindValue(2, 'another parameter');
     $expected = "INSERT INTO `table` SET m_id = 1, m_test = 'test string with a random :m_next parameter in it.', m_next = 'another parameter'";
     $this->assertEquals($expected, $query->getParsedQuery());
 }