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

Addressable pages for every row in a table #1

Closed
simonw opened this issue Oct 23, 2017 · 6 comments
Closed

Addressable pages for every row in a table #1

simonw opened this issue Oct 23, 2017 · 6 comments

Comments

@simonw
Copy link
Owner

simonw commented Oct 23, 2017

/database-name-7sha256/table-name/compound-pk
/database-name-7sha256/table-name/compound-pk.json

Tricky part will be figuring out what the private key is - especially since it could be a compound primary key and it might involve different data types.

@simonw
Copy link
Owner Author

simonw commented Oct 23, 2017

I also need to solve for weird primary keys. If it’s a single integer or a single char field that’s easy. But what if it is a compound key with more than one chat field? What delimiter can I use that will definitely be safe?

Let’s say I use hyphen. Now I need to find a durable encoding for any hyphens that might exist in the key fields themselves.

How about I use URLencoding for every non-alpha-numeric character? That will turn hyphens into (I think) %2D. It should also solve for unicode characters, but it means the vast majority of keys (integers) will display neatly, including a compound key of eg 5678-345

@simonw
Copy link
Owner Author

simonw commented Oct 23, 2017

Table rendering logic needs to detect the primary key field and turn it into a hyperlink. If there is a compound primary key it should add an extra column at the start of the table which displays the compound key as a link

@simonw simonw added this to the Ship v1 milestone Oct 23, 2017
@simonw
Copy link
Owner Author

simonw commented Oct 24, 2017

I can find the primary keys using:

PRAGMA table_info(myTable)

@simonw
Copy link
Owner Author

simonw commented Oct 24, 2017

Some tables won't have primary keys, in which case I won't generate pages for individual records.

@simonw
Copy link
Owner Author

simonw commented Oct 24, 2017

I'm going to use , as the separator between elements of a compound primary key. If those elements themselves include a comma I will use %2C in its place.

simonw pushed a commit that referenced this issue Oct 24, 2017
Refs #1 - only exists for tables with introspectable primary keys.

Still need to link to this page.

Also added first unit tests - refs #9
@simonw
Copy link
Owner Author

simonw commented Oct 24, 2017

Next step: generate links to these.

@simonw simonw closed this as completed in b46e370 Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant