Thread overview |
---|
April 14, 2017 Why map return [] ? | ||||
---|---|---|---|---|
| ||||
auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why? |
April 14, 2017 Re: Why map return [] ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote:
> auto x = MySQLTablesRange.map!(a=>a);
> writeln(x);
>
> return: []
>
> while next code:
> MySQLTablesRange.each!(a=>a.writeln);
>
> return data line by line.
>
> Why?
What library is that supposed to be?
|
April 14, 2017 Re: Why map return [] ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to cym13 | On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote: > On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: >> auto x = MySQLTablesRange.map!(a=>a); >> writeln(x); >> >> return: [] >> >> while next code: >> MySQLTablesRange.each!(a=>a.writeln); >> >> return data line by line. >> >> Why? > > What library is that supposed to be? http://code.dlang.org/packages/mysql-native |
April 14, 2017 Re: Why map return [] ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Friday, 14 April 2017 at 15:38:19 UTC, Suliman wrote:
> On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote:
>> On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote:
>>> auto x = MySQLTablesRange.map!(a=>a);
>>> writeln(x);
>>>
>>> return: []
>>>
>>> while next code:
>>> MySQLTablesRange.each!(a=>a.writeln);
>>>
>>> return data line by line.
>>>
>>> Why?
>>
>> What library is that supposed to be?
>
> http://code.dlang.org/packages/mysql-native
I found problem! ResultRange should be converted to array before it can be `map`ed
|
April 14, 2017 Re: Why map return [] ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Friday, 14 April 2017 at 15:49:00 UTC, Suliman wrote:
> I found problem! ResultRange should be converted to array before it can be `map`ed
That shouldn't be necessary. Can you post your complete code?
|
April 14, 2017 Re: Why map return [] ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | On Friday, 14 April 2017 at 15:55:13 UTC, Rene Zwanenburg wrote: > On Friday, 14 April 2017 at 15:49:00 UTC, Suliman wrote: >> I found problem! ResultRange should be converted to array before it can be `map`ed > > That shouldn't be necessary. Can you post your complete code? ResultRange MySQLTablesRange = mysqlconnection.query(`SELECT table_name FROM information_schema.tables;`); auto x = MySQLTablesRange.map!(a=>a[0].coerce!string.split("_")[1]); writeln(x); output: [] while: MySQLTablesRange.array.map!... output result |
Copyright © 1999-2021 by the D Language Foundation