4 * @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
5 * Released under both BSD license and Lesser GPL library license.
6 * Whenever there is any discrepancy between the two licenses,
7 * the BSD license will take precedence.
9 * Set tabs to 4 for best viewing.
11 * Latest version is available at http://php.weblogs.com
13 * Test GetUpdateSQL and GetInsertSQL.
16 error_reporting(E_ALL
);
19 include('../adodb.inc.php');
20 include('../tohtml.inc.php');
22 //==========================
23 // This code tests an insert
27 $conn = &ADONewConnection("mssql"); // create a connection
28 $conn->Connect('localhost','sa','natsoft','northwind') or die('Fail');
31 $query = 'select * from products';
32 $conn->SetFetchMode(ADODB_FETCH_ASSOC
);
33 $rs = $conn->Execute($query);
36 $output[] = $rs->fields
;
37 var_dump($rs->fields
);
44 $p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)');
49 $conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
51 $p = $conn->Prepare('select * from products where productname like ?');
52 $arr = $conn->getarray($p,array('V%'));
56 //$conn = &ADONewConnection("mssql");
57 //$conn->Connect('mangrove','sa','natsoft','ai');
59 //$conn->Connect('mangrove','sa','natsoft','ai');
61 $conn->Execute('delete from blobtest');
63 $conn->Execute('insert into blobtest (id) values(1)');
64 $conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
65 $rs = $conn->Execute('select b1 from blobtest where id=1');
67 $output = "c:\\temp\\test_out-".date('H-i-s').".gif";
68 print "Saving file <b>$output</b>, size=".strlen($rs->fields
[0])."<p>";
69 $fd = fopen($output, "wb");
70 fwrite($fd, $rs->fields
[0]);
73 print " <a href=file://$output>View Image</a>";
74 //$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');