Does mysql index null values?
I have a mysql table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller? ...
I have a mysql table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller? ...
Is there a simple attribute or data contract that I can assign to a function parameter that prevents null from being passed in C#/.NET? Ideally this would also check at compile time to make sure the literal null isn't being used anywhere for it and at run-time throw ArgumentNullException. Currently I write something like ... if (null ...
I'm wondering to using extension method to avoid checking for null in hierarchy. The example: // GetItems(), GetFirstOrDefault(), GetProduct(), GetIDProduct() are extension methods like: public static SomeType GetSomeProperty( this XYZ obj ) { if ( object.ReferenceEquals( obj, null ) ) { return default( SomeType ); } return obj....
I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally. However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session is null in global.asax which...
I have a field (say, foo) in a table in a SQL Server database that was originally defined as nullable, but new requirements indicate that this field must be non-null. What's the best way of updating this field to non-null via an update script without deleting the contents of the table? I tried generating a script from the Design view, ...
I saw this piece of code somewhere and wondered: when and why would somebody do the following: doSomething( (MyClass) null ); Have you ever done this? Could you please share your experience? ...
I'm generating titles out of a few other fields, and want the "right" way to do: Me.Title.Value = Join(Array([Conference], [Speaker], partstr), " - ") Except any of [conference], [speaker] or partstr might be null, and I don't want the extra "-"'s. Are there any functions that'll make this job straightforward? ...
Are there any good reasons not to use \u0000 as a delimiter within a Java String? I would be encoding and decoding the string myself. This is for saving a list of user-inputted (I'm expecting input to be typed?) strings to an Eclipse preference and reading it back. The list may be variable size so I don't think I can save each item to i...
I have a column in my database (a flag) with type varchar(1) that is populated either Y or NULL (this is how it is, not in my control). In SQL Server, doing an ascending order by query, NULL is ordered at the top. Should this behaviour be consistent for Oracle and DB2? If, instead I have a COALESCE on the column to ensure it is not nu...
MS Access appears to support nulls in code, but I can't for the life of me figure out how to enter a null directly in a table. This is maddening because once a field has had a figure entered in it, it can never be deleted/set to null. Normally, allowing zero length strings would take care of this, but Access treats the XML export of a ...
Hello everybody! Tip me plase, how to insert a null value into table using Trolltech Qt 4.x SQL classes? QSqlQuery, I guess, or something else from QtNetwork. As analog of it, in .NET there is the System.DbNull class, which represents sql NULL. And what type should I use for some object's property, that can hold both null-value and QSt...
I'm used to passing around string like this in my C++ applications: void foo(const std::string& input) { std::cout << input.size() << std::endl; } void bar() { foo("stackoverflow"); } Now I have a case where I want the string to be NULL: void baz() { foo("stackoverflow"); foo(NULL); // very bad with foo implementation above ...
I read somewhere that one should never use error conditions as normal program flow. Makes excellent sense to me... But C# application sitting on top of a MySQL db. I need to parse a string value into two parts, an ID, and a value. (The original data come from a Devonian database), then validate the value against a lookup table. So, a co...
Hi, I have a problem with the following code: for(i = 0;(i - 1)< n;i++) { char* b; sprintf(b, "%d", i); } It compiles fine but when I run it it give me the infamous "0XC0000005 Access Violation" error. I have tried setting b to NULL, "", "0", 0 and a bunch of other stuff but then I get the "0XC0000005 Access Violation" error or "Expre...
Heres the issue. I have a table(mySQL) that contains dates and some of them are null. I know that I can use DateTime? or Nullable to allow nulls, but I'm not sure where to set it. What I've tried: I built the class in the dblm. The date propery has the following attributes set: Nullable : True Server Data Type : DateTime Type : NUll...
Is there a way to use the C sprintf() function without it adding a '\0' character at the end of its output? I need to write formatted text in the middle of a fixed width string. ...
I refactor my code and I am looking for a solution to grep my source files for something like if ( user && user.name && user.name.length() < 128 ) ... in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator). ...
In a mysqli prepared statement, a NULL gets turned into '' (in the case of a string) or 0 (in the case of an integer). I would like to store it as a true NULL. Is there any way of doing this? ...
Why does it (apparently) make a difference whether I pass null as an argument directly, or pass an Object that I assigned the value null? Object testVal = null; test.foo(testVal); // dispatched to foo(Object) // test.foo(null); // compilation problem -> "The method foo(String) is ambiguous" public void foo(String arg) { // More-...
I'm using SQL Server 2005. I have a field that must either contain a unique value or a NULL value. I think I should be enforcing this with either a CHECK CONSTRAINT or a TRIGGER for INSERT, UPDATE. Is there an advantage to using a constraint here over a trigger (or vice-versa)? What might such a constraint/trigger look like? Or is the...