Opening an existing siaqodb instance on Windows Phone - windows-phone

I manage to create a database and use it, but get an exception when trying to initiate from an existing one.
var store = new Siaqodb("storageplace");
Additional information: GenericArguments[0], 'System.Nullable`1[System.Double]', on '#=qestOt0Z3wa12dRPJi9vYcGXf14qUdof1q8lAg3hgeMk=[#=qCmB_qbvBwSH22$$JQWSgOA==]' violates the constraint of type '#=qCmB_qbvBwSH22$$JQWSgOA=='.
Any suggestions?

You probably added an index on a Nullable types. Indexes on nullable types are not supported.

Related

Failed to enable constraints MySQL using MySqlClient.DataHandler

Error message
The above image shows the error image whenever I tried to execute the sql command to get data table in VB .NET as shown below: (note: sqlstr and dttable has been declared before function headers, therefore no declaration here)
Public Function retrieveProducts() As DataTable
sqlstr = "SELECT * FROM products;"
dttable = MysqlClient.DataHandler.GetDataTable(sqlstr, conn, True)
If Not IsNothing(dttable) Then
Return dttable
End If
Return Nothing
End Function
Before you guys link the problem to any "duplicate" question, I want to inform that I had browsed a ton of answers from similar questions and none of them worked for me.
Here are the solutions I tried:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
I tried ? dttable.GetErrors(0).RowError on debug mode and it says "Referenced object has a value of 'Nothing'."
I also tried removing constraints of data table in my program (putting the remove function before the MysqlClient.DataHandler.GetDataTable function causes nothing to be returned)
Note:
The solution for dataset.enforceConstraints = false should be my last resort since my supervisor requested the program structure to revolve around MySqlClient data handler. If it's possible I wanted to resolve this without using data set.
As for the table itself, it has a foreign key constraint referencing to another table, the values in the table didnt violate any non-null and unique constraints. Besides that, other table with foreign key constraint too however, can be retrieved successfully. So I am confused with what is wrong.
DDL of the target table

Oracle Apex: How to update a tabular form of a table with Primary Key set as Identity Always?

I am struggling with this specific problem for hours. Hopefully someone can help me on this.
As the question described above, I have a tabular form which is built from a table, which has a primary key ('ID') set as "Identity Always". This became a problem for the tabular form, because whenever I made changes to the data and click on 'Save', Apex will display this error: ORA-32796: cannot update a generated always identity column
I tried several workaround such as ROWID, but this solution would not work because I need to join the tabular form with fields from other tables to display additional info - hence the ROWID would not be preserved and could not be used as primary key.
I also read in an Apex documentation that:
Utilizing the IDENTITY clause on a table can have an impact on
Application Express applications. An error will be raised by the
database if an IDENTITY column, with ALWAYS parameter specified, is
included in an INSERT or UPDATE statement. The Application Express
Builder has been enhanced to allow the specification of the identity
clause within the Create Table Wizard. The Create Form wizard will
generate a "Display Only" item for an identity column with the ALWAYS
parameter.
Which I do not understand. Apex indeed generated an extra column ('ID_Display'), but it does not change the fact that my tabular form still throw the same error (ORA-32796 above). How is this "Display Only" item can save me from the "cannot update a generated always identity column"?
As a side note, I am developing in apex.oraclecorp.com, Apex as a service, where I cannot access the files or made SQL alteration to my table. Please let me know if you encountered this problem before and found a solution - thanks in advance!
P.S. the Apex version is 5.0.4.
EDIT:
Sorry, I just realized there is the SQL Command UI to perform SQL operation in Apex. Anyone knows how to ALTER the identity of a table from ALWAYS to DEFAULT?
So I'm sure this is more of a workaround than an actual understanding of the issue and solution, but in the wizard, I found that:
when you are in 'Form Attributes' in the wizard setting as follows:
Primarky Key Type: Select Primark Key Column(s)
Primary Key Column: 'Your column'
Primary Key Column: (I didn't have anything to enter here)
Primary Key Source Type: 'Existing Trigger' (This seemed to allow the Identity column do it's thing on the table/form I was working on.). I had been running into the same issue with I would change this to 'Existing Sequence'.
If you ever figured this out, I would love to know the details.
More reading is required, but it's something...
The following solved the ORA-32796 insert problem for me with Editable Interactive Grid. I suppose the same works for tabular forms.
Goto Page Designer for the page in question.
Click on "Processing", or click on "Component View" and then click on the process under "Page Processing". For Editable Interactive Grid, it is the process "Save interactive Grid Data".
Click on "Yes" in the "Return Primary Key(s) after insert" section in properties.
Click save/run.
ALTER TABLE t MODIFY c GENERATED BY DEFAULT as IDENTITY;
After experimenting with this considerably it appears that the only option, if you want to use the Identity clause to generate a sequential numeric primary key, is to use
BY DEFAULT ON NULL AS IDENTITY
as Apex will attempt to insert a null value into the ID Field when doing automatic row processing. Neither of the 2 other options to work correctly with Apex in this circumstance.
The other options are:
1. Create a sequence and a trigger, which does not present any problems with Apex
2. Use a guid for the primary key

What do the SchemaAutoAction values mean?

I'm getting back into NHibernate and I've noticed a new configuration property being used in examples: SchemaAutoAction. I cant seem to find documentation on what the various settings mean. The settings / my guesses as to what they mean are:
Recreate -- Drop and recreate the schema every time
Create -- If the schema does not exist create it
Update -- issue alter statements to make the existing schema match
the model
Validate -- Blow up if the schema differs from the model
Is this correct?
SchemaAutoAction is the same as schema-action mapping attribute.
As per docs:
The new 'schema-action' is set to none, this will prevent NHibernate
from including this mapping in its schema export, it would otherwise
attempt to create a table for this view
Similar, but not quite. The SchemaAutoAction is analogous to the configuration property hbm2ddl.auto, and its values are:
Create: always create the database when a session factory is created;
Validate: when a session factory is created check if the database matches the mappings and throw an exception otherwise;
Update: when a session factory is created issues DDL commands to update the database if it doesn't match the mappings;
Recreate: always creates the database and drop it when the session factory is disposed.

Is there any way to avoid the 'saving changes is not permitted' error when trying to change the schema

I'm not a SQL server expert by any means, and I'm hoping this is something simple. The scenario: I create a new database with all the defaults, then add a table with a primary key and two nvarchar(max) fields, but I forget to set the identity specification on the key so I go back and try to change it the IsIdentity property from No to Yes and I get the following error:
Found this after posting my question - leaving up to moderators to decide if this is something to keep or not...
The simplest way to bypass this error is to go into Option – Designers and uncheck the option Prevent saving changes that require table re-creation.

Modifying a function used as a column default in SQL Server

We're having an issue with a poorly coded SQL function(which works fine in live, but not in our test environment). This function is used to provide a default value in many tables, trying to ALTER the function returns a "Cannot ALTER ### because it is being referenced by object" error.
Is there any way round this error message? The only way I can think of is attempting to write a script to remove it from every table that has it as a default, altering the function and re-adding it after.
Since the object is referenced, you cannot modify it. This is what you do:
Remove the default constraint from the table/column
Modify the function
Add the default constraint back
SQL Server will not allow you to modify a function that is bound to the DEFAULT constraint of a column.
Your only option is to remove the constraint before altering the function. (Source)