This section contains the following examples:
While the first two examples wait until the full result set is available, the third one returns immediately with the first batch of rows (usually 1000) and continuous to call the callback whenever the next batch is ready, until everything is transferred. This avoids blocking the execution environment in case of a long running query.
Press CTRL+C to copyrunSqlWithCallback( "SELECT Name as name," + "District as district, Population as pop FROM world.city WHERE Name = 'Kabul' ", (ResultSetRows) => { print(ResultSetRows); } );
The output is:
[ { "name": "Kabul", "district": "Kabol", "pop": 1780000 } ]
Press CTRL+C to copyrunSqlIterative( "SELECT Name as n," + "Population as p FROM world.city WHERE CountryCode = 'Ven' AND District LIKE 'Bolivar'", (IResultSetData) => { print(IResultSetData); } );
The output is:
{ "requestState": { "type": "OK", "msg": "Full result set consisting of 2 rows transferred." }, "requestId": "25361d27-e80d-4cab-0884-cfe7a75eda56", "rows": [ [ "Ciudad Guayana", 663713 ], [ "Ciudad Bolívar", 301107 ] ], "columns": [ { "name": "n", "type": "STRING", "length": 140 }, { "name": "p", "type": "INT", "length": 11 } ], "done": true, "totalRowCount": 2, "executionTime": 0.0019462108612060547 }