You are not logged in.
Pages: 1
now, our Httpserver only return other fields data ,not including TSQLRawblob field.
now return data,
when we input "http://localhost:8080/root/SampleRecord/1" in the IE address,only can get
{"ID":1,"Time":"2010-07-12T09:13:49","Name":"q","Question":"wwwww"}
i hope can get return string like
{"ID":1,"Time":"2010-07-12T09:13:49","Name":"q","Question":"wwwww","wave":"000304050607080901a3a4fe"}
Wave is TSQLRawBlob field.
or how to do ?
PS: our httpserver have strictly limited Httprequsts; like "http://localhost:8080.." will repose. if like "localhost:8080.."will not work .
Last edited by longge007 (2010-07-12 03:27:12)
Offline
As I said in previous posts, the blob fields must be retrieved or set by the specific Blob related methods.
The blob field values are not retrieved within JSON data.
ok,i do something by myself to realize some special functions.
Offline
In SQLlit3 ,the Blob field is saveed as X'0000' string format, and i think in C/S model, we can use retrieve or Update funcions,
In Ajax,i think the string format or your RawUTF8 should be return. thus it's very usefulto some special application.
Let us suppose, there is an Array :
var Wave: array[0..2048] of single; //like [100.56,20.33,...]
.if i want to save it in SQLite3 database, only in delphi TBlob type or Framework TSQLRawBlob,it occupy about 2048*4,but if i want to get in Ajax ,i can only save it in string type, '100.56,20.33,.....'if we do so, the Wave data will occupy >2048*4 at least.
if you have time to write a New class to hanle Ajax request TSQLRawBlob in order to get RawUTF8 type Data in client or give some good ideas, i want to have this function.
thanks a lot.
PS: if Client request is Http://127.0.0.1/root/TSQLtable/ID, thus Server think it's an Ajax request,retun Json format Data
if Client retuest is 127.0.0.1/root/TSQLtable/ID, thus Server think it's an Client ask,reutan TSQLRecord.
Last edited by longge007 (2010-07-14 08:49:01)
Offline
I'm still not sure it's 100% RESTful. For example, CouchDB (quite a reference) don't include blob fields to the standard content.
About size, TSQLRawBlob and or direct request will use 2048*4 for your Wave data. If you use JSON format data, it will be hexadecimal encoded, so it'll be 2048*4*2 byte long.
What is wrong with retrieving blob content from a separate AJAX request? It's much more elegant. And I'm sure the browser prefer it against receiving Hexa data, and convert all this hexa into decimal...
Offline
a separate Ajax Request?
Yeah,you have said the restful did't support TBlobfield,i Mean how to get the TBlob field in Ajax http Request ,the return is hexstring format.
for example, Hex is 00010203,and ie brower return in string format '00010203',if so ,i can get something whant i want.
Last edited by longge007 (2010-07-15 03:42:49)
Offline
As I previously said, to get the blob content, use Http://127.0.0.1/root/TSQLtable/ID/BlobFieldName URL
Offline
As I previously said, to get the blob content, use Http://127.0.0.1/root/TSQLtable/ID/BlobFieldName URL
ok,thanks a lot, next i can do more with SQLite3 Framework.
Offline
in Ajax request,
how to handle Response,
with, responseBody,responseText,responseStream?
Last edited by longge007 (2010-07-15 08:42:43)
Offline
it depends on the JavaScript framework to use, and what you want to do with your data
I'd say that responseStream is prefered, because the response is a raw bytes content.
Returned Mime type depends on the content: our framework is able to guess most picture types (like PNG, GIF, JPEG) and documents (ZIP DOC XLS RAR 7Z PDF) from the blob content itself. But if you use a Blob to store a picture, you can use this url do directly display it in html like <img src=http://server/root/TSQLTable/ID/PictureBlob>
Offline
thanks a lot ,
you know i have stored aWave:array[0..2047] of single Data in TSQLRawBlob filed.
Now in Javascript Framework i defined an Array [var MyWave=new Array()] , to store the SQLirte3 Framework's TBlob field. now i don't know how to translate Awave Data into my wanted Mywave in Javascript.
and set Mime type into what ? application/octet-stream or others?
In past my application use our customized database,and which is used more in C/S mode.whose interface is not good,In order to support B/s ,we write ISAPI to ruturn string.Recently i Learned you writed opened SQLite3 Framework, it's very good for me to rewrite my application to support C/S and B/S easily.
thanks your hard work
Last edited by longge007 (2010-07-15 13:21:28)
Offline
A JavaScript array of numbers is not the same as single....
I think you'll have to use a single to text conversion in the Delphi server.
I'll implement today an easy way of adding remote custom queries, which could retrieve the data the way you want it (i.e. numerical text in your case).
Offline
A JavaScript array of numbers is not the same as single....
I think you'll have to use a single to text conversion in the Delphi server.
I'll implement today an easy way of adding remote custom queries, which could retrieve the data the way you want it (i.e. numerical text in your case).
i'm expecting your new queries.
Offline
Framework updated, with a new mechanism to handle custom requests, DataSnap-like:
see http://synopse.info/forum/viewtopic.php?pid=233
There is a sample which returns a blob field content of a record as hexadecimal, JSON encoded.
Offline
Pages: 1