null

passing a null value to mysql database

A user fills out a form and if they choose to not fill out a field that is not required php does this: if($_SESSION['numofchildren']=="") $_SESSION['numofchildren']=null; But when I use the session variable in a mysql query, the result is not null, but is 0. The column is a tinyint(4) that allows NULL. Why am I getting...

What is the difference between NULL, '\0' and 0

In C, there appear to be differences between various values of zero -- NULL, NUL and 0. I know that the ASCII character '0' evaluates to 48 or 0x30. The NULL pointer is usually defined as: #define NULL 0l In addition, there is the NUL character '\0' which seems to evaluate to 0 as well. Are there times when these three values can n...

Handling empty set in MySQL CASE statement

MySQL server version 5.0.45. Consider the following: ( SELECT CASE WHEN t.group_id = 12 THEN 'yes' ELSE 'no' END FROM sample_table t WHERE t.user_id = 2 AND t.group_id = 12 ) as foo This subquery of a larger statement works as I'd expect, yielding a 'yes' or 'no' string value most of the time. It's not ideal...

IFNULL in NHibernate

Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that generates SQL like: property LIKE '%value%' which is fine for that case. In another case, I want the SQL: IFNULL(property LIKE '%value%', 0) but I don't see any example in the manual that refers to IFNULL, nor can I...

GQL test for null IntegerProperty

I'm trying to query records in Google App engine where an IntegerProperty is null (None). This is what I tried without success: data = db.GqlQuery("SELECT * FROM MyModel WHERE intProp=:1",None) And also with a Query: query = db.Query(MyModel) query = query.filter('intProp', None) data = query.fetch(limit=100) Any help would be app...

getClass().getClassLoader().getResourceAsStream is throwing a NullPointerException

In Java How could getClass().getClassLoader() return null? The jar the 'class' is located in is NOT located under common/lib. The jar is NOT being boostrap-loaded. The ClassLoader for all classes within the jar is null. ...

System.Nullable<T> What is the value of null * int value?

Consider the following statements: int? v1 = null; int? v2 = 5 * v1; What is the value of v2? (null or empty string?) How can I prevent the compiler to mark it as invalid operation? Do I need to follow custom exception handling? ...

SQL how to find non null column?

I have a table with lots of columns, say I have columns A, B, C, D in each of these columns, only one column in any one record will be filled and the others will always be NULL. I need a select statement that will return the Column of the non null Column. I've tried coalesce, but this return a value, not the column to which the ...

Ext.util.Format.undef functionality for null values

I have a json property that might be null, and I'd prefer to keep it that way for other reasons. When I include that property in an Ext.Template with '{myProp}' it sometimes renders as the word "null" when I want it to render as an empty string. {myProp:undef} only hunts for undefined, not null. What's the best way to get this done gi...

Check if input is blank when input is declared as double [C++]

I have three variable declared as doubles: double Delay1 = 0; double Delay2 = 0; double Delay3 = 0; I Then get their values from the user: cout << "Please Enter Propogation Delay for Satellite #1:"; cin >> Delay1; ... But when I check these values to see if they are null (user just hit enter and did not put a number) it doesn't w...

Jquery toggle function breaks on pages that include mootools or slimbox script.

My friend is asked me to look over her site where there is an error on pages that use slimbox-- an unrelated Jquery toggle function breaks— here's the code: $(function() { $(".cat_nav dd").hide(); $(".cat_nav dt").click(function() { $(this).next().toggle(); return false; }); }); This code works fine when slimbox ...

SQL QUERY replace NULL value in a row with a value from the previous known value

I have 2 columns date number ---- ------ 1 3 2 NULL 3 5 4 NULL 5 NULL 6 2 ....... I need to replace the NULL values with new values takes on the value from the last known value in the previous date in the date column eg: date=2 number = 3,...

Nhibernate many-to-one Composite key - if null then fails? is many-to-one or none possible?

Hi Have the mapping as shown below. this is from a leagcy db so have no control over changing the structure. The File record in some circumstances will not have a link to the DISPLAY3 table. Every file has a link to the DISPLAY2 table. However if the File.DISPLAy3 field is null then is does not have a link to the DISPLAY3 only the DISPL...

Easy MySQL question: query with a null value

What am I doing wrong with this query? (Friday afternoon brain freeze...) In WordPress, I used a MySQL query to make an empty custom field called "description" in all posts of a test database, and now I want to add the value "test" to that field. (This is all in the process of teaching myself how to write more complex queries.) But I c...

How to handle null for a allow-null datetime field (DB) in our program?

How could we handle null for a datetime field (got from SQL Server) in our program in c#? ...

0x00 in a binary file VB.NET

UPDATED BELOW I am reading a Binary file using BinaryReader in VB.NET. The structure of each row in the file is: "Category" = 1 byte "Code" = 1 byte "Text" = 60 Bytes Dim Category As Byte Dim Code As Byte Dim byText() As Byte Dim chText() As Char Dim br As New BinaryReader(fs) Category = br.ReadByt...

MySQL Changing from Null to Non Null

I have got a field that has been setup to allow for Null, but am now wanting to change that to not allow for Null. When ever I try to change this I can't because PhpMyAdmin has set all the previous records to Null. How can I fix this problem? Is there a query I could put that will remove all the Null values and set the field to Non ...

How to use datareader with null values

Say I have this class: class myclass { public int Field1{ get; set; } public int? Field2 { get; set; } //Note Field2 is nullable } I'm trying to populate a generic list with data coming from a database. As GetSqlInt32 implements INullable I would have thought that the below code would work. It doesn't. It generates an error ...

LINQ-to-SQL Enumerable expression with Binary = null fails

This is a strange LINQ-to-SQL problem which can't evaluate as an Enumerable (in SQL) but I can evaluate client side. I think it's related to my testing Binary property as 'null'. I need to determine when my Job is complete, which means that all Files in that Job have at least some data in their binary FileContents property. The proced...

Compare two Java objects with a check for null

I feel like such a novice for asking this question, but is there a method in the JDK that compares two objects for equality, accounting for nulls? Something like this: public static boolean equals(Object o1, Object o2) { if (o1 == null) { return o2 == null; // Two nulls are considered equal } else if (o2 == null...