Open 9danst opened 6 years ago
orm can be set to null though but the thing is a foreign can't become null since it should never be null and should carry a value of what its foreign of... i.e a userid from a character details in the database is a foreign key to the primary ket of the userid of the accounts details in the database... You can null a non key variable...
@earltacs what do you mean by "should never be null"?
Anyway, joining the problem of the issue, I have following scenario:
h_number
and h_owner_ID
in houses
table in database, first one is just the int, second one is nullable int field that is foreign key also.
I'm trying to assign ORM to this.
For example, I have the house with number 3 and no owner, so it's null in DB.
After orm_apply_cache, changing the number
, I want to save changes with orm_save() but I simply can't do that cause owner_ID
became 0 in pawn, so we've got this:
error #1452 while executing query "UPDATE
houses
SETh_number
='5',h_owner_ID
='0' WHEREh_ID
='1' LIMIT 1": Cannot add or update a child row: a foreign key constraint fails
Does it mean that it's not able to work with not nulls(as it's in pawno) at all and I must change my columns in database, disabling Foreign Keys and set "no-owner values" to simple int zero?
The ORM system doesn't support the NULL
value yet, that's why I assigned this issue to me. I currently don't have the time to work on this, but I'll look into this problem in detail when I'm free.
@maddinat0r Thank you! Will be very glad to see this update in the future!
The only reason I'm not using ORM is because NULL doesn't work. pls fix!
It is impossible to use ORM, in that NULL does not work. please fix!
After long time, please fix, joke, at least we need method where we can check is column (in this scenario FK ) mapper to var, basically orm_does_var_exist, if does if u need to map FK with good FK value orm_addvar_int, otherwise if u want to remove orm_delvar
ex: