fixed typo in security checks for prescription access
[openemr.git] / library / adodb / tests / testmssql.php
blob6db4123c19443138269263f36c1eb64b0de74324
1 <?php
3 /**
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');
30 $conn->debug =1;
31 $query = 'select * from products';
32 $conn->SetFetchMode(ADODB_FETCH_ASSOC);
33 $rs = $conn->Execute($query);
34 echo "<pre>";
35 while( !$rs->EOF ) {
36 $output[] = $rs->fields;
37 var_dump($rs->fields);
38 $rs->MoveNext();
39 print "<p>";
41 die();
44 $p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)');
45 echo "<pre>";
46 print_r($p);
48 $conn->debug=1;
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%'));
53 print_r($arr);
54 die();
56 //$conn = &ADONewConnection("mssql");
57 //$conn->Connect('mangrove','sa','natsoft','ai');
59 //$conn->Connect('mangrove','sa','natsoft','ai');
60 $conn->debug=1;
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]);
71 fclose($fd);
73 print " <a href=file://$output>View Image</a>";
74 //$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');
75 //rs2html($rs);