Search Results

Search found 18153 results on 727 pages for 'null coalescing'.

Page 19/727 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Is passing NULL param exactly the same as passing no param

    - by park
    I'm working with a function whose signature looks like this afunc(string $p1, mixed $p2, array $p3 [, int $p4 = SOM_CONST [, string $p5 ]] ) In some cases I don't have data for the last parameter $p5 to pass, but for the sake of consistency I still want to pass something like NULL. So my question, does PHP treat passing a NULL exactly the same as not passing anything? somefunc($p1, $p2, $p3, $p4 = SOM_CONST); somefunc($p1, $p2, $p3, $p4 = SOM_CONST, NULL);

    Read the article

  • How can I set a field to null in a Pre-Update Plugin

    - by Juergen
    I developed a Pre-Update Plugin for the Case entity. In this plugin I want to set a string field to a new value. It works smoothly if the new value is not null. But if the new value si null, it is just ignored. This works: Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>(); caseTarget.ProductSerialNumber = "new value"; After the execution of the plugin, the ProductSerialNumber field has value "new value". This doesn't work: Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>(); caseTarget.ProductSerialNumber = null; After the execution of the plugin, the ProductSerialNumber field has still its old value. How can I set the target's field to null?

    Read the article

  • MonoRail - How to grab records where a column isn't null

    - by Justin
    Hey, In MonoRail/Active Record if I want to grab all records that have a certain column equal to null, I can do: public static Category[] AllParentCategories() { return (FindAllByProperty("Parent.Id", null)); } However, what if I want to grab all records where that column doesn't equal null? I can't figure out how to do that using this FindAllByProperty method, is there another method that is more flexible or a way to grab records using a linq-like querying language? Thanks, Justin

    Read the article

  • Constructor invocation returned null: what to do?

    - by strager
    I have code which looks like: private static DirectiveNode CreateInstance(Type nodeType, DirectiveInfo info) { var ctor = nodeType.GetConstructor(new[] { typeof(DirectiveInfo) }); if(ctor == null) { throw new MissingMethodException(nodeType.FullName, "ctor"); } var node = ctor.Invoke(new[] { info }) as DirectiveNode; if(node == null) { // ???; } return node; } I am looking for what to do (e.g. what type of exception to throw) when the Invoke method returns something which isn't a DirectiveNode or when it returns null (indicated by // ??? above). (By the method's contract, nodeType will always describe a subclass of DirectiveNode.) I am not sure when calling a constructor would return null, so I am not sure if I should handle anything at all, but I still want to be on the safe side and throw an exception if something goes wrong.

    Read the article

  • about null values!

    - by user329820
    Hi I have a question that if we declare a variable and then do not set it explicitly to null value then it would be null outomatically ,i mean that the below code will return true or false ? thanks DECLARE @val CHAR(4) If @val = NULL

    Read the article

  • LINQ, Left Join, Only Get where null in join table

    - by kmehta
    Hi. I am trying to do a left outer join on two tables, but I only want to return the results from the first table where the second table does not have a record (null). var agencies = from a in agencyList join aa in joinTable on a.AgencyId equals aa.AgencyId into joined from aa in joined.DefaultIfEmpty() where aa == null) select a; But this does not exclude the non null values of aa, and returns all the records just the same as if the 'where aa == null' was not there. Any help is appreciated. Thanks.

    Read the article

  • Convert Null Value to String - C#.NET

    - by peace
    foreach (PropertyInfo PropertyItem in this.GetType().GetProperties()) { PropertyItem.SetValue(this, objDataTable.Rows[0][PropertyItem.Name.ToString()], null); } In one of the loops i get this exceptional error: Object of type 'System.DBNull' cannot be converted to type 'System.String'. The error occurs because one of the fields in the database has no value (null), so the string property could not handle it. How can i convert this null to string? I got this solution If you know a shorter or better one, feel free to post it. I'm trying to avoid checking on every loop is current value is null or not.

    Read the article

  • Constructor invokation returned null: what to do?

    - by strager
    I have code which looks like: private static DirectiveNode CreateInstance(Type nodeType, DirectiveInfo info) { var ctor = nodeType.GetConstructor(new[] { typeof(DirectiveInfo) }); if(ctor == null) { throw new MissingMethodException(nodeType.FullName, "ctor"); } var node = ctor.Invoke(new[] { info }) as DirectiveNode; if(node == null) { // ???; } return node; } I am looking for what to do (e.g. what type of exception to throw) when the Invoke method returns something which isn't a DirectiveNode or when it returns null (indicated by // ??? above). (By the method's contract, nodeType will always describe a subclass of DirectiveNode.) I am not sure when calling a constructor would return null, so I am not sure if I should handle anything at all, but I still want to be on the safe side and throw an exception if something goes wrong.

    Read the article

  • Bizarre WHERE col = NULL behavior

    - by Kenneth
    This is a problem one of our developers brought to me. He stumbled across an old stored procedure which used 'WHERE col = NULL' several times. When the stored procedure is executed it returns data. If the query inside the stored procedure is executed manually it will not return data unless the 'WHERE col = NULL' references are changed to 'WHERE col IS NULL'. Can anyone explain this behavior?

    Read the article

  • java api design - NULL or Exception

    - by srini.venigalla
    Is it better to return a null value or throw an exception from an API method? Returning a null requires ugly null checks all over, and cause a major quality problem if the return is not checked. Throwing an exception forces the user to code for the faulty condition, but since Java exceptions bubble up and force the caller code to handle them, in general, using custom exceptions may be a bad idea (specifically in java). Any sound and practical advice?

    Read the article

  • Removing "Using temporary; Using filesort" from this MySQL select+join+group by query

    - by claytontstanley
    I have the following query: select t.Chunk as LeftChunk, t.ChunkHash as LeftChunkHash, q.Chunk as RightChunk, q.ChunkHash as RightChunkHash, count(t.ChunkHash) as ChunkCount from chunksubset as t join chunksubset as q on t.ID = q.ID group by LeftChunkHash, RightChunkHash And the following explain table: id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE subsets ref PRIMARY,IDIndex,SubsetIndex SubsetIndex 767 const 522014 "Using where; Using temporary; Using filesort" 1 SIMPLE subsets eq_ref PRIMARY,IDIndex,SubsetIndex PRIMARY 771 sotero.subsets.Id,const 1 "Using where; Using index" 1 SIMPLE c ref IDIndex IDIndex 4 sotero.subsets.Id 12 "Using where" 1 SIMPLE c ref IDIndex IDIndex 4 sotero.subsets.Id 12 note the "using temporary; using filesort". When this query is run, I quickly run out of RAM (presumably b/c of the temp table), and then the HDD kicks in, and the query slows to a halt. I thought it might be an index issue, so I started adding a few that sort of made sense: Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment chunks 0 PRIMARY 1 ChunkId A 17796190 NULL NULL BTREE chunks 1 ChunkHashIndex 1 ChunkHash A 243783 NULL NULL BTREE chunks 1 IDIndex 1 Id A 1483015 NULL NULL BTREE chunks 1 ChunkIndex 1 Chunk A 243783 NULL NULL BTREE chunks 1 ChunkTypeIndex 1 ChunkType A 2 NULL NULL BTREE chunks 1 chunkHashByChunkIDIndex 1 ChunkHash A 243783 NULL NULL BTREE chunks 1 chunkHashByChunkIDIndex 2 ChunkId A 17796190 NULL NULL BTREE chunks 1 chunkHashByChunkTypeIndex 1 ChunkHash A 243783 NULL NULL BTREE chunks 1 chunkHashByChunkTypeIndex 2 ChunkType A 261708 NULL NULL BTREE chunks 1 chunkHashByIDIndex 1 ChunkHash A 243783 NULL NULL BTREE chunks 1 chunkHashByIDIndex 2 Id A 17796190 NULL NULL BTREE But still using the temporary table. The db engine is MyISAM. How can I get rid of the using temporary; using filesort in this query? Just changing to InnoDB w/o explaining the underlying cause is not a particularly satisfying answer. Besides, if the solution is to just add the proper index, then that's much easier than migrating to another db engine.

    Read the article

  • SQL for sorting boolean column as true, null, false

    - by petehern
    My table has three boolean fields: f1, f2, f3. If I do SELECT * FROM table ORDER BY f1, f2, f3 the records will be sorted by these fields in the order false, true, null. I wish to order them with null in between true and false: the correct order should be true, null, false. I am using PostgreSQL.

    Read the article

  • removing null valued columns from dataset in asp .net

    - by N.Sai Harish
    I have a table which stores data with null valued columns for some entries .I want to retrieve only Not null data to the detail view. I tried the following foreach(string strTableField in (objDataSet.Tables[0].Columns[i])) { if(objDataSet.Tables[0].Columns[i].Equals(null)) { objDataSet.Tables[0].Columns.Remove(strTableField); objDataSet.Tables[0].AcceptChanges(); } i++; } but it is giving error .. Pls help me reg this ...

    Read the article

  • Null Pointer Exception in my BroadcastReceiver class

    - by user1760007
    I want to search a db and toast a specific column on the startup of the phone. The app keeps crashing and getting an exception even though I feel as the code is correct. @Override public void onReceive(Context ctx, Intent intent) { Log.d("omg", "1"); DBAdapter do = new DBAdapter(ctx); Log.d("omg", "2"); Cursor cursor = do.fetchAllItems(); Log.d("omg", "3"); if (cursor.moveToFirst()) { Log.d("omg", "4"); do { Log.d("omg", "5"); String title = cursor.getString(cursor.getColumnIndex("item")); Log.d("omg", "6"); // i = cursor.getInt(cursor.getColumnIndex("id")); Toast.makeText(ctx, title, Toast.LENGTH_LONG).show(); } while (cursor.moveToNext()); } cursor.close(); } The frustrating part is that I don't see any of my "omg" logs show up in logcat. I only see when my application crashes. I get three lines of errors in logcat. 10-19 12:31:11.656: E/AndroidRuntime(1471): java.lang.RuntimeException: Unable to start receiver com.test.toaster.MyReciever: java.lang.NullPointerException 10-19 12:31:11.656: E/AndroidRuntime(1471): at com.test.toaster.DBAdapter.fetchAllItems(DBAdapter.java:96) 10-19 12:31:11.656: E/AndroidRuntime(1471): at com.test.toaster.MyReciever.onReceive(MyReciever.java:26) For anyone interested, here is my DBAdapter fetchAllItems code: public Cursor fetchAllItems() { return mDb.query(DATABASE_TABLE, new String[] { KEY_ITEM, KEY_PRIORITY, KEY_ROWID }, null, null, null, null, null); }

    Read the article

  • Combining two queries on same table

    - by user1830856
    I've looked through several previous questions but I am struggling to apply the solutions to my specific example. I am having trouble combining query 1 and query 2. My query originally returned (amongst other details) the values "SpentTotal" and "UnderSpent" for all members/users for the current month. My issue has been adding two additional columns to this original quert that will return JUST these two columns (Spent and Overspent) but for the previous months data Original Query #1: set @BPlanKey = '##CURRENTMONTH##' EXECUTE @RC = Minimum_UpdateForPeriod @BPlanKey SELECT cm.clubaccountnumber, bp.Description , msh.PeriodMinObligation, msh.SpentTotal, msh.UnderSpent, msh.OverSpent, msh.BilledDate, msh.PeriodStartDate, msh.PeriodEndDate, msh.OverSpent FROM MinimumSpendHistory msh INNER JOIN BillPlanMinimums bpm ON msh.BillingPeriodKey = @BPlanKey and bpm.BillPlanMinimumKey = msh.BillPlanMinimumKey INNER JOIN BillPlans bp ON bp.BillPlanKey = bpm.BillPlanKey INNER JOIN ClubMembers cm ON cm.parentmemberkey is null and cm.ClubMemberKey = msh.ClubMemberKey order by cm.clubaccountnumber asc, msh.BilledDate asc Query #2, query of all columns for PREVIOUS month, but I only need two (spent and over spent), added to the query from above, joined on the customer number: set @BPlanKeyLastMo = '##PREVMONTH##' EXECUTE @RCLastMo = Minimum_UpdateForPeriod @BPlanKeyLastMo SELECT cm.clubaccountnumber, bp.Description , msh.PeriodMinObligation, msh.SpentTotal, msh.UnderSpent, msh.OverSpent, msh.BilledDate, msh.PeriodStartDate, msh.PeriodEndDate, msh.OverSpent FROM MinimumSpendHistory msh INNER JOIN BillPlanMinimums bpm ON msh.BillingPeriodKey = @BPlanKeyLastMo and bpm.BillPlanMinimumKey = msh.BillPlanMinimumKey INNER JOIN BillPlans bp ON bp.BillPlanKey = bpm.BillPlanKey INNER JOIN ClubMembers cm ON cm.parentmemberkey is null and cm.ClubMemberKey = msh.ClubMemberKey order by cm.clubaccountnumber asc, msh.BilledDate asc Big thank you to any and all that are willing to lend their help and time. Cheers! AJ CREATE TABLE MinimumSpendHistory( [MinimumSpendHistoryKey] [uniqueidentifier] NOT NULL, [BillPlanMinimumKey] [uniqueidentifier] NOT NULL, [ClubMemberKey] [uniqueidentifier] NOT NULL, [BillingPeriodKey] [uniqueidentifier] NOT NULL, [PeriodStartDate] [datetime] NOT NULL, [PeriodEndDate] [datetime] NOT NULL, [PeriodMinObligation] [money] NOT NULL, [SpentTotal] [money] NOT NULL, [CurrentSpent] [money] NOT NULL, [OverSpent] [money] NULL, [UnderSpent] [money] NULL, [BilledAmount] [money] NOT NULL, [BilledDate] [datetime] NOT NULL, [PriorPeriodMinimum] [money] NULL, [IsCommitted] [bit] NOT NULL, [IsCalculated] [bit] NOT NULL, [BillPeriodMinimumKey] [uniqueidentifier] NOT NULL, [CarryForwardCounter] [smallint] NULL, [YTDSpent] [money] NOT NULL, [PeriodToAccumulateCounter] [int] NULL, [StartDate] [datetime] NOT NULL,

    Read the article

  • Web Service returning object with null fields

    - by Xaiter
    Never seen this one before. WebService.Implementation imp = new WebService.Implementation(); WebService.ImplementationRequest req = new WebService.ImplementationRequest(); return imp.GetValue(req); The object that imp returns is not null. It's returning an ImplementationResponse, as expected. But all of the fields in that object are null. Which is not expected. The WebService, currently, just returns some constant dummy data. We've tested this on another developer's machine, works just fine. I suppose I should also note that the WebService should throw an exception if I pass null into the GetValue method. It doesn't. Not for me. Any idea what could be wrong with my environment that could make a WebService return an object, but make every value in that object null? And somehow 'magically' return this mystery object when it should be throwing an exception?

    Read the article

  • Set reference = null in finally block?

    - by deamon
    A colleague of mine sets reference to null in finally blocks. I think this is nonsense. public Something getSomething() { JDBCConnection jdbc=null; try { jdbc=JDBCManager.getConnection(JDBCTypes.MYSQL); } finally { JDBCManager.free(jdbc); jdbc=null; // <-- Useful or not? } } What do you think of it?

    Read the article

  • Typcast a null pointer to char*

    - by user326253
    Suppose I have a char* elem that is supposed to hold a char*, s.t. elem[0] = char*, elem[1...m]= more chars. Is there a way I can put a null ptr within char* elem? When I try to set elem = NULL, it gives me a type error because NULL is an int. Any help would be greatly appreciated!

    Read the article

  • how can i substitute a NULL value for a 0 in an SQL Query result

    - by Name.IsNullOrEmpty
    SELECT EmployeeMaster.EmpNo, Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays FROM EmployeeMaster FULL OUTER JOIN LeaveApplications ON EmployeeMaster.id = LeaveApplications.EmployeeRecordID INNER JOIN LeaveMaster ON EmployeeMaster.id = LeaveMaster.EmpRecordID GRoup BY EmployeeMaster.EmpNo order by LeaveDays Desc with the above query, if an employee has no leave application record in table LeaveApplications, then their Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays column returns NULL. What i would like to do is place a value of 0 (Zero) instead of NULL. I want to do this because i have a calculated column in the same query whose formular depends on the LeaveDays returned and when LeaveDays is NULL, the formular some how fails. Is there away i can put 0 for NULL such that that i can get my desired result.

    Read the article

  • Convert Yes/No/Null from SQL to True/False in a DataTable

    - by Scott Chamberlain
    I have a Sql Database (which I have no control over the schema) that has a Column that will have the varchar value of "Yes", "No", or it will be null. For the purpose of what I am doing null will be handled as No. I am programming in c# net 3.5 using a data table and table adapter to pull the data down. I would like to directly bind the column using a binding source to a check box I have in my program however I do not know how or where to put the logic to convert the string Yes/No/null to boolean True/False; Reading a null from the SQL server and writing back a No on a update is acceptable behavior. Any help is greatly appreciated. EDIT -- This is being developed for windows.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >