Commit graph

285 commits

Author SHA1 Message Date
Tobie Morgan Hitchcock
1d988760b3 Update for go@1.11 2019-02-01 00:14:59 +00:00
Tobie Morgan Hitchcock
775c3ca96a Enable DEFINE EVENT queries in exported SQL 2019-02-01 00:13:24 +00:00
Tobie Morgan Hitchcock
71192d2e36 Improve ORDER BY COLLATE queries 2019-02-01 00:12:10 +00:00
Tobie Morgan Hitchcock
ef9c73d4d7 Make SQL parser stateless 2019-01-31 12:38:23 +00:00
Tobie Morgan Hitchcock
26a2c01a9c Remove unused SQL types 2019-01-31 09:52:15 +00:00
Tobie Morgan Hitchcock
7c962f7bdc Add SQL OPTION query statement 2019-01-31 09:47:52 +00:00
Tobie Morgan Hitchcock
62f02015ba Remove custom PARALLEL config support from queries 2019-01-23 00:16:46 +00:00
Tobie Morgan Hitchcock
efeb186200 Ensure all fibre.Contexts have a unique socket id 2019-01-14 16:03:38 +00:00
Tobie Morgan Hitchcock
719bd98544 Use constant string for access all array items 2019-01-13 20:39:32 +00:00
Tobie Morgan Hitchcock
971302ecf5 Implement SPLIT keyword in SELECT statement 2019-01-11 11:17:43 +00:00
Tobie Morgan Hitchcock
b901c78bd1 Ensure test is correct for unique indexes 2019-01-07 13:45:40 +00:00
Tobie Morgan Hitchcock
0402d74708 Remove AND EXPUNGE clause from DELETE expression
When deleting records, it now removes and expunges document versions based on the table definition `DEFINE TABLE test VERSIONED` or `DEFINE TABLE test UNVERSIONED`, as opposed to the query being run. This prevents non-administrators from removing historic document data.
2018-12-31 07:46:44 +01:00
Tobie Morgan Hitchcock
f089dc4d7f Ensure document permissions are rechecked after updating 2018-12-31 07:46:12 +01:00
Tobie Morgan Hitchcock
a8f9198695 Fix comment 2018-12-30 23:02:12 +01:00
Tobie Morgan Hitchcock
9819b64dc6 Ensure unique indexes work with record ids 2018-12-13 02:05:23 +00:00
Tobie Morgan Hitchcock
30639a1ae9 Improve SQL INFO command 2018-10-24 11:29:43 +01:00
Tobie Morgan Hitchcock
20abadf41f Support exporting SQL LOGIN and SQL TOKEN hashes 2018-10-18 01:36:36 +01:00
Tobie Morgan Hitchcock
e52f0d3243 Implement basic executor caching layer 2018-09-28 22:06:07 +01:00
Tobie Morgan Hitchcock
918c696eb1 Complete functionality to define scope tokens 2018-09-13 17:34:27 +01:00
Tobie Morgan Hitchcock
41c2fd0b3e Add scope tokens to SQL INFO queries 2018-09-13 16:08:52 +01:00
Tobie Morgan Hitchcock
44d2fc129f Ensure all byte slices are converted to strings 2018-08-21 11:39:12 +01:00
Tobie Morgan Hitchcock
c91164bc93 Ensure all number types are converted to floats 2018-08-20 08:54:23 +01:00
Tobie Morgan Hitchcock
bf4659d8f9 Add SQL export functionality 2018-08-20 07:53:11 +01:00
Tobie Morgan Hitchcock
8b0674c66d Add support for table versioning 2018-08-20 07:52:13 +01:00
Tobie Morgan Hitchcock
de925ae16e Ensure full duration values are parsed correctly 2018-08-20 07:32:21 +01:00
Tobie Morgan Hitchcock
31ad063ef4 Encode and decode when copying a document 2018-08-20 01:06:52 +01:00
Tobie Morgan Hitchcock
a3787ad274 Simplify and improve internal SQL AST structures 2018-08-20 00:21:35 +01:00
Tobie Morgan Hitchcock
c7ae796275 SQL statements now run in serial mode by default 2018-08-10 19:16:42 +01:00
Tobie Morgan Hitchcock
48df950be5 Remove mysql kvs storage backend 2018-08-08 08:21:42 +01:00
Tobie Morgan Hitchcock
2932bac73e Enable subqueries in CREATE / UPDATE / RELATE / DELETE queries 2018-07-17 09:56:31 +01:00
Tobie Morgan Hitchcock
0e4557bdd3 Remove unused code 2018-07-12 02:49:35 +01:00
Tobie Morgan Hitchcock
ba40fd7285 Enable $this parameter in SELECT queries
It is now possible to select yielded output fields in the same query, without needing to use a subquery.
2018-05-31 14:34:39 +01:00
Tobie Morgan Hitchcock
ddefed03e6 Don’t allow use of $ param with no value in queries
Beforehand it was possible to do  SELECT * FROM $  which would show all of the variables defined. This is now not possible, and variables must be specified using their defined name.
2018-05-30 19:06:48 +01:00
Tobie Morgan Hitchcock
ba4f3c7e15 Simplify permissions fetching code 2018-05-30 13:25:42 +01:00
Tobie Morgan Hitchcock
295285707e Don’t use a cookie for unique Session ID 2018-05-14 02:37:49 +01:00
Tobie Morgan Hitchcock
e120f8961c Add server-generated session info to queries 2018-05-12 23:46:01 +01:00
Tobie Morgan Hitchcock
c8980e2eac Remove connection wide variables 2018-05-09 23:09:51 +01:00
Tobie Morgan Hitchcock
0615896c0e Add timeout errors to json output 2018-05-09 22:52:47 +01:00
Tobie Morgan Hitchcock
5442861cb8 Enable global ENV variable to detect environment 2018-05-09 04:08:04 +01:00
Tobie Morgan Hitchcock
ebd5680b7d Don’t display live queries in SQL INFO statements 2018-05-08 18:53:21 +01:00
Tobie Morgan Hitchcock
e3bea0a897 Use context.Context on all kvs requests 2018-05-02 03:05:03 +01:00
Tobie Morgan Hitchcock
b7d89ee65a Add support for foreign tables with group by clauses 2018-05-02 02:43:04 +01:00
Tobie Morgan Hitchcock
7f6d1565ff Enable ability to set a global query timeout duration 2018-05-02 02:42:16 +01:00
Tobie Morgan Hitchcock
9f0ea3ee61 Improve database query logging 2018-05-02 02:32:06 +01:00
Tobie Morgan Hitchcock
47e1a4aceb Fix a bug with virtual records in scoped queries
When querying a virtual document, it would check that the scope had permission to view the record, even though the record did not actually belong to a table.

