[Ur] Error in final record unification
Yves Cloutier
yves.cloutier at gmail.com
Sun Mar 27 16:11:57 EDT 2016
Hello, Iam also stuck with this error when trying to delete a record using
dml:
(* Delete a given work experience *)
and deleteExperience experienceId () =
dml (DELETE FROM experienceTable
WHERE experienceTable.Id = {[experienceId]});
xml <- refresh ();
return <xml><body>
{xml}
</body></xml>
But when compiling I get:
/home/drifter/dev/urweb/portfolipro/portfolipro.ur:39:15: (to 39:52)
Error in final record unification
Can't unify record constructors
Have:
<UNIF:U1610::{{Type}}> ++
[ExperienceTable = ([Id = int]) ++ <UNIF:U1611::{Type}>]
Need: [T = [Id = int, Description = string]]
/home/drifter/dev/urweb/portfolipro/portfolipro.ur:39:15: (to 39:52)
Stuck unifying these records after canceling matching pieces:
Have:
([ExperienceTable = ([Id = int]) ++ <UNIF:U1611::{Type}>]) ++
<UNIF:U1610::{{Type}}>
Need: [T = [Id = int, Description = string]]
I used as a basis existing code from a Ur/Web demo below and modified
simply changing table names for my own.
and delete a () =
dml (DELETE FROM t
WHERE t.A = {[a]});
My complete code is below:
table experienceTable : { Id : int, Description : string}
PRIMARY KEY Id
fun refresh () =
rows <- queryX (SELECT * FROM experienceTable)
(fn row => <xml><tr>
<td>{[row.ExperienceTable.Id]}</td>
<td>{[row.ExperienceTable.Description]}</td>
<td><form><submit action={deleteExperience
row.ExperienceTable.Id} value="Delete"/></form></td>
</tr></xml>);
return <xml>
<table border=1>
<tr> <th>Id</th> <th>Description</th></tr>
{rows}
</table>
<br/><hr/><br/>
<form>
<table>
<tr> <th>Id:</th> <td><textbox{#Id}/></td> </tr>
<tr> <th>Description:</th><td><textbox{#Description}/></td> </tr>
<tr> <th/> <td><submit action={addExperience} value="Add"/></td> </tr>
</table>
</form>
</xml>
(* Add a new work experience *)
and addExperience experience =
dml (INSERT INTO experienceTable (Id, Description)
VALUES ({[readError experience.Id]}, {[readError
experience.Description]}));
xml <- refresh ();
return <xml><body>
{xml}
</body></xml>
(* Delete a given experience *)
and deleteExperience experienceId () =
dml (DELETE FROM experienceTable
WHERE experienceTable.Id = {[experienceId]});
xml <- refresh ();
return <xml><body>
{xml}
</body></xml>
fun main () =
xml <- refresh ();
return <xml><body>
{xml}
</body></xml>
Any pointers would be appreciated!
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20160327/ca1f3e90/attachment.html>
More information about the Ur
mailing list