@@ -166,6 +166,51 @@ BOOST_AUTO_TEST_CASE(moveConstructor)
166166 RowSet rowSet2{std::move (rowSet1)};
167167 BOOST_CHECK_EQUAL (rowSet2.getCount (), count);
168168 BOOST_CHECK_EQUAL (rowSet1.getCount (), 0u );
169+
170+ // Typed access works on the moved-to RowSet.
171+ BOOST_CHECK_EQUAL (rowSet2.getRow (0 ).getInt32 (0 ).value (), 2 );
172+ BOOST_CHECK_EQUAL (rowSet2.getRow (1 ).getInt32 (0 ).value (), 3 );
173+ }
174+
175+ BOOST_AUTO_TEST_CASE (moveAssignment)
176+ {
177+ const auto database = getTempFile (" RowSet-moveAssignment.fdb" );
178+
179+ Attachment attachment{CLIENT , database, AttachmentOptions ().setCreateDatabase (true )};
180+ FbDropDatabase attachmentDrop{attachment};
181+
182+ Transaction transaction{attachment};
183+
184+ Statement ddl{attachment, transaction, " create table t (col integer)" };
185+ ddl.execute (transaction);
186+ transaction.commitRetaining ();
187+
188+ Statement insert{attachment, transaction, " insert into t (col) values (?)" };
189+ for (int i = 1 ; i <= 5 ; ++i)
190+ {
191+ insert.setInt32 (0 , i);
192+ insert.execute (transaction);
193+ }
194+
195+ Statement select{attachment, transaction, " select col from t order by col" };
196+ BOOST_REQUIRE (select.execute (transaction));
197+
198+ // Fetch rows 2-3 into first batch, rows 4-5 into second.
199+ RowSet rowSet1{select, 2 };
200+ RowSet rowSet2{select, 2 };
201+
202+ BOOST_CHECK_EQUAL (rowSet1.getCount (), 2u );
203+ BOOST_CHECK_EQUAL (rowSet1.getRow (0 ).getInt32 (0 ).value (), 2 );
204+ BOOST_CHECK_EQUAL (rowSet2.getCount (), 2u );
205+ BOOST_CHECK_EQUAL (rowSet2.getRow (0 ).getInt32 (0 ).value (), 4 );
206+
207+ // Move-assign rowSet2 into rowSet1 (overwrites old data).
208+ rowSet1 = std::move (rowSet2);
209+
210+ BOOST_CHECK_EQUAL (rowSet1.getCount (), 2u );
211+ BOOST_CHECK_EQUAL (rowSet1.getRow (0 ).getInt32 (0 ).value (), 4 );
212+ BOOST_CHECK_EQUAL (rowSet1.getRow (1 ).getInt32 (0 ).value (), 5 );
213+ BOOST_CHECK_EQUAL (rowSet2.getCount (), 0u );
169214}
170215
171216BOOST_AUTO_TEST_CASE (fetchMultipleBatchesFromSameStatement)
0 commit comments