Download Jar. Libraryless. Click here for Pure Java version (8006L/54K).
!7 concept BigEntry { S globalID; long fileNr, headerStart, start, length; } p { dbIndexing(BigEntry, 'globalID); S s = "Hello world"; BigEntry entry = db_newStringEntry(s); print("Stored as: " + renderConcept(entry)); assertEqualsVerbose(s, db_getText(entry)); print("OK"); } static BigEntry db_newStringEntry(S text) { lock dbLock(); long fileNr = fileNrToAppendTo(); S globalID = aGlobalID(); File file = db_file(fileNr); long length = fileSize(file); long l = lUtf8(text); S header = globalID + " " + l + "\n"; long start = length + lUtf8(header); appendToTextFile(file, header + text + "\n"); ret cnew(BigEntry, +globalID, +fileNr, headerStart := length, +start, length := l); } static long fileNrToAppendTo() { ret 1; } static File db_file(long nr) { ret getProgramFile("db." + nr); } static S db_getText(BigEntry entry) { File f = db_file(entry.fileNr); ret fromUtf8(loadBinaryFilePart(f, entry.start, entry.start+entry.length)); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1010406 |
| Snippet name: | Bigger-Than-RAM DB v1 [OK] |
| Eternal ID of this version: | #1010406/4 |
| Text MD5: | 0586623e50acbf1012ef5be8c52d8050 |
| Transpilation MD5: | 6bdccc3df973fd99b781a104cfe1e8d3 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-09-15 18:35:53 |
| Source code size: | 1032 bytes / 42 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 764 / 1618 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |