Package is successfully generated. but derived column showing the error bellow-
Validation error. This is a programmed DataFlowTask Derived Column [2]: Attempt to parse the expression "Empid" failed and returned error code 0xC00470A2. The expression cannot be parsed. It might contain invalid elements or it might not be well-formed. There may also be an out-of-memory error. MyProgrammedDataflowTaskWithDerivedColumn.dtsx
bellow is my code-
// Create an application
Application app = new Application();
// Create a package
Package pkg = new Package();
//Setting some properties
pkg.Name = #"MyProgrammedDataflowTaskWithDerivedColumn";
//Adding a connection to the database AdventureWorksLT2008R2
ConnectionManager ConnMgrAdvent = pkg.Connections.Add("OLEDB");
ConnMgrAdvent.ConnectionString = "Data Source=412-1682;Initial Catalog=Empdb;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;";
ConnMgrAdvent.Name = #"AdventureWorks2008R2";
ConnMgrAdvent.Description = #"SSIS Connection Manager for OLEDB Source";
//Adding a connection to the database Import_DB
ConnectionManager ConnMgrImport_DB = pkg.Connections.Add("OLEDB");
ConnMgrImport_DB.ConnectionString = "Data Source=412-1682;Initial Catalog=stgEmpdb;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;";
ConnMgrImport_DB.Name = #"Import_DB";
ConnMgrImport_DB.Description = #"SSIS Connection Manager for OLEDB Source";
//Adding the dataflow task to the package
Executable exe = pkg.Executables.Add("STOCK:PipelineTask");
TaskHost TKHSQLHost = (TaskHost)exe;
TKHSQLHost.Name = "This is a programmed DataFlowTask";
MainPipe dataFlowTask = (MainPipe)TKHSQLHost.InnerObject;
// Create the source component.
IDTSComponentMetaData100 source =
dataFlowTask.ComponentMetaDataCollection.New();
source.ComponentClassID = "DTSAdapter.OleDbSource.3";
CManagedComponentWrapper srcDesignTime = source.Instantiate();
srcDesignTime.ProvideComponentProperties();
// Assign the connection manager.
if (source.RuntimeConnectionCollection.Count > 0)
{
source.RuntimeConnectionCollection[0].ConnectionManager =DtsConvert.GetExtendedInterface(ConnMgrAdvent);
source.RuntimeConnectionCollection[0].ConnectionManagerID =
pkg.Connections["AdventureWorks2008R2"].ID;
}
// Set the custom properties of the source.
srcDesignTime.SetComponentProperty("AccessMode", 0);
srcDesignTime.SetComponentProperty("OpenRowset", "[dbo].[emp1]");
// Connect to the data source, and then update the metadata for the source.
srcDesignTime.AcquireConnections(null);
srcDesignTime.ReinitializeMetaData();
srcDesignTime.ReleaseConnections();
// Create the destination component.
IDTSComponentMetaData100 destination =
dataFlowTask.ComponentMetaDataCollection.New();
destination.ComponentClassID = "DTSAdapter.OleDbDestination.3";
CManagedComponentWrapper destDesignTime = destination.Instantiate();
destDesignTime.ProvideComponentProperties();
// Assign the connection manager.
destination.RuntimeConnectionCollection[0].ConnectionManager =
DtsConvert.GetExtendedInterface(ConnMgrImport_DB);
if (destination.RuntimeConnectionCollection.Count > 0)
{
destination.RuntimeConnectionCollection[0].ConnectionManager =
DtsConvert.GetExtendedInterface(ConnMgrImport_DB);
destination.RuntimeConnectionCollection[0].ConnectionManagerID =
pkg.Connections["Import_DB"].ID;
}
// Set the custom properties of the destination
destDesignTime.SetComponentProperty("AccessMode", 0);
destDesignTime.SetComponentProperty("OpenRowset", "[dbo].[emp1]");
// Connect to the data source, and then update the metadata for the source.
destDesignTime.AcquireConnections(null);
destDesignTime.ReinitializeMetaData();
destDesignTime.ReleaseConnections();
//Derived Column
IDTSComponentMetaData100 derived =
dataFlowTask.ComponentMetaDataCollection.New();
derived.Name = "Derived Column Component";
derived.ComponentClassID = "DTSTransform.DerivedColumn.3";
CManagedComponentWrapper DesignDerivedColumns = derived.Instantiate();
DesignDerivedColumns.ProvideComponentProperties(); //design time
derived.InputCollection[0].ExternalMetadataColumnCollection.IsUsed = false;
derived.InputCollection[0].HasSideEffects = false;
//update the metadata for the derived columns
DesignDerivedColumns.AcquireConnections(null);
DesignDerivedColumns.ReinitializeMetaData();
DesignDerivedColumns.ReleaseConnections();
//Create the path from source to derived columns
IDTSPath100 SourceToDerivedPath = dataFlowTask.PathCollection.New();
SourceToDerivedPath.AttachPathAndPropagateNotifications(source.OutputCollection[0],derived.InputCollection[0]);
//Create the path from derived to desitination
IDTSPath100 DerivedToDestinationPath = dataFlowTask.PathCollection.New();
DerivedToDestinationPath.AttachPathAndPropagateNotifications(derived.OutputCollection[0], destination.InputCollection[0]);
// derivedColumns.SetUsageType(dInput.ID, vdInput, vColumn.LineageID, DTSUsageType.UT_READONLY);
//Give me an output column
IDTSInput100 dInput;
IDTSVirtualInput100 vdInput;
//Get this components default input and virtual input
dInput = derived.InputCollection[0];
vdInput = dInput.GetVirtualInput();
IDTSOutputColumn100 myCol = derived.OutputCollection[0].OutputColumnCollection.New();
myCol.Name = "RowKey";
myCol.SetDataTypeProperties(Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType.DT_I4, 0, 0, 0, 0);
myCol.ExternalMetadataColumnID = 0;
myCol.ErrorRowDisposition = DTSRowDisposition.RD_FailComponent;
myCol.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;
IDTSCustomProperty100 myProp = myCol.CustomPropertyCollection.New();
myProp.Name = "Expression";
myProp.Value = "Empid";// + vColumn.LineageID;
myProp = myCol.CustomPropertyCollection.New();
myProp.Name = "FriendlyExpression";
myProp.Value = "Empid";
//Create the input columns for the transformation component
IDTSInput100 input = derived.InputCollection[0];
IDTSVirtualInput100 derivedInputVirtual = input.GetVirtualInput();
input.ErrorRowDisposition = DTSRowDisposition.RD_NotUsed;
input.ErrorOrTruncationOperation = "";
DesignDerivedColumns.ReleaseConnections();
// Get the destination's default input and virtual input.
IDTSInput100 destinationinput = destination.InputCollection[0];
int destinationInputID = input.ID;
IDTSVirtualInput100 vdestinationinput = destinationinput.GetVirtualInput();
//Iterate through the virtual input column collection.
foreach (IDTSVirtualInputColumn100 vColumn in vdestinationinput.VirtualInputColumnCollection)
{
IDTSInputColumn100 vCol = destDesignTime.SetUsageType(destinationinput.ID, vdestinationinput, vColumn.LineageID, DTSUsageType.UT_READWRITE);
destDesignTime.MapInputColumn(destinationinput.ID, vCol.ID, destinationinput.ExternalMetadataColumnCollection[vColumn.Name].ID);
}
app.SaveToXml(String.Format(#"D:\{0}.dtsx", pkg.Name), pkg, null);
solved this by adding bellow code to validate derived column component :-
IDTSInput100 DerivedColumnInput = derived.InputCollection[0];
IDTSVirtualInput100 DerivedColumnVirtualInput = DerivedColumnInput.GetVirtualInput();
IDTSVirtualInputColumnCollection100 DerivedColumnVirtualInputColumns = DerivedColumnVirtualInput.VirtualInputColumnCollection;
foreach (IDTSVirtualInputColumn100 virtualInputColumnDT in DerivedColumnVirtualInputColumns)
{
// Select column, and retain new input column
if (virtualInputColumnDT.Name=="Empid")
{
designDerivedColumns.SetUsageType(DerivedColumnInput.ID, DerivedColumnVirtualInput, virtualInputColumnDT.LineageID, DTSUsageType.UT_READONLY);
}
}
Related
When I am doing the search, the results always contain only five records (in ascending order). I need to get a list of all files in the folder. What am I doing wrong?
FileSearch fileSearch = new FileSearch();
FileSearchBasic fileSearchBasic = new FileSearchBasic();
// Specify the folder in which the search is to be done.
SearchMultiSelectField folderFilter = new SearchMultiSelectField
{
#operator = SearchMultiSelectFieldOperator.anyOf,
operatorSpecified = true
};
RecordRef[] folder = new RecordRef[1];
folder[0] = new RecordRef
{
// Internal id of the folder where pospay files are stored.
internalId = ns.DataCollection["netSuite:PositivePayFolderInternalId"]
};
folderFilter.searchValue = folder;
fileSearchBasic.folder = folderFilter;
fileSearch.basic = fileSearchBasic;
var result = NSBase.Client.Service.search(fileSearch);
var recordList = result.recordList; // this has ony five results, why?
I found the issue, 'PageSize' was set to 5 in the service client's constructor.
I'm crashing every time Core Data tries to do an automatic lightweight migration after making a new version of the model (let's call it "Model 2.6") in my app (currently using "Model 2.5").
I've been working with Core Data for a while now, and I'm well aware that any time I need model changes for a new version, I have to use "Editor --> Add Model Version", give that version a new identifier, and switch over to that using the "Current Version" popup. I'm familiar with the "The model used to open the store is incompatible with the one used to create the store" error, because I've made that mistake before. I believe I'm encountering a different problem, though getting that same error message.
After banging my head against this for most of the weekend, I'm hoping someone out there has seen this before and can offer some sage advice.
Here are my steps to trigger the issue:
Reset Simulator, nuke Derived Data, clean build and save a file
with the 2.5 format.
In Xcode, Editor --> Add Model Version...
Use that wizard to make a "Model 2.6" based on "Model 2.5"
Change the new guy's identifier to "2.6"
Do something super-simple to that new version that's totally compatible with automatic lightweight migration, like add an new entity.
Set that "Model 2.6" under the popup for Current Version
Rebuild & launch in the simulator. Crash while opening that 2.5 file I just saved.
I've managed file format updates successfully with nine different releases, and automatic lightweight migration always worked flawlessly, until now.
Differences between now and last time:
Version 2.5 of my model was the first time I set the "Tools Version" to "Automatic (Xcode 8)". All prior releases had this set to "Xcode 7.3" so this will be the first time a migration will happen from a model version already on "Automatic (Xcode 8)"
My xcdatamodeld (and therefore momd file) now lives in my shared framework instead of the host app (so I can share code/resources among extensions, tvOS, etc), though I tried undoing this change to see if it was the cause, and the error still occurs.
I'm honestly not sure. This was supposed to be a trivial hour-long task and it's turned into two days of head-scratching.
Here's the actual error logged after the call to
[_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:self.mainURL options:storeOptions error:&error]
where the storeOptions are { NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; } and for some reason there are two: one for the file .Model.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3 and another for the file Model.sqlite, presumably part of the migration process. (Code=134110 with underlying Code=134100)
2016-11-20 16:49:26.928867 Lightbow[27831:356321] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/pwr/Library/Developer/CoreSimulator/Devices/8BDBBB41-ECF6-4646-BA13-DFFD02C40A62/data/Containers/Data/Application/8AE75536-DB51-453F-AEC2-6531F6A0675A/Library/Application%20Support/Lightbow/.Model.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3 options:{
NSSQLitePragmasOption = {
"journal_mode" = "<null>";
};
} ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "(null)" UserInfo={metadata={
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store} with userInfo dictionary {
metadata = {
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
};
reason = "The model used to open the store is incompatible with the one used to create the store";
}
2016-11-20 16:49:27.027401 Lightbow[27831:356321] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/pwr/Library/Developer/CoreSimulator/Devices/8BDBBB41-ECF6-4646-BA13-DFFD02C40A62/data/Containers/Data/Application/8AE75536-DB51-453F-AEC2-6531F6A0675A/Library/Application%20Support/Lightbow/Model.sqlite options:{
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
} ... returned error Error Domain=NSCocoaErrorDomain Code=134110 "(null)" UserInfo={NSUnderlyingError=0x6000002564a0 {Error Domain=NSCocoaErrorDomain Code=134100 "(null)" UserInfo={metadata={
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store}}, reason=Failed to open the store} with userInfo dictionary {
NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=134100 \"(null)\" UserInfo={metadata={\n NSPersistenceFrameworkVersion = 752;\n NSStoreModelVersionHashes = {\n LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;\n LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;\n LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;\n LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;\n LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;\n LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;\n LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;\n LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;\n LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;\n LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;\n LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;\n LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;\n LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;\n LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;\n LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;\n LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;\n LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;\n LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;\n LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;\n LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;\n LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;\n LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;\n LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;\n LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;\n };\n NSStoreModelVersionHashesVersion = 3;\n NSStoreModelVersionIdentifiers = (\n \"2.5\"\n );\n NSStoreType = SQLite;\n NSStoreUUID = \"AD94F9C0-947C-4062-A026-253C6DA20AB6\";\n \"_NSAutoVacuumLevel\" = 2;\n}, reason=The model used to open the store is incompatible with the one used to create the store}";
reason = "Failed to open the store";
}
Am I missing something obvious when creating this new version? Any other caches or hidden files to clean out? I did notice that when creating a new Whatever.xcdatamodel, a "Discard All Changes..." in Xcode left that file around, so I'm extra careful to delete test runs and check "git status" outside Xcode.
I'm skeptical of the error message because I can switch the xcdatamodeld's "Current Version" back to 2.5, see the file open just fine, switch "Current Version" to 2.6, see it fail, and go back and forth with predictable success/failure. It's clearly able to open 2.5 documents, just somehow not when it's trying to migrate them to 2.6.
I would like to set the string value to the object id when I create the object below. At the moment it prints "nil". Any ideas? Thanks
var date:NSDate = currentDatePicker.date
var DOB:NSDate = DOBPicker.date
var user = PFUser.currentUser()
var report = PFObject(className:"reports")
report["name"] = nameTextField.text
report["DOB"] = DOB
report["date"] = date
report["user"] = user
report.saveInBackground()
var ojId = report.objectId
println(ojId)
saveInBackground is an asynchronous method, so it doesn't wait. The reason why the id is not set is because the entity has not been saved yet.
I think you should use saveInBackgroundWithBlock: and retrieve the object id form within the block (which is executed after the entity has been saved):
var report = PFObject(className:"reports")
report["name"] = nameTextField.text
report["DOB"] = DOB
report["date"] = date
report["user"] = user
report.saveInBackgroundWithBlock { (success, error) -> Void in
if success {
var ojId = report.objectId
println(ojId)
}
}
or maybe also save, which is performed synchronously - but do not use that from the main thread:
report.save()
var ojId = report.objectId
println(ojId)
I have the following code
using (OracleConnection srcConn = new OracleConnection())
using (OracleConnection destConn = new OracleConnection())
{
srcConn.ConnectionString = AppInfo.SrcConnStr;
srcConn.Open();
destConn.ConnectionString = AppInfo.DestConnStr;
destConn.Open();
using (OracleCommand destCmd = new OracleCommand("ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss'", destConn))
using (OracleCommand srcCmd = new OracleCommand("ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss'", srcConn))
{
// Non-query
srcCmd.ExecuteNonQuery();
destCmd.ExecuteNonQuery();
if (Timing) { ut.TimeIt(stopwatch, "Get Connection and Command"); }
srcCmd.CommandTimeout = 0;
destCmd.CommandTimeout = 0;
srcCmd.CommandText = "select * from table_name";
rd = srcCmd.ExecuteReader();
rd.FetchSize = rd.RowSize * AppInfo.BatchSize; }
OracleBulkCopy copy = new OracleBulkCopy(destConn);
copy.DestinationTableName = DestTable;
copy.BatchSize = AppInfo.BatchSize;
copy.NotifyAfter = AppInfo.BatchSize;
copy.OracleRowsCopied += new OracleRowsCopiedEventHandler(OnOracleRowsCopied);
copy.BulkCopyTimeout = AppInfo.CommandTimeOut;
copy.WriteToServer(rd);
}
}
When it got to copy.WriteToServer(rd); it gives the following error
System.ArgumentException was caught
Message='0' is not a valid value for 'Interval'. 'Interval' must be greater than 0.
Source=System
StackTrace:
at System.Timers.Timer.set_Interval(Double value)
at Oracle.DataAccess.Client.OracleBulkCopy.PerformBulkCopy()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteDataSourceToServer()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteToServer(IDataReader reader)
My question is, How do I fix it?
Any help is appreciated.
The issue might be setting CommandTimeouts to zero. Try a reasonable number. I think this is specified in seconds.
Code:
string sqlCommand = #"UPDATE table SET active = 0 WHERE id IN (#CommaSeparatedId)";
string sqlParamName = "CommaSeparatedId";
string sqlParamValue = "111, 222";
try
{
using (NpgsqlConnection connection = new NpgsqlConnection())
{
// Get connection string from Web.config
connection.ConnectionString = _connectionString;
connection.Open();
Int32 rowsAffected;
using (NpgsqlCommand command = new NpgsqlCommand(sqlCommand, connection))
{
NpgsqlParameter sqlParam = new NpgsqlParameter(sqlParamName, NpgsqlTypes.NpgsqlDbType.Varchar);
// Code below no exception occur, and active not updated to 0
// sqlParam.Value = sqlParamValue;
// This code works for only one value
sqlParam.Value = "111";
command.Parameters.Add(sqlParam);
rowsAffected = command.ExecuteNonQuery();
}
}
}
catch (NpgsqlException pgEx)
{
throw pgEx;
}
The problem is:
If I'm using the 111, 222 as the sqlParam.Value'rowsAffected = 0, but if I'm using only111or222rowsAffected = 1`. That means it success to updated when only 1 value but will failed if trying to update more than 1 value.
Expected Query:
UPDATE table
SET active = 0
WHERE id IN ('111', '222');
What I'm missing in code above?
The problem you are facing is due to the fact that the parameter value "111,222" will be seen by the database engine not like two distinct values, but as one.
The database search for a record with ID = "111,222" and find nothing matching the request.
You should try to use a stored procedure and execute a Dynamic SQL according to the syntax required by PostgreSQL