Closed ramith closed 3 years ago
@ramith Since we support null type descriptors is this improvement necessary?
var result = dbClient->select("SELECT id from mytable where user_id = ?", (), 20);
Usually, the recordType
parameter is supported to bind the returned results to a known record type. Thus making it easier down the line
what's the type of result
when I specify ()
or rather how can I get hold of values returned from the sql query?
The returned table definition will be generated from the metadata from resultset
so in this case its going to be a table<record{int id;}>
?
Yes
I now realise, that what I requested cannot be supported with current language design (given that we can't have something like table<int>
)
So, It would be nice to have your workaround documented ( with examples). I still think there needs to be a way to work with databases with out resorting to tables (probably have an array of tuples as the return type). But that would be a whole new concept.
@ramith FRom Swanlake version onwards we are returning a stream from DB query. However, as per the stream spec, we can only return a record from the stream and not ballerina basic types
Description: Following code fragment will not compile.
it gives me an error like this:
I think this is something we should support.
Affected Versions: v1.2.8
Suggested Assignees (optional): @niveathika @anupama-pathirage