[OPEN-ILS-DEV] Functions To Move Or Copy Buckets
John Merriam
jmerriam at biblio.org
Tue May 28 09:34:32 EDT 2019
Hi James. Thanks for pointing that out. I hadn't noticed that ticket.
I added a note to the ticket with a link to my dev list message.
On 5/23/2019 7:55 PM, James Fournie wrote:
> Hi John,
>
> I am not sure how this meshes with your neat functions, but I also filed
> a wishlist for this functionality here:
> https://bugs.launchpad.net/evergreen/+bug/1815104
>
> On Fri, May 17, 2019 at 6:50 AM John Merriam <jmerriam at biblio.org
> <mailto:jmerriam at biblio.org>> wrote:
>
> Hello. We recently had a request to copy some buckets from one user to
> another. I did not see any existing functionality to do that in
> Evergreen. Moving buckets from one user to another is pretty easy
> to do
> manually but copying them, not so much. So, I wrote some functions to
> copy and move buckets from one user to another. I figured I would
> share
> them in case someone else finds them useful.
>
> They are in the files attached to this message. One is a support
> function used by the other four. These functions only cover the bib
> record and copy buckets since those are the only bucket types we are
> using in our database at the moment. Making new functions to handle
> the
> other two bucket types (user and call number) using these functions as
> templates should be fairly straightforward.
>
> To load these in to your database so you can make use of them, you
> would
> need to change all of the *CHANGEME* strings in each file to the
> name of
> the schema where you want these functions to live. I put them in
> one of
> our local custom schemas.
>
> The four copy/move functions all take the same four arguments.
> First is
> the source user id. Second is the destination user id. Third is an
> optional list of bucket ids (surrounded by quotes, separated by
> commas).
> Fourth is a boolean (true or false) as to whether the third bucket
> list argument is inclusive or exclusive.
>
> I should mention that I am not an SQL expert so there may be better
> ways
> to do this. It is also possible that something like this already
> exists
> somewhere and we just missed it.
>
> Here are a few usage examples:
>
> To move all copy buckets from userid 10 to user 20:
>
> SELECT YOURSCHEMA.move_container_copy(10, 20, NULL, FALSE);
>
>
> To copy only one bib record bucket with bucket id 103:
>
> SELECT YOURSCHEMA.copy_container_bib_rec(10, 20, '103', TRUE);
>
>
> To move all copy buckets EXCEPT bucket ids 204 and 206:
>
> SELECT YOURSCHEMA.move_container_copy(10, 20, '204,206', FALSE);
>
>
> Any bucket ids specified in the third parameter need to belong to the
> source user or they wont be copied/moved.
>
> --
>
> John Merriam
> Evergreen Systems Specialist
> Bibliomation, Inc.
>
--
John Merriam
Evergreen Systems Specialist
Bibliomation, Inc.
24 Wooster Ave.
Waterbury, CT 06708
203-577-4070 x108
More information about the Open-ils-dev
mailing list