cvs: pear /DB/tests/driver 18get.phpt
| From: | Daniel Convissor | Date: | Wed, 18 Feb 2004 02:03:50 +0000 |
| Subject: | cvs: pear /DB/tests/driver 18get.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-16634@lists.php.net to get a copy of this message | ||
danielc Tue Feb 17 21:03:50 2004 EDT
Modified files:
/pear/DB/tests/driver 18get.phpt
Log:
Do some testing of null and empty columns.
http://cvs.php.net/diff.php/pear/DB/tests/driver/18get.phpt?r1=1.1&r2=1.2&ty=u
Index: pear/DB/tests/driver/18get.phpt
diff -u pear/DB/tests/driver/18get.phpt:1.1 pear/DB/tests/driver/18get.phpt:1.2
--- pear/DB/tests/driver/18get.phpt:1.1 Fri Jan 30 21:35:16 2004
+++ pear/DB/tests/driver/18get.phpt Tue Feb 17 21:03:50 2004
@@ -10,7 +10,7 @@
* DB_Common::getListOf(), DB_Common::getOne(), DB_Common::getRow()
*
* @package DB
- * @version $Id: 18get.phpt,v 1.1 2004/01/31 02:35:16 danielc Exp $
+ * @version $Id: 18get.phpt,v 1.2 2004/02/18 02:03:50 danielc Exp $
* @category Database
* @author Daniel Convissor <danielc@analysisandsolutions.com>
* @internal
@@ -23,7 +23,7 @@
--FILE--
<?php
-// $Id: 18get.phpt,v 1.1 2004/01/31 02:35:16 danielc Exp $
+// $Id: 18get.phpt,v 1.2 2004/02/18 02:03:50 danielc Exp $
/**
* Connect to the database and make the <kbd>phptest</kbd> table.
@@ -231,6 +231,26 @@
print "\n===================================================\n";
+print 'testing getOne with null value in column: ';
+$dbh->query("INSERT INTO phptest VALUES (9, 'nine', '', NULL)");
+
+$ret =& $dbh->getOne('SELECT d FROM phptest WHERE a = 9');
+if ($ret === null) {
+ print "null\n";
+} else {
+ print 'type=' . gettype($ret) . ", value=$ret\n";
+}
+
+print 'testing getOne with empty string in column: ';
+$ret =& $dbh->getOne('SELECT c FROM phptest WHERE a = 9');
+if ($ret === '') {
+ print "empty string\n";
+} else {
+ print 'type=' . gettype($ret) . ", value=$ret\n";
+}
+
+
+print "\n===================================================\n";
$dbh->setErrorHandling(PEAR_ERROR_RETURN);
@@ -604,3 +624,7 @@
)
===================================================
+testing getOne with null value in column: null
+testing getOne with empty string in column: empty string
+
+===================================================