Beispiel #1
0
 function testSingleWhereWithLikeWithFunction()
 {
     $pixelDb = new PixelDb();
     $pixelDb->select(['*'])->from(['users'])->where('password', 'avaga', 'SHA1', WhereExpression::OPERATOR_LIKE);
     $this->assertEquals('SELECT * FROM users WHERE password LIKE %SHA1(:p_password)%', $pixelDb->getSqlString());
     $pixelDb->getSqlBuffer()->clear();
     $pixelDb->select(['*'])->from(['users'])->where('password', 'avaga', 'SHA1', WhereExpression::OPERATOR_LIKE_STARTS);
     $this->assertEquals('SELECT * FROM users WHERE password LIKE %SHA1(:p_password)', $pixelDb->getSqlString());
     $pixelDb->getSqlBuffer()->clear();
     $pixelDb->select(['*'])->from(['users'])->where('password', 'avaga', 'SHA1', WhereExpression::OPERATOR_LIKE_ENDS);
     $this->assertEquals('SELECT * FROM users WHERE password LIKE SHA1(:p_password)%', $pixelDb->getSqlString());
 }
Beispiel #2
0
 function testSqlBufferProperty()
 {
     $db = new PixelDb();
     $this->assertNotNull($db->getSqlBuffer());
     $newBuffer = new StringBuffer();
     $newBuffer->append('SAMPLE BUFFER');
     $db->setSqlBuffer($newBuffer);
     $this->assertEquals('SAMPLE BUFFER', $db->getSqlString());
 }