X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fgabordemooij%2Fredbean%2Ftesting%2FRedUNIT%2FSqlite%2FParambind.php;fp=vendor%2Fgabordemooij%2Fredbean%2Ftesting%2FRedUNIT%2FSqlite%2FParambind.php;h=b3013da2e30a28e8ab556610f4346af759efe3c7;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/gabordemooij/redbean/testing/RedUNIT/Sqlite/Parambind.php b/vendor/gabordemooij/redbean/testing/RedUNIT/Sqlite/Parambind.php new file mode 100644 index 000000000..b3013da2e --- /dev/null +++ b/vendor/gabordemooij/redbean/testing/RedUNIT/Sqlite/Parambind.php @@ -0,0 +1,60 @@ +getDatabaseAdapter(); + $writer = $toolbox->getWriter(); + $redbean = $toolbox->getRedBean(); + $pdo = $adapter->getDatabase(); + 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 ); + } +}