{ "query": "SELECT * FROM .. WHERE x = ?", "params": [5], "attach": [{ "user": "db_user", "database": "db_name", "alias": "short"}, ..] }From a storage system.
I don't get the Select * FROM .. WHERE. I mean, why bother with Json if it cannot express a query by itself? But what we see is the setting up for a sqlite3 execution.
It is not that I am against SQL, but when we are doing a query, the SELECT is obvious. What we have is standard: Identify data to be collect, where to get it, and what are the conditions to collect. We are shortly going to see the select from where get embedded, a natural result of looking for somethhing, It takes time, it is something the Json crew has to think about.
@{*,user:Myname.graph:MyGraph}
Will run the wild card collector over the graph Myname.Mygraph. Convolve the query and the target. Json has to introduce the convolution operator, they can run but they can't hide.
I still don't see why we have the [] brackets. Arrays are understood to be the other thing than a document. Just use the comma.
My final point, is why send Json queries as part of the header, just tell the destination the content is Json and ship it. The entire transfer of Json/Bson is a transfer of consistent units, whether query or insertion. If the server doesn't get Json, screwing around with Http headers won't help.
Here is my routine for handling headers, all 14 lines of code. Why is the industry still fooling with Http headers?
#define JSON_TYPE "POST\r\nContent-Type:text/json\n\rContent-Length:" #define BSON_TYPE "POST\r\nContent-Type:text/bson\n\rContent-Length:" #define MAGIC_SIZE sizeof(JSON_TYPE) #define HEADER_SIZE (MAGIC_SIZE+12) int header_magic(int newfd,int * count) { char inbuffer[HEADER_SIZE]; int rv; int type;int i; type = -1; rv = read(newfd, inbuffer, HEADER_SIZE); if(rv != -1 && rv == HEADER_SIZE) { if(!strncmp(inbuffer,JSON_TYPE,MAGIC_SIZE)) type = 1; else if(!strncmp(inbuffer,BSON_TYPE,MAGIC_SIZE)) type = 0; } if(type != -1) sscanf(inbuffer+ MAGIC_SIZE,"%8d",count); else *count=0; return (type); }
1 comment:
it is definitely my hornor to get a view for your weblog,it is excellent.
Post a Comment