Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to clone/copy an entire database table #38

Closed
JJJ opened this issue Apr 8, 2020 · 4 comments · Fixed by #66 or #131
Closed

Add methods to clone/copy an entire database table #38

JJJ opened this issue Apr 8, 2020 · 4 comments · Fixed by #66 or #131
Assignees
Labels
component-table The Table class type-feature Some new, cool, neat thing.
Milestone

Comments

@JJJ
Copy link
Collaborator

JJJ commented Apr 8, 2020

Just as the title says, the Table class currently lacks any method(s) related to taking all of the data in the current table and copying it (temporarily or permanently) to another table/location.

@JJJ JJJ added type-feature Some new, cool, neat thing. component-table The Table class labels Apr 8, 2020
@JJJ JJJ added this to the 1.1.0 milestone Apr 8, 2020
@JJJ JJJ self-assigned this Apr 8, 2020
JJJ added a commit that referenced this issue Jul 28, 2020
This commit wraps the SQL necessary to clone a table and copy its contents into 2 separate helper methods.

Fixes #38.
@JJJ JJJ closed this as completed in #66 Jul 28, 2020
JJJ added a commit that referenced this issue Jul 28, 2020
This commit wraps the SQL necessary to clone a table and copy its contents into 2 separate helper methods.

Fixes #38.
@JJJ
Copy link
Collaborator Author

JJJ commented Aug 26, 2020

Turns out that clone is still a reserved keyword in versions of PHP less than 7. 😞

That means PHP versions like 5.6 will complain about the clone() method.

Going to keep the code as is for now, but noting it in case anyone else gets caught with T_CLONE PHP fatal errors. Here's one from Sugar Calendar:

PHP Parse error:  syntax error, unexpected 'clone' (T_CLONE), expecting identifier (T_STRING) in /app/public/content/plugins/sugar-calendar/sugar-event-calendar/includes/classes/database/engine/class-table.php on line 490

@spencerfinnell
Copy link

@JJJ Do you have any thoughts about adding the fix from awesomemotive/sugarcalendar-core#105 to the library directly? When managing BerlinDB with Composer and using PHP 5.6 (which isn't explicitly not supported) the clone method needs to be renamed after each install.

@JJJ
Copy link
Collaborator Author

JJJ commented Dec 8, 2021

@spencerfinnell Probably worth porting that fix here and removing it when 5.6 support gets dropped?

@spencerfinnell
Copy link

@JJJ I think that makes the most sense. I'm 100% certain I'm going to forget to edit it one day and break 5.6 compatibility accidentally :(

@JJJ JJJ reopened this Mar 10, 2022
JJJ added a commit that referenced this issue Mar 10, 2022
For PHP 5.6 compatibility.

Fixes #38.
@JJJ JJJ closed this as completed in #131 Mar 10, 2022
JJJ added a commit that referenced this issue Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-table The Table class type-feature Some new, cool, neat thing.
Projects
None yet
2 participants