Overview
Features
Download
Documentation
Community
Add-Ons & Services

Data::Keywords::into(T& t, const T& def) missing in trunk

Please post support and help requests here.

Data::Keywords::into(T& t, const T& def) missing in trunk

Postby Hitnrun » 11 Sep 2012, 19:36

I am using trunk, and noticed that the Data::Keywords::into(T& t, const T& def) (binding with a defaut value) seems to be missing.
Without it I can't use the example o the data manual:

Code: Select all
ses << "SELECT (firstname, lastname, age) FROM Person", into(firstName), into(lastName), into(age, -1), now;


Is there any specific reason for this? Is is easy to create a patch for it, but should I?
Hitnrun
 
Posts: 20
Joined: 01 Apr 2009, 18:32

Re: Data::Keywords::into(T& t, const T& def) missing in trun

Postby alex » 11 Sep 2012, 20:46

There might have been a reason but it eludes me now. I'll try to add it and run some tests.
alex
 
Posts: 1048
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Data::Keywords::into(T& t, const T& def) missing in trun

Postby alex » 13 Sep 2012, 05:46

Ah, now I remember - it was dropped when support for batching of SQL statements was added. Batching support required Position of the statement/recordset to be passed to into() for all resultsets except the first one; that, in turn, created subtle compilation traps that were not immediately obvious - when data fetched was assigned to an integer, if you wanted to pass default as well, Position overload would be hidden and you'd have to do
Code: Select all
into(val, Position(pos))
or
Code: Select all
into(val, from(pos))
to force the use of the right overload. So, to be able to use barebone integers to indicate from which recordset to fetch the data, the overload with default and without position was removed and now there are two ways to specify default - in the sql or like this:
Code: Select all
into(age, 0, -1)

Bit clumsy, but it does the job. Looking at it now, I'm thinking it may actually make sense to enforce specifying the recordset explicitly.
alex
 
Posts: 1048
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron