Skip to content

Cant access params from subquery when UPDATE'ing #684

Description

@tingli111

It appears that variable binding in compound statement is not supported well.

E.g.

  1. Below statement is not working. The data is not updated at all.
DB.exec("UPDATE [Table] SET  [Field1] = 'New' WHERE ( [Field2] = ( SELECT [Field2]  FROM [Table] WHERE [Field3] = '?'  ))", ['aaa']);
  1. If we remove the variable binding, then it works.
DB.exec("UPDATE [Table] SET  [Field1] = 'New' WHERE ( [Field2] <= ( SELECT [Field2]  FROM [Table] WHERE [Field3] = 'aaa''  ))");
  1. We also tested that below statement is working.
DB.exec("UPDATE [Table] SET  [Field1] = 'New' WHERE ( [Field3] = ? )", ['aaa']);

That means variable binding in compound statement (UPDATE statement containing one SELECT statement) is not supported properly in alasql.

Is this a defect in alasql, or do I miss anything?
Any help or hint would be appreciated.

Update from AlaSQL team: See problem in this jsfiddle: http://jsfiddle.net/1w5mL0we/

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions