SLSqlEndpoint.sleela
lib/web-server-technology/SLSqlEndpoint.sleela · 97 line(s) · sleela
<< lib/web-server-technology/SLSqlEndpoint.sleela
SLeeLa Standard Library Definition.
Definition: Defines the SLeeLa standard-library type SLSqlEndpoint, the
SLeeLa-side model of the dynamic /db route that executes SQL against the
CSV-backed SLeeLa SQL engine and returns JSON. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
< Family: web-server-technology. Native implementation crosses an explicit VM/OS bridge. >
class SLSqlEndpoint {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 11642;
String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
String metaDate = "2026-10-26";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-26";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 8;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "RFC 8259 (JSON interchange format)";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< ---- Endpoint policy (mirrors db_endpoint in the native server) ---- >
< Route prefix served by this endpoint. >
String routePrefix;
< When true, mutating statements are permitted; otherwise read-only. >
boolean writable;
< Maximum SQL text length accepted, in bytes. Native bound is 8192. >
int maxStatementBytes;
< Maximum rows serialized into a single JSON response. Native bound is 10000. >
int maxRows;
void configure(String prefix) {
routePrefix = prefix;
writable = false;
maxStatementBytes = 8192;
maxRows = 10000;
}
String getRoutePrefix() { return routePrefix; }
void allowWrites() { writable = true; }
boolean writesAllowed() { return writable; }
void setMaxStatementBytes(int n) { maxStatementBytes = n; }
int getMaxStatementBytes() { return maxStatementBytes; }
void setMaxRows(int n) { maxRows = n; }
int getMaxRows() { return maxRows; }
< Classify whether a leading keyword is a read-only verb. Mirrors the native >
< statement_is_readonly policy: SELECT, SHOW, and the fluent from()/tables() >
< forms are reads; everything else is a mutation. >
boolean isReadOnlyVerb(String verb) {
if (verb == "select") return true;
if (verb == "show") return true;
if (verb == "from") return true;
if (verb == "tables") return true;
return false;
}
< Decide whether a statement with the given leading verb is permitted under >
< the current policy. >
boolean permits(String verb) {
if (isReadOnlyVerb(verb)) return true;
return writable;
}
String serviceName() { return "SLSqlEndpoint"; }
}