Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 157325 Details for
Bug 244736
varchar fields with empty string return NULL
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
PHP test case.
dbnulltest.php (text/plain), 1.16 KB, created by
Edward Rudd
on 2007-06-18 20:28:12 UTC
(
hide
)
Description:
PHP test case.
Filename:
MIME Type:
Creator:
Edward Rudd
Created:
2007-06-18 20:28:12 UTC
Size:
1.16 KB
patch
obsolete
><?php > >// $Id: null.php,v 1.1 2006/10/19 12:08:36 freddy77 Exp $ > >$server = 'myserver'; >$user = 'myuser'; >$pass = 'mypass'; > >$conn = mssql_connect($server,$user,$pass) or die("opps\n"); > >mssql_select_db('tempdb',$conn); > >mssql_query("CREATE TABLE #MyTable ( > myfield VARCHAR(10) NULL, > n INT >)", $conn) or die("error querying"); > > >mssql_query("INSERT INTO #MyTable VALUES('',1) >INSERT INTO #MyTable VALUES(NULL,2) >INSERT INTO #MyTable VALUES(' ',3) >INSERT INTO #MyTable VALUES('a',4)", $conn) or die("error querying"); > >$result = 0; > >function test($sql, $expected) >{ > global $conn, $result; > > $res = mssql_query($sql, $conn) or die("query"); > $row = mssql_fetch_assoc($res); > $s = $row['myfield']; > > if (is_null($s)) > $s = '(NULL)'; > else if ($s == '') > $s = '(Empty String)'; > else > $s = "'".str_replace("'", "''", $s)."'"; > echo "$sql -> $s\n"; > if ($s != $expected) > { > echo "error!\n"; > $result = 1; > } >} > >test("SELECT top 1 * FROM #MyTable WHERE n = 1", "(Empty String)"); > >test("SELECT top 1 * FROM #MyTable WHERE n = 2", "(NULL)"); > >test("SELECT top 1 * FROM #MyTable WHERE n = 3", "' '"); > >test("SELECT top 1 * FROM #MyTable WHERE n = 4", "'a'"); > >exit($result); >?> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 244736
:
157322
| 157325