source: Dev/trunk/rdfapi/util/adodb/tests/testmssql.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 2.1 KB
Line 
1<?php
2
3/**
4 * @version V4.50 6 July 2004 (c) 2000-2007 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.
8 *
9 * Set tabs to 4 for best viewing.
10 *
11 * Latest version is available at http://php.weblogs.com
12 *
13 * Test GetUpdateSQL and GetInsertSQL.
14 */
15 
16error_reporting(E_ALL);
17
18
19include('../adodb.inc.php');
20include('../tohtml.inc.php');
21
22//==========================
23// This code tests an insert
24
25
26
27$conn = &ADONewConnection("mssql");  // create a connection
28$conn->Connect('127.0.0.1','adodb','natsoft','northwind') or die('Fail');
29
30$conn->debug =1;
31$query = 'select * from products';
32$conn->SetFetchMode(ADODB_FETCH_ASSOC);
33$rs = $conn->Execute($query);
34echo "<pre>";
35while( !$rs->EOF ) {
36        $output[] = $rs->fields;
37        var_dump($rs->fields);
38        $rs->MoveNext();
39        print "<p>";
40}
41die();
42
43
44$p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)');
45echo "<pre>";
46print_r($p);
47
48$conn->debug=1;
49$conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
50
51$p = $conn->Prepare('select * from products where productname like ?');
52$arr = $conn->getarray($p,array('V%'));
53print_r($arr);
54die();
55
56//$conn = &ADONewConnection("mssql");
57//$conn->Connect('mangrove','sa','natsoft','ai');
58
59//$conn->Connect('mangrove','sa','natsoft','ai');
60$conn->debug=1;
61$conn->Execute('delete from blobtest');
62
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');
66
67$output = "c:\\temp\\test_out-".date('H-i-s').".gif";
68print "Saving file <b>$output</b>, size=".strlen($rs->fields[0])."<p>";
69$fd = fopen($output, "wb");
70fwrite($fd, $rs->fields[0]);
71fclose($fd);
72
73print " <a href=file://$output>View Image</a>";
74//$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');
75//rs2html($rs);
76?>
Note: See TracBrowser for help on using the repository browser.