Not it checks to see if the record is a virtual in-memory record, and does not perform any permissions checks if this is the case.
2018-05-01 13:17:10 +01:00
Tobie Morgan Hitchcock
f5a0739985 Add foreign table information to SQL INFO query 2018-04-28 22:08:34 +01:00
Tobie Morgan Hitchcock
ec8ece9878 Remove for loop from mutex 2018-04-28 22:08:19 +01:00
Tobie Morgan Hitchcock
f335d71aba Move to channel based mutex 2018-04-28 20:35:20 +01:00
Tobie Morgan Hitchcock
99d050b238 Ensure linked records are fetched using the same query version 2018-04-28 20:35:19 +01:00
Tobie Morgan Hitchcock
14c0d93635 Ensure arrays and objects are always set 2018-04-27 15:23:58 +01:00
Tobie Morgan Hitchcock
ec6a44f2d6 Regenerate codec files 2018-04-27 00:46:43 +01:00
Tobie Morgan Hitchcock
444a38986a Ensure field permissions are correctly applied 2018-04-27 00:40:59 +01:00
Tobie Morgan Hitchcock
eb62515a05 Ensure that fields are not removed when set to NULL 2018-04-27 00:40:36 +01:00
Tobie Morgan Hitchcock
9b03178dfd Improve live query performance and simplicity 2018-04-27 00:04:36 +01:00
Tobie Morgan Hitchcock
5d5fdc296f Include nested fields in SQL INFO query output 2018-04-25 00:55:49 +01:00
Tobie Morgan Hitchcock
a62797e7da Prevent race conditions in live query socket notifications 2018-04-25 00:01:29 +01:00
Tobie Morgan Hitchcock
672d298e7e Make db package more efficient 2018-04-25 00:00:36 +01:00
Tobie Morgan Hitchcock
ae303d062c Add FETCH expressions to LIVE SELECT queries 2018-04-24 23:59:49 +01:00
Tobie Morgan Hitchcock
47ef2de60f Prevent concurrent record edits and race conditions 2018-04-24 17:11:12 +01:00
Tobie Morgan Hitchcock
db9534a2d6 Ensure empty arrays / objects are equal to EMPTY 2018-04-24 15:58:45 +01:00
Tobie Morgan Hitchcock
fa1061b3a5 Use query version time from executor not document 2018-04-24 15:57:41 +01:00
Tobie Morgan Hitchcock
add47a5ada Ensure correct ordering with same-compare values 2018-04-24 15:54:50 +01:00
Tobie Morgan Hitchcock
11a9fa05e6 Prevent race conditions in when fetching document fields 2018-04-24 13:53:15 +01:00
Tobie Morgan Hitchcock
27a5f785fd Change ERR_KV to ERR_EX for ‘record already exists’ errors 2018-04-23 09:12:00 +01:00
Tobie Morgan Hitchcock
1f30035899 Add SQL FETCH functionality to SELECT statements 2018-04-22 00:10:52 +01:00
Tobie Morgan Hitchcock
35047ce04c Improve remote array record fetching 2018-04-22 00:10:51 +01:00
Tobie Morgan Hitchcock
fb256df42b Prevent infinite loops with nested subqueries 2018-04-20 23:40:52 +01:00
Tobie Morgan Hitchcock
d2a451345a Don’t alter subquery RETURN type
Don’t alter the RETURN type for CREATE / UPDATE / DELETE / RELATE / INSERT / UPSERT statements. Not only does this cause unexpected behaviour, but it also altered the statement from multiple goroutines, and therefore caused a data race.
2018-04-20 23:35:32 +01:00
Tobie Morgan Hitchcock
459c7264ec Don’t enable array lengths fetch using data paths 2018-04-20 21:33:13 +01:00
Tobie Morgan Hitchcock
8d11027788 Fix bug in downstream cork package
A bug in the cork encoding package prevented encoding of large maps or arrays.
2018-04-20 16:40:40 +01:00
Tobie Morgan Hitchcock
83edea8a66 Don’t fetch right side of AND / OR statements if not necessary 2018-04-20 00:17:13 +01:00
Tobie Morgan Hitchcock
c4f8448345 Ensure session wide variables are available on a live query context 2018-04-19 13:36:08 +01:00
Tobie Morgan Hitchcock
4d155c61ce Only run events when the document has changed 2018-04-19 13:36:04 +01:00
Tobie Morgan Hitchcock
e8accd1b8e Enable limiting the maximum number of query workers 2018-04-18 15:49:32 +01:00
Tobie Morgan Hitchcock
07d52831d0 Improve tests for DEFINE EVENT db queries 2018-04-18 15:27:51 +01:00
Tobie Morgan Hitchcock
cf68ebffb1 Improve DB error message types 2018-04-18 15:27:21 +01:00
Tobie Morgan Hitchcock
6fe4db6a58 Check permissions on the initial document when deleting
When deleting a document, we need to check the visibility permissions using the initial document, as the current document will now have been emptied. As a result, no delete notifications were being delivered to LIVE queries.
2018-04-15 01:53:36 +01:00
Tobie Morgan Hitchcock
49ec33987f Update generated code 2018-04-14 21:59:16 +01:00
Tobie Morgan Hitchcock
7602b77c6d Store regex values in special sql.REGEX type 2018-04-14 21:56:29 +01:00
Tobie Morgan Hitchcock
dc700c34f6 Update 3rd party package dependencies 2018-04-14 19:24:25 +01:00
Tobie Morgan Hitchcock
bc31140308 Improve live query notification delivery 2018-04-14 19:20:15 +01:00
Tobie Morgan Hitchcock
677767d85b Ensure sockets are deregistered on disconnect 2018-04-14 19:17:07 +01:00
Tobie Morgan Hitchcock
67cfca04b9 Enable permissions on individual document fields 2018-04-14 19:14:47 +01:00
Tobie Morgan Hitchcock
2a74759a71 Enable IF and RUN statements in MultStatements 2018-04-14 18:36:28 +01:00
Tobie Morgan Hitchcock
6354d0ce2a Fix comment typos 2018-04-14 18:02:58 +01:00
Tobie Morgan Hitchcock
ac19b552e5 Add SQL RUN query statement type 2018-04-14 17:55:05 +01:00
Tobie Morgan Hitchcock
ea1749f03f Split DB event processing code into separate file 2018-04-13 21:15:38 +01:00
Tobie Morgan Hitchcock
3f7d7fc863 Add fuzzy string search to conditional SQL clauses 2018-04-13 20:34:52 +01:00
Tobie Morgan Hitchcock
9b4ff941b6 Ensure events are run with DB level permissions 2018-04-10 07:19:22 +01:00
Tobie Morgan Hitchcock
93b11514c5 Move db.yield code into separate file 2018-04-10 07:18:25 +01:00
Tobie Morgan Hitchcock
be832029a7 Remove google and syslog logging 2018-04-05 08:51:44 +01:00
Tobie Morgan Hitchcock
0dc9ad339c Enable multiple expressions with database events
It is now possible to run multiple query expressions when an event on a table has occured. Query expressions can be separated with a semicolon, and will be run in the same transaction as the main query.
2018-04-04 19:20:07 +01:00
Tobie Morgan Hitchcock
86a911b4a8 Improve tests for DB indexes 2018-04-04 19:16:32 +01:00
Tobie Morgan Hitchcock
7c39c99bf3 Ensure correct index values are inserted 2018-04-01 00:33:51 +01:00
Tobie Morgan Hitchcock
160986cc0b Shorten test timeout time to prevent test failure 2018-03-19 11:35:31 +00:00
Tobie Morgan Hitchcock
b4a8f10cdc Ensure query variables are consistent
All request variables which are assigned to an sql query are now specified in one location, ensuring that they are consistent and always present for all queries.
2018-03-18 21:38:21 +00:00
Tobie Morgan Hitchcock
ad4adbd986 Enable select * data from a foreign thing / record 2018-03-18 21:33:26 +00:00
Tobie Morgan Hitchcock
ca392f87a7 Add ON SIGNUP and ON SIGNIN events to SQL SCOPE
It is now possible to run queries when a user signs-up or signs-in, by specifying multiple queries within an ON SIGNUP (…) clause, or a ON SIGNIN (...) clause.
2018-03-18 21:30:02 +00:00
Tobie Morgan Hitchcock
069baf71b7 Empty strings now match an EMPTY sql clause 2018-02-17 09:23:51 +00:00
Tobie Morgan Hitchcock
87cf68b213 Don’t log context auth data 2018-02-14 15:48:55 +00:00