You are not logged in.
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.
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
in Ajax request,
how to handle Response,
with, responseBody,responseText,responseStream?
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.
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.
![]()
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.
1. The insert command won't work: it will say to you an unknown table error, because statictable is not known by SQLite3 (it's internal to the framework)...
yeah, you are right, the Insert command don't work.
ok,i think i still use normal access to handle it.
thanks a lot
ok,thanks a lot,
because my realtime table have about 20000 Records.i can use Update()* the static table , and In client use
INSERT INTO historytable select * from static table at first.I worry about it will occupy pc resource, perhaps i should test httpserver's performace and ask question![]()
i don't know whether or not the Httpserver can work as not only a Memorydb not but also holddiskDb?
there are some good uses.
1)Realtime data only process in Memory Db
2)historytime data saved in holddiskDB.
Sir, do you have some good ideas?
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.
No external dll is necessary. You may have an invalid database file content.
thanks your quick relpy
Let me check it.
i find the wrong when I copy it on the Desktop, an Error occurs ,perhaps in the program it does't support longfile name
so i copy it in one holddisk directory,it's all right
In delphi Component the TBatchMove or Like Devart componet CRBatchMove can append/update/delete and so on. i think it's good to handle more records in Clients.In Client it can update/append the table in the RemotePc once.
i don't kwow whether our Framework have the same or similar functions .
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 .
When i copy compiled project04Server.exe into other pc. it can't run for Error Invalid SQLite3 Database handle(14)
if copy the whole directoty Including Synopse Framework ,it will be running right.
i want to know what are neccessary for Server running.
thanks a lot, TSQLRest is a genaral Class, TSQLite3HttpClient and TSQLRestClientURI are subclasses.i only learn your example,not think more.
yeah,i need to learn more about classes.
[DCC Error] Unit1.pas(128): E2003 Undeclared identifier: 'ExecuteList'
at first i want to use Database to EXecuteList.
Database does't support this functions,ExecueList is declared in childclass TSQLRestClientURI, In the Class of TSQLRest haven't this funcitons.
I have added these codes,Initialized the cli
Cli:=TSQLRestClientURI.Create(Model);
SQLstr:='select samplerecord.name,Inspectrecord.IR_time from samplerecord,Inspectrecord';
ResultJson:=Cli.ExecuteList([TSQLSampleRecord,TSQLInspectRecord],SQLstr);
if ResultJson<>nil then
try
edit3.Text:=inttostr(ResultJson.RowCount);
finally
ResultJson.Free;
end;i debug and trace it. **with URI(Model.Root,'GET',@Resp,nil,@SQL) do** here is the same Error [Abstrac Error]
SQLite3HTTpServer is a stand alone server: it does'nt need any additional http server (like IIS, Apache).
TFastCGIServer is a Fast-CGI server so it can't be used directly as a CGI Server, just as Fast-CGI. Note that most http servers do support the FastCgi protocol (you may have to install the corresponding module).
Our fastcgi implementation is not 100% tested. It was mostly a proof of concept. If you need it, I'll debug it.
thanks a lot,
when i input ''192.168.1.101:8080/root/samplerecord/1' in IE address, a file saving is return. SQLhttpserver is running fine.
now I check it In Ajax request,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script language="javascript" src="js/zxml.js"></script>
<script>
function Test(){
var oXmlHttp=zXmlHttp.createRequest(); //one Ajax Class,
var url='192.168.1.101:8080/root/samplerecord/1';
oXmlHttp.open("put",url,true);
oXmlHttp.setRequestHeader("Cache-Control","no-cache");
oXmlHttp.setRequestHeader('Content-Type', 'application/Json');
oXmlHttp.onreadystatechange=function(){
if (oXmlHttp.readyState==4){
if (oXmlHttp.status==200){
alert(oXmlHttp.responseBody);
}else{location.reload();}
}
}
oXmlHttp.send(null);
}
</script>
</head>
<body>
<input type=button value='test' onClick='Test()'/>
</body>
</html>Error info: rufuse visit in line 10:oXmlHttp.open("put",url,true);
Sir : I don't know how to use TSQLRestClientURI.ExecuteList(); check my steps:
Step1: Creat Httpclient.
Database:= TSQLite3HttpClient.Create(edit1.Text,'8080',Form1.Model);this works fine.
Stpe2. GetJson procedure
var
cli:TSQLRestClientURI;
SQLstr:string;
ResultJson:TSQLTableJSON;
begin
//My table1 is TSQLSampleRecord ,My table2 is TSQLInspectRecord
//table1 SampleRecord
//*id time name question
//*1 2010-07-09T10:40:29 a test
//*2 2010-07-09T10:40:31 b test
//*3 2010-07-09T10:40:34 c test
//*4 2010-07-09T10:40:40 d test
//*********************
//table2 InspectRecord
//*id IR_ID time Ms_Code IR_Value
//*1 1 2010-07-09T10:40:29 1000001 100.0
//*2 2 2010-07-09T10:40:33 1000003 20.0
//*3 3 2010-07-09T10:40:34 1000004 30.50
//*4 4 2010-07-09T10:40:40 2000001 40.66
//*5 5 2010-07-09T10:40:43 2000003 80.66
//*********************
SQLstr:='select SampleRecord.name,Inspectrecord.IR_Value from SampleRecord,Inspectrecord where SampleRecord.Time=Inspectrecord.IR_Time';
ResultJson:=Cli.ExecuteList([TSQLSampleRecord,TSQLInspectRecord],stringtoUTF8(SQLstr));
if ResultJson<>nil then
try
edit3.Text:=inttostr(ResultJson.RowCount);
finally
ResultJson.Free;
end;
end;what's the Matter ? there is no resultJson and have Error.
First chance exception at $75569617. Exception class EAccessViolation with message 'Access violation at address 004859C7 in module 'Project04Client.exe'. Read of address B2D88B93'. Process Project04Client.exe (2652)
thanks a lot
Sir: i want to know whether or not our SQLite3HTTpServer can be used as an CGIServer,
or thus:
TFastCgiServer.Creat()
Use ExecuteList() method on the Client side to create a TSQLTableJSON from a SQL statement. It'll be like a RecordSet.
MultiFieldValue() use this method internaly, and expect only one field request.
Multi tables Query realize in Framework
short thems:
a=adduser, b=order ,c=orderdetail.
select a.name,b.time,c.* from a,b,c
where a.userid=b.userid and b.orderid=c.orderid
where is ExecuteList() ,i can't find In Framework,Client side should use which SQLclass. please write detail. thanks a lot
var
cli:TSQLRestClientURI;
SQLstr:string;
aTables: array of TClass;
ResultJson:TSQLTableJSON;
begin
setLength(aTables,3)
aTables[0]:=TSQLadduser; aTables[1]:=TSQLorder;aTables[3]:=TSQLorderdetail;
SQLstr:='select a.name,b.time,c.* from a,b,c where a.userid=b.userid and b.orderid=c.orderid';
ResultJson:=Cli.ExecuteList(aTables,stringtoUTF8(SQLstr));
end;function TSQLRestClientURI.ExecuteList(const Tables: array of TClass;
const SQL: RawUTF8): TSQLTableJSON;
function TSQLRestClientURI.List(const Tables: array of TClass;
const SQLSelect, SQLWhere: RawUTF8): TSQLTableJSON;
These two functions can get the same results,aren't them?
get multi field values from one Table , use this function
function TSQLRest.MultiFieldValue(Table: TSQLRecordClass;
const FieldName: array of RawUTF8; var FieldValue: array of RawUTF8;
const WhereClause: RawUTF8): boolean;
i want to realize this feature like SQL
select A1,A2 from Table1 where ... or select A1 from table1,table2 where Table1.A1Table2.A1.
in our Framework
i don't know what's structure in our return Data,Can you See detail. or tell me Which function or procedure can be used.
or our Framework have one interface that can Execute SQL pamameter directly and return tabaleJson type DATA.
otherwise , I spend much time in study your source code of Framewok.
thanks a lot ,i have used it my pro.
suddenly ,i have one suggestion, our FrameWork should have an interface like SQL RecordSet .
in the Client,how to get the recordcount of one database[SampleRecord]? i looking and looking in the SQLite ,can't find one methord to realize it.
whether or not to use Select query Parameter.
thanks your quick reply ,now everything is good, ^_^。i can do more in my project with SQLite3 Framework.
one semicolon is deleted.
property Name: RawUTF8 read fName write fName stored false; // made UNIQUEsir, are you here, i want to send you one email including my samplecodes.
when add the message, an eror will occure
First chance exception at $75519617. Exception class EAccessViolation with message 'Access violation at address 00405184 in module 'Project04Client.exe'. Read of address 32C7FFF8'. Process Project04Client.exe (3996)
if you have time ,you can use my code to compile 04 httpclient and httpServer.
......
if CurrentID>0 then
Database.UpdateBlob(TSQLSampleRecord,CurrentID,stringtoUTF8('Wave'),tempStream);i don't know what's the matter ? it can't update the blob field "wave" in my Sample, can you write one example about blob field like my saveing Wave data or other pic file,and so. thanks a lot!!!
and you mentioned "CreateSQLIndex()" , i realized in HttpServer project , whether o not is right?
Model := CreateSampleModel;
DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'));
DB.CreateMissingTables(0);
DB.CreateSQLIndex(TSQLSampleRecord,'Wave',true);
Server := TSQLite3HttpServer.Create('8080',DB);I notice that Author have add some new funtions about handling blob data.like retriewblob()[get blob content] and updateblob() [updateblobcontent]
look at my codes
Table use Example sampleRecord
type
TSQLSampleRecord = class(TSQLRecord)
private
fQuestion: RawUTF8;
fName: RawUTF8;
fTime: TDateTime;
fWave: TSQLRawBlob;
published
property Time: TDateTime read fTime write fTime;
property Name: RawUTF8 read fName write fName;
property Question: RawUTF8 read fQuestion write fQuestion;
property Wave: TSQLRawBlob read fWave write fWave;
end;.................
add procedure
procedure TForm1.AddButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
AWave:array of single;
tempWave:TSQLRawBlob;
i,n:integer;
Tempstream:tHeapMemorystream;
begin
n:=15;
setLength(AWave,n);
for I := 0 to n - 1 do
AWave[i]:=Intpower(-1,i)*100*Random;
Rec := TSQLSampleRecord.Create;
try
Rec.Time := Now;
// we use explicit StringToUTF8() for conversion below
// a real application should use TLanguageFile.StringToUTF8() in SQLite3i18n
Rec.Name := StringToUTF8(NameEdit.Text);
Rec.Question := StringToUTF8(QuestionMemo.Text);
//SetString(TempWave,PAnsiChar(pointer(AWave)),length(AWave)*sizeof(single));
//Rec.Wave:=TempWave;
Tempstream:=THeapMemoryStream.Create;
Tempstream.Write(AWave[0], (High(aWave) + 1) * SizeOf(Single));
if Database.Add(Rec,true)=0 then
ShowMessage('Error adding the data') else begin
NameEdit.Text := '';
QuestionMemo.Text := '';
NameEdit.SetFocus;
if rec.ID<>0 then
Label4.Caption:=inttostr(rec.ID);
CurrentID:=rec.ID;
Database.UpdateBlob(TSQLSamplerecord,rec.ID,StringToUTF8('fWAVE'),TempStream);
end;
finally
Rec.Free;
tempstream.Free;
AWave:=nil;
end;
end;Find procedure
procedure TForm1.FindButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
tempWave:TSQLRawBlob;
begin
Rec := TSQLSampleRecord.Create(Database,'Name="%"',[StringToUTF8(NameEdit.Text)]);
try
if Rec.ID=0 then
QuestionMemo.Text := 'Not found' else
QuestionMemo.Text := UTF8ToString(Rec.Question);
//TempWave:=Rec.Wave;
Database.RetrieveBlob(TSQLSampleRecord,rec.ID,StringToUTF8('fWAVE'),tempwave);
showMessage(inttostr(Length(TSQLRawBlobToBlob(TempWave))));
finally
Rec.Free;
end;
end;result: Length =0?
and Blobfield name is fWave or Wave?when I used Wave ,an error occured.if i used Fwave, No error occured. enenthougth there is no Blob data updated successfully.
oh yeah, only TestSqL3 project shows Tpdfdocument 1/4 failed.In fact in 05 project it can work well. perhaps only a joke.
oh yeah,
testSqlite3 have tested. only *pdf doesn't passed. Tpdfdocument 1/4 failed.
longge007
Try using new obj-files from http://synopse.info/files/sqlite3obj.7z
yeah,mai62, thanks a lot.
hopely we can discuss how to use SQLite3 Famework frequenctly here.![]()
New version,download form Leaves.
and I Test 04/Server.
complie ,built ok, no problem
when running,there is an Error:
First chance exception at $75279617. Exception class ESQLException with message 'Invalid SQlite3 database handle (13)'. Process Project04Server.exe (3756)
Error is DB created
DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'));My compiler is delphi2007, OS is Win7
i want to when Individual SQLite3 Framework 1.8 will be released?![]()
perhaps it's asiatic Characters,these are what i looking at codes
procedure TTestSQLite3Engine.DirectAccess;
procedure InsertData(n: integer);
var i: integer;
s, ins: RawUTF8;
R: TSQLRequest;
begin
// this code is a lot faster than sqlite3 itself, even if it use Utf8 encoding:
// -> we test the engine speed, not the test routines speed :)
ins := 'INSERT INTO People (FirstName,LastName,Data,YearOfBirth,YearOfDeath) VALUES (''';
for i := 1 to n do begin
str(i,s);
// we put some accents in order to test UTF-8 encoding
R.Prepare(Demo.DB,ins+'Salvador'+s+''', ''Dali'', ?, 1904, 1989);');
R.Bind(1,PAnsiChar('a猷?),4); // Bind Blob
R.Execute;
Demo.Execute(ins+WinAnsiToUtf8('Samuel Finley Breese'+s+''', ''Morse'', ''a猷?', 1791, 1872);'));
Demo.Execute(ins+WinAnsiToUtf8('Sergei'+s+''', ''Rachmaninoff'', ''閦鏱'', 1873, 1943);'));
Demo.Execute(ins+WinAnsiToUtf8('Alexandre'+s+''', ''Dumas'', ''殓b'', 1802, 1870);'));
Demo.Execute(ins+WinAnsiToUtf8('Franz'+s+''', ''Schubert'', ''猷鏰'', 1797, 1828);'));
Demo.Execute(ins+WinAnsiToUtf8('Leonardo'+s+''', ''da Vin鏸'', ''@鏱'', 1452, 1519);'));
Demo.Execute(ins+WinAnsiToUtf8('Aldous Leonard'+s+''', ''Huxley'', ''猷'', 1894, 1963);'));
R.Prepare(Demo.DB,ins+WinAnsiToUtf8('Claud?+s+#10#7''', ''M鬾et'', ?, 1840, 1926);'));
R.Bind(1,PAnsiChar('嚅鏳sjdsBLOB23'),14); // Bind Blob
R.Execute;
Demo.Execute(ins+WinAnsiToUtf8('Albert'+s+''', ''Einstein'', ''殓p'', 1879, 1955);'));
Demo.Execute(ins+WinAnsiToUtf8('Johannes'+s+''', ''Gutenberg'', ''阭ls'', 1400, 1468);'));
Demo.Execute(ins+WinAnsiToUtf8('Jane'+s+''', ''Aust鑞'', ''玎鏼'', 1775, 1817);'));
end;
end;New version,download form Leaves.
and I Test 04/Server.
complie ,built ok, no problem
when running,there is an Error:
First chance exception at $75279617. Exception class ESQLException with message 'Invalid SQlite3 database handle (13)'. Process Project04Server.exe (3756)
I tested V1.8 in Delphi2007.there are some Error:
[DCC Error] SQLite3.pas(3200): E2052 Unterminated string
[DCC Error] SQLite3.pas(3201): E2029 ')' expected but identifier 'R' found
[DCC Error] SQLite3.pas(3202): E2034 Too many actual parameters
[DCC Error] SQLite3.pas(3202): E2029 ')' expected but ';' found
[DCC Error] SQLite3.pas(3203): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3208): E2034 Too many actual parameters
[DCC Error] SQLite3.pas(3208): E2038 Illegal character in input file: '?' (#$3F)
[DCC Error] SQLite3.pas(3208): E2052 Unterminated string
[DCC Error] SQLite3.pas(3219): E2003 Undeclared identifier: 'Owner'
[DCC Error] SQLite3.pas(3223): E2003 Undeclared identifier: 'IsMemory'
[DCC Error] SQLite3.pas(3224): E2003 Undeclared identifier: 'TempFileName'
[DCC Error] SQLite3.pas(3229): E2003 Undeclared identifier: 'Demo'
[DCC Error] SQLite3.pas(3230): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3231): E2003 Undeclared identifier: 'InheritsFrom'
[DCC Error] SQLite3.pas(3232): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3233): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3242): E2003 Undeclared identifier: 'InsertData'
[DCC Error] SQLite3.pas(3247): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3249): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3250): E2003 Undeclared identifier: 'Req'
[DCC Error] SQLite3.pas(3251): E2003 Undeclared identifier: 'Check'
[DCC Error] SQLite3.pas(3251): E2250 There is no overloaded version of 'Utf8ToWinAnsi' that can be called with these arguments
[DCC Error] SQLite3.pas(3252): E2003 Undeclared identifier: 'JS'
[DCC Error] SQLite3.pas(3252): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3254): E2250 There is no overloaded version of 'Hash32' that can be called with these arguments
[DCC Error] SQLite3.pas(3261): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3263): E2066 Missing operator or semicolon
[DCC Error] SQLite3.pas(3264): E2250 There is no overloaded version of 'Hash32' that can be called with these arguments
[DCC Error] SQLite3.pas(3264): E2029 'END' expected but ')' found
[DCC Error] SQLite3.pas(3265): E2029 '.' expected but ';' found
[DCC Warning] SQLite3.pas(3269): W1011 Text after final 'END.' - ignored by compiler
[DCC Error] SQLite3.pas(1202): E2065 Unsatisfied forward or external declaration: 'TTestSQLite3Engine._TSQLTableJSON'
[DCC Error] SQLite3.pas(1209): E2065 Unsatisfied forward or external declaration: 'TTestSQLite3Engine._TSQLRestClientDB'
[DCC Error] SQLite3HttpServer.pas(98): F2063 Could not compile used unit 'SQLite3.pas'
can you help me find where is my Installation Error?
Step: 1) i download SynopseRTL2007.exe, click it, set valide source files "E:\Program Files\CodeGear\RAD Studio\5.0\source\Win32",and destination directory is default dir "D:\dev\lib",
2) then install,
3) modify syscomp.bat content. New is:
del *.dcu /s
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -$D+ System.pas
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -NLVCL -$D+ System.pas
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -N..\ictus3\LVCL -$D+ System.pas
pause
4) run syscomp.bat
5)set IDE LIb path.My IDE is Delphi2007, add Lib paths :
D:\Dev\Lib;$(BDS)\lib;$(BDSUSERDIR)\Imports;$(BDS)\Imports;$(BDS)\Lib\Indy10;$(BDSCOMMONDIR)\Dcp
6)new-> VCL forms Application-delphi for win32.
7) compile project1
8) Error: [DCC Error] Project1.dpr(5): F2051 Unit SysUtils was compiled with a different version of System.@LStrLen
MY complier version is Delphi2007, OS:WIN7
what' the matter
i have one questiong,the RestfulJson Servser only support qureyes according ID,how to get some DATA according name or time.or Multi-conditions.
if i want to get a lot of records according Time,how to realize it.
thanks a lot.
See http://synopse.info/forum/viewtopic.php?pid=16#p16 about the RESTul JSON implementation of the framework. Please continue discussion about this subject here, and not in this post.
yeah, i looked it there,that's good work.
Though your Framework support FastCGI. I think it's a good performace to have an interface for invisting HttpServer ON WEB brower Like IE or FF.it's enough for the user to only visit basic table in the Client PC. From your SynopseComms i can't find some sample. I mean if i know some ID in the database ,i input ID like "http://127.0.0.1:8080/Database=some;Tab … me;ID=some" ,we'll get detail in Clientpc.if so,it's easy for the user to handle data for WEBSite. OF course, your fans only can try to make some thinking.![]()
I think Administrator should write one Sample about TSream Loading/saving in your Next SQLite3 Framework 1.8,If so, this Framework will be widely used in desktop database.![]()
Sir:
i want to how to save filestream or jpg or Blob DATA with your Framwok,thanks a lot
TSQLSampleRecord = class(TSQLRecord)
private
fQuestion: RawUTF8;
fName: RawUTF8;
fTime: TDateTime;
fWave: TSQLRawBlob;
published
property Time: TDateTime read fTime write fTime;
property Name: RawUTF8 read fName write fName;
property Question: RawUTF8 read fQuestion write fQuestion;
property Wave: TSQLRawBlob read fWave write fWave;
end;
...
procedure TForm1.AddButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
AWave:array of single;
tempWave:TSQLRawBlob;
i,n:integer;
begin
n:=10;
setLength(AWave,n);
for I := 0 to n - 1 do
AWave[i]:=Intpower(-1,i)*100*Random;
Rec := TSQLSampleRecord.Create;
try
Rec.Time := Now;
// we use explicit StringToUTF8() for conversion below
// a real application should use TLanguageFile.StringToUTF8() in SQLite3i18n
Rec.Name := StringToUTF8(NameEdit.Text);
Rec.Question := StringToUTF8(QuestionMemo.Text);
SetString(TempWave,PAnsiChar(pointer(AWave)),length(AWave)*sizeof(single));
Rec.Wave:=TempWave;
if Database.Add(Rec,true)=0 then
ShowMessage('Error adding the data') else begin
NameEdit.Text := '';
QuestionMemo.Text := '';
NameEdit.SetFocus;
end;
finally
Rec.Free;
end;
end;
//*********************
procedure TForm1.FindButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
tempWave:TSQLRawBlob;
begin
Rec := TSQLSampleRecord.Create(Database,'Name="%"',[StringToUTF8(NameEdit.Text)]);
try
if Rec.ID=0 then
QuestionMemo.Text := 'Not found' else
QuestionMemo.Text := UTF8ToString(Rec.Question);
TempWave:=Rec.Wave;
showMessage(inttostr(Length(TempWave)));
finally
Rec.Free;
end;
end;Length(TempWave) =0? perhaps the Database haven't added it.
In fact, I want to save AWave into SQLite3. do you have some good suggestions?
thanks a lot,
You should better use procedures to make code clearer.
you are right;
i want to know how to convert onedata intoto TSQLRawBlob ,
var onedata:array of single.
or TSQLRawBlog to onedata.
thanks a lot.
thanks a lot for you sharing your thinking,Next work is that i want to test whether or not TBlob DATA can be used in this sample.i'll solve this problem to use HTTP protocol.
PS:In my understanding ,HTTP protocol is more slowly and less security than TCP/IP . ![]()
CodeGear™ Delphi® for Microsoft® Windows™ Version 11.0.2627.5503 Copyright © 2007 CodeGear™. All Rights Reserved.
OS:WIN7
Region and Language: Chinese
ps: your Compiled all EXEs can be succeededing in running in my PC. Of cource ,you know there 's no interface to test RemotePC for your EXE design.:)
my meaning is that The project should have one interface to setting IP or PC name in the programme in order to test Remotehost Network.
or sometimes if there is one chance thant we you can remotecontrol my PC to test this PROJECT by MSN or some IMS tools.
my version is V 1.7,i download Synopse SQLite3。
i didn't succeeded in compiling the SQLite3Test.dpr project. for there is some wrong. i have post in your blog
so i decided to compile individual project. 01 ,02 .03 ,04,
now i can tell frankly ,04 is succeed.and 03 can be complied. and run in local.but i haven't know whether or not the firewall problem. 03 client can't connect remotehost.
01 is running normally. 02 succeeds in compiling. i don't know what is the means of Embedded .like running inEMbedded system linux .is it?
now i only individly compile 01 ,02, 03。 when Run 01. it can't run,but can't add the Message in Memory.and there's no ERRor.
02 can be compiled ,i run project02.exe, when i Add the Message ,there's one Error.
03 client and server can be compiled. and can run in local pc.
when i copy the server.exe to another pc. and i recompiled client. like
"Form1.Database := TSQLRestClientURINamedPipe.Create(Form1.Model,'\\PCname\pipe\Sqlite3_03');
En error is :
'TSQLRestClientURINamedPipe can't connect to server "\\PCname\pipe\Sqlite3_03"
via "\\PCname\pipe\Sqlite3_03":
can't fint network path。'. Process Project03Client.exe (4084)
and i want to know whether or not some files are necessary when running.
Administrator:
When I only compiled Example 2 【02 - Embedded SQLite3 ORM】.Name and Message is not blank.Click the button."add the Message",An Error occurs,
First chance exception at $75759617. Exception class EAccessViolation with message 'Access violation at address 004AD2C6 in module 'Project02.exe'. Read of address 00000000'. Process Project02.exe (2428), it can't add the Message.
OS is Win7