Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Row, row, row your bits, gently down the stream...


programming / comp.lang.smalltalk.dolphin / Re: Clean way to handle multi-keyed tables in ReStore

SubjectAuthor
* Clean way to handle multi-keyed tables in ReStoreScott McWilliams
`* Re: Clean way to handle multi-keyed tables in ReStorejohn.a...@gmail.com
 `- Re: Clean way to handle multi-keyed tables in ReStoreScott McWilliams

1
Subject: Clean way to handle multi-keyed tables in ReStore
From: Scott McWilliams
Newsgroups: comp.lang.smalltalk.dolphin
Date: Thu, 4 Nov 2021 20:23 UTC
X-Received: by 2002:ac8:4155:: with SMTP id e21mr55446015qtm.312.1636057415510;
Thu, 04 Nov 2021 13:23:35 -0700 (PDT)
X-Received: by 2002:a9d:37a2:: with SMTP id x31mr4472259otb.339.1636057415362;
Thu, 04 Nov 2021 13:23:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Thu, 4 Nov 2021 13:23:35 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=98.195.153.189; posting-account=UYtTcwoAAABQV700HQ2QW4xbagv2F8m2
NNTP-Posting-Host: 98.195.153.189
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <19ce56af-15a8-4a35-88db-a5bda3dca842n@googlegroups.com>
Subject: Clean way to handle multi-keyed tables in ReStore
From: scottmcw...@gmail.com (Scott McWilliams)
Injection-Date: Thu, 04 Nov 2021 20:23:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
View all headers
Does anyone have any suggestions on how to handle multi-keyed records cleanly in ReStore?  I've used a unique integer as a surrogate key in the past, and  I know you can use defineAsID: for single keys including strings, but I need to do something where a record has a string name _and_ a numeric version (separate from the _version provided by ReStore) so the version can be incremented by the user when they choose to do so, so it appears something like this in the DB:

NAME      VERSION     ...
TEST_1    1

The _version field could be any value depending on how many changes have been made to the object, but the VERSION field could remain at 1 until explicity versioned by the user.

Any ideas greatly appreciated.

Thanks,
Scott


Subject: Re: Clean way to handle multi-keyed tables in ReStore
From: john.a...@gmail.com
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 5 Nov 2021 09:15 UTC
References: 1
X-Received: by 2002:a05:620a:2403:: with SMTP id d3mr21138713qkn.352.1636103731087;
Fri, 05 Nov 2021 02:15:31 -0700 (PDT)
X-Received: by 2002:a9d:7359:: with SMTP id l25mr1342569otk.320.1636103730751;
Fri, 05 Nov 2021 02:15:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 5 Nov 2021 02:15:30 -0700 (PDT)
In-Reply-To: <19ce56af-15a8-4a35-88db-a5bda3dca842n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=85.203.71.185; posting-account=OQ6sIwoAAAC1iWrFEUhdmRsgEkeDOgOm
NNTP-Posting-Host: 85.203.71.185
References: <19ce56af-15a8-4a35-88db-a5bda3dca842n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8fd114ab-2017-4510-8ee9-cad8b071292dn@googlegroups.com>
Subject: Re: Clean way to handle multi-keyed tables in ReStore
From: john.asp...@gmail.com (john.a...@gmail.com)
Injection-Date: Fri, 05 Nov 2021 09:15:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 44
View all headers
Hi Scott,

Are you saying the string name and numeric version form a composite key? i.e. there could be more than one record with the same name, but they'd all have different versions? ReStore doesn't currently support composite keys (keys consisting of multiple instance variables/fields) so you'd need to find another way to handle this unfortunately.

Note there's been a recent enhancement to ReStore to allow more flexibility in primary key types, mainly to accommodate GUID/UUID keys but also others e.g. Strings (I don't *think* ReStore previously supported String keys, at least if it did it was accidental). These haven't been added to the documentation yet but the relevant test classes should provide some clues - see SSWReStoreAlternativeIDTest and subclasses. Also see implementors of the following methods:

reStoreIDClass
reStoreNewUniqueID
reStoreNewUnique

Hope this helps.

John


On Thursday, November 4, 2021 at 8:23:36 PM UTC, Scott McWilliams wrote:
Does anyone have any suggestions on how to handle multi-keyed records cleanly in ReStore? I've used a unique integer as a surrogate key in the past, and I know you can use defineAsID: for single keys including strings, but I need to do something where a record has a string name _and_ a numeric version (separate from the _version provided by ReStore) so the version can be incremented by the user when they choose to do so, so it appears something like this in the DB:

NAME VERSION ...
TEST_1 1

The _version field could be any value depending on how many changes have been made to the object, but the VERSION field could remain at 1 until explicity versioned by the user.

Any ideas greatly appreciated.

Thanks,
Scott


Subject: Re: Clean way to handle multi-keyed tables in ReStore
From: Scott McWilliams
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 5 Nov 2021 12:25 UTC
References: 1 2
X-Received: by 2002:ac8:5e4e:: with SMTP id i14mr60775265qtx.129.1636115157302;
Fri, 05 Nov 2021 05:25:57 -0700 (PDT)
X-Received: by 2002:a05:6808:19a6:: with SMTP id bj38mr1338461oib.69.1636115157048;
Fri, 05 Nov 2021 05:25:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 5 Nov 2021 05:25:56 -0700 (PDT)
In-Reply-To: <8fd114ab-2017-4510-8ee9-cad8b071292dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.195.153.189; posting-account=UYtTcwoAAABQV700HQ2QW4xbagv2F8m2
NNTP-Posting-Host: 98.195.153.189
References: <19ce56af-15a8-4a35-88db-a5bda3dca842n@googlegroups.com> <8fd114ab-2017-4510-8ee9-cad8b071292dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <00f50e09-b04c-4965-ada8-7489805ff503n@googlegroups.com>
Subject: Re: Clean way to handle multi-keyed tables in ReStore
From: scottmcw...@gmail.com (Scott McWilliams)
Injection-Date: Fri, 05 Nov 2021 12:25:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 60
View all headers
On Friday, November 5, 2021 at 4:15:31 AM UTC-5, john.a...@gmail.com wrote:
Hi Scott,

Are you saying the string name and numeric version form a composite key? i.e. there could be more than one record with the same name, but they'd all have different versions? ReStore doesn't currently support composite keys (keys consisting of multiple instance variables/fields) so you'd need to find another way to handle this unfortunately.

Note there's been a recent enhancement to ReStore to allow more flexibility in primary key types, mainly to accommodate GUID/UUID keys but also others e.g. Strings (I don't *think* ReStore previously supported String keys, at least if it did it was accidental). These haven't been added to the documentation yet but the relevant test classes should provide some clues - see SSWReStoreAlternativeIDTest and subclasses. Also see implementors of the following methods:

reStoreIDClass
reStoreNewUniqueID
reStoreNewUnique

Hope this helps.

John
On Thursday, November 4, 2021 at 8:23:36 PM UTC, Scott McWilliams wrote:
Does anyone have any suggestions on how to handle multi-keyed records cleanly in ReStore? I've used a unique integer as a surrogate key in the past, and I know you can use defineAsID: for single keys including strings, but I need to do something where a record has a string name _and_ a numeric version (separate from the _version provided by ReStore) so the version can be incremented by the user when they choose to do so, so it appears something like this in the DB:

NAME VERSION ...
TEST_1 1

The _version field could be any value depending on how many changes have been made to the object, but the VERSION field could remain at 1 until explicity versioned by the user.

Any ideas greatly appreciated.

Thanks,
Scott
Hi John,

Thanks for your reply.  Yes, the scenario involves a composite key.  I have it working using a 'versions' table but it's rather klugey at the moment, so I was hoping for something a bit more elegant.

No worries.  I have the latest version of ReStore and have been looking at the methods you mentioned in order to revise my code to use strings as primary keys (where applicable) along with the versioning I already have.  That new capability will make things a bit cleaner for me and better suit the situation for users as well.

Thanks again for all your great work!

Regards,
Scott


1
rocksolid light 0.7.2
clearneti2ptor