mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Extend Frame_cursor to report the current row it is pointing at
Added an extra virtual method to the Frame_cursor class to allow cursors to report the row number to which they are pointing.
This commit is contained in:
@ -795,6 +795,9 @@ public:
|
|||||||
perform_no_action= true;
|
perform_no_action= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Retrieves the row number that this cursor currently points at. */
|
||||||
|
virtual ha_rows get_curr_rownum()= 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void add_value_to_items()
|
inline void add_value_to_items()
|
||||||
{
|
{
|
||||||
@ -988,6 +991,11 @@ public:
|
|||||||
walk_till_non_peer();
|
walk_till_non_peer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void walk_till_non_peer()
|
void walk_till_non_peer()
|
||||||
{
|
{
|
||||||
@ -1110,6 +1118,11 @@ public:
|
|||||||
walk_till_non_peer();
|
walk_till_non_peer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void walk_till_non_peer()
|
void walk_till_non_peer()
|
||||||
{
|
{
|
||||||
@ -1200,6 +1213,11 @@ public:
|
|||||||
walk_till_non_peer();
|
walk_till_non_peer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void walk_till_non_peer()
|
void walk_till_non_peer()
|
||||||
{
|
{
|
||||||
@ -1299,6 +1317,11 @@ public:
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1322,15 +1345,25 @@ public:
|
|||||||
void next_partition(ha_rows rownum)
|
void next_partition(ha_rows rownum)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
UNBOUNDED PRECEDING frame end just stays on the first row.
|
UNBOUNDED PRECEDING frame end just stays on the first row of the
|
||||||
We are top of the frame, so we don't need to update the sum function.
|
partition. We are top of the frame, so we don't need to update the sum
|
||||||
|
function.
|
||||||
*/
|
*/
|
||||||
|
curr_rownum= rownum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_row()
|
void next_row()
|
||||||
{
|
{
|
||||||
/* Do nothing, UNBOUNDED PRECEDING frame end doesn't move. */
|
/* Do nothing, UNBOUNDED PRECEDING frame end doesn't move. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return curr_rownum;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ha_rows curr_rownum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1380,6 +1413,11 @@ public:
|
|||||||
{
|
{
|
||||||
/* Do nothing, UNBOUNDED FOLLOWING frame end doesn't move */
|
/* Do nothing, UNBOUNDED FOLLOWING frame end doesn't move */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1415,6 +1453,11 @@ public:
|
|||||||
item_with_row_count->set_row_count(num_rows_in_partition);
|
item_with_row_count->set_row_count(num_rows_in_partition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1492,6 +1535,11 @@ public:
|
|||||||
else
|
else
|
||||||
add_value_to_items();
|
add_value_to_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1506,17 +1554,33 @@ class Frame_rows_current_row_bottom : public Frame_cursor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Frame_rows_current_row_bottom() : curr_rownum(0) {}
|
||||||
|
|
||||||
void pre_next_partition(ha_rows rownum)
|
void pre_next_partition(ha_rows rownum)
|
||||||
{
|
{
|
||||||
add_value_to_items();
|
add_value_to_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_partition(ha_rows rownum) {}
|
void next_partition(ha_rows rownum) {}
|
||||||
|
|
||||||
void pre_next_row()
|
void pre_next_row()
|
||||||
{
|
{
|
||||||
/* Temp table's current row is current_row. Add it to the window func */
|
/* Temp table's current row is current_row. Add it to the window func */
|
||||||
add_value_to_items();
|
add_value_to_items();
|
||||||
}
|
}
|
||||||
void next_row() {};
|
|
||||||
|
void next_row()
|
||||||
|
{
|
||||||
|
curr_rownum++;
|
||||||
|
};
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return curr_rownum;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ha_rows curr_rownum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1611,6 +1675,11 @@ public:
|
|||||||
next_row_intern();
|
next_row_intern();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha_rows get_curr_rownum()
|
||||||
|
{
|
||||||
|
return cursor.get_rownum();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool next_row_intern()
|
bool next_row_intern()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user