X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fgabordemooij%2Fredbean%2Ftesting%2FRedUNIT%2FMysql%2FParambind.php;fp=vendor%2Fgabordemooij%2Fredbean%2Ftesting%2FRedUNIT%2FMysql%2FParambind.php;h=0000000000000000000000000000000000000000;hp=bed92c7d6a462c923271ea7203cd06b86389bf4f;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Parambind.php b/vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Parambind.php deleted file mode 100644 index bed92c7d6..000000000 --- a/vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Parambind.php +++ /dev/null @@ -1,118 +0,0 @@ -getDatabaseAdapter(); - $writer = $toolbox->getWriter(); - $redbean = $toolbox->getRedBean(); - $pdo = $adapter->getDatabase(); - R::getDatabaseAdapter()->getDatabase()->setUseStringOnlyBinding( TRUE ); - try { - R::getAll( "select * from job limit ? ", array( 1 ) ); - fail(); - } catch (\Exception $e ) { - pass(); - } - try { - R::getAll( "select * from job limit :l ", array( ":l" => 1 ) ); - fail(); - } catch (\Exception $e ) { - pass(); - } - try { - R::exec( "select * from job limit ? ", array( 1 ) ); - fail(); - } catch (\Exception $e ) { - pass(); - } - try { - R::exec( "select * from job limit :l ", array( ":l" => 1 ) ); - fail(); - } catch (\Exception $e ) { - pass(); - } - R::getDatabaseAdapter()->getDatabase()->setUseStringOnlyBinding( FALSE ); - try { - R::getAll( "select * from job limit ? ", array( 1 ) ); - pass(); - } catch (\Exception $e ) { - fail(); - } - try { - R::getAll( "select * from job limit :l ", array( ":l" => 1 ) ); - pass(); - } catch (\Exception $e ) { - fail(); - } - try { - R::exec( "select * from job limit ? ", array( 1 ) ); - pass(); - } catch (\Exception $e ) { - fail(); - } - try { - R::exec( "select * from job limit :l ", array( ":l" => 1 ) ); - pass(); - } catch (\Exception $e ) { - fail(); - } - testpack( "Test findOrDispense" ); - $person = R::findOrDispense( "person", " job = ? ", array( "developer" ) ); - asrt( ( count( $person ) > 0 ), TRUE ); - $person = R::findOrDispense( "person", " job = ? ", array( "musician" ) ); - asrt( ( count( $person ) > 0 ), TRUE ); - $musician = array_pop( $person ); - asrt( intval( $musician->id ), 0 ); - try { - $adapter->exec( "an invalid query" ); - fail(); - } catch ( SQL $e ) { - pass(); - } - asrt( (int) $adapter->getCell( "SELECT 123" ), 123 ); - asrt( (int) $adapter->getCell( "SELECT ?", array( "987" ) ), 987 ); - asrt( (int) $adapter->getCell( "SELECT ?+?", array( "987", "2" ) ), 989 ); - asrt( (int) $adapter->getCell( "SELECT :numberOne+:numberTwo", array( - ":numberOne" => 42, ":numberTwo" => 50 ) ), 92 ); - $pair = $adapter->getAssoc( "SELECT 'thekey','thevalue' " ); - asrt( is_array( $pair ), TRUE ); - asrt( count( $pair ), 1 ); - asrt( isset( $pair["thekey"] ), TRUE ); - asrt( $pair["thekey"], "thevalue" ); - testpack( 'Test whether we can properly bind and receive NULL values' ); - asrt( $adapter->getCell( 'SELECT :nil ', array( ':nil' => 'NULL' ) ), 'NULL' ); - asrt( $adapter->getCell( 'SELECT :nil ', array( ':nil' => NULL ) ), NULL ); - asrt( $adapter->getCell( 'SELECT ? ', array( 'NULL' ) ), 'NULL' ); - asrt( $adapter->getCell( 'SELECT ? ', array( NULL ) ), NULL ); - } -}