"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/adodb/adodb/tests/testmssql.php Source File", "datetime" => "Sat Dec 2 19:22:27 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 00016 error_reporting(E_ALL); 00017 00018 00019 include('../adodb.inc.php'); 00020 include('../tohtml.inc.php'); 00021 00022 //========================== 00023 // This code tests an insert 00024 00025 00026 00027 $conn = &ADONewConnection("mssql"); // create a connection 00028 $conn->Connect('127.0.0.1','adodb','natsoft','northwind') or die('Fail'); 00029 00030 $conn->debug =1; 00031 $query = 'select * from products'; 00032 $conn->SetFetchMode(ADODB_FETCH_ASSOC); 00033 $rs = $conn->Execute($query); 00034 echo "<pre>"; 00035 while( !$rs->EOF ) { 00036 $output[] = $rs->fields; 00037 var_dump($rs->fields); 00038 $rs->MoveNext(); 00039 print "<p>"; 00040 } 00041 die(); 00042 00043 00044 $p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)'); 00045 echo "<pre>"; 00046 print_r($p); 00047 00048 $conn->debug=1; 00049 $conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time()))); 00050 00051 $p = $conn->Prepare('select * from products where productname like ?'); 00052 $arr = $conn->getarray($p,array('V%')); 00053 print_r($arr); 00054 die(); 00055 00056 //$conn = &ADONewConnection("mssql"); 00057 //$conn->Connect('mangrove','sa','natsoft','ai'); 00058 00059 //$conn->Connect('mangrove','sa','natsoft','ai'); 00060 $conn->debug=1; 00061 $conn->Execute('delete from blobtest'); 00062 00063 $conn->Execute('insert into blobtest (id) values(1)'); 00064 $conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1'); 00065 $rs = $conn->Execute('select b1 from blobtest where id=1'); 00066 00067 $output = "c:\\temp\\test_out-".date('H-i-s').".gif"; 00068 print "Saving file <b>$output</b>, size=".strlen($rs->fields[0])."<p>"; 00069 $fd = fopen($output, "wb"); 00070 fwrite($fd, $rs->fields[0]); 00071 fclose($fd); 00072 00073 print " <a href=file://$output>View Image</a>"; 00074 //$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest'); 00075 //rs2html($rs); 00076 ?>