From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- vendor/adodb/adodb-php/tests/test-pgblob.php | 86 ++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 vendor/adodb/adodb-php/tests/test-pgblob.php (limited to 'vendor/adodb/adodb-php/tests/test-pgblob.php') diff --git a/vendor/adodb/adodb-php/tests/test-pgblob.php b/vendor/adodb/adodb-php/tests/test-pgblob.php new file mode 100644 index 0000000..3add99e --- /dev/null +++ b/vendor/adodb/adodb-php/tests/test-pgblob.php @@ -0,0 +1,86 @@ +Param(false); + $x = (rand() % 10) + 1; + $db->debug= ($i==1); + $id = $db->GetOne($sql, + array('Z%','Z%',$x)); + if($id != $offset+$x) { + print "

Error at $x"; + break; + } + } +} + +include_once('../adodb.inc.php'); +$db = NewADOConnection('postgres7'); +$db->PConnect('localhost','tester','test','test') || die("failed connection"); + +$enc = "GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D"; +$val = rawurldecode($enc); + +$MAX = 1000; + +adodb_pr($db->ServerInfo()); + +echo "

Testing PREPARE/EXECUTE PLAN

"; + + +$db->_bindInputArray = true; // requires postgresql 7.3+ and ability to modify database +$t = getmicrotime(); +doloop(); +echo '

',$MAX,' times, with plan=',getmicrotime() - $t,'

'; + + +$db->_bindInputArray = false; +$t = getmicrotime(); +doloop(); +echo '

',$MAX,' times, no plan=',getmicrotime() - $t,'

'; + + + +echo "

Testing UPDATEBLOB

"; +$db->debug=1; + +### TEST BEGINS + +$db->Execute("insert into photos (id,name) values(9999,'dot.gif')"); +$db->UpdateBlob('photos','photo',$val,'id=9999'); +$v = $db->GetOne('select photo from photos where id=9999'); + + +### CLEANUP + +$db->Execute("delete from photos where id=9999"); + +### VALIDATION + +if ($v !== $val) echo "*** ERROR: Inserted value does not match downloaded val"; +else echo "*** OK: Passed"; + +echo "
";
+echo "INSERTED: ", $enc;
+echo "
"; +echo"RETURNED: ", rawurlencode($v); +echo "

"; +echo "INSERTED: ", $val; +echo "


"; +echo "RETURNED: ", $v; -- cgit v1.2.3-70-g09d2