You are not logged in.
Pages: 1
Here is a step by step building from the source code.
1. Get the source code
There are two ways of getting the source code:
- download the all-in-one SynopseSQLite3.zip file - see http://synopse.info/forum/viewtopic.php?id=2
- download the latest source code from our repository - this will get you the latest version available - see http://synopse.info/fossil/wiki?name=Get+the+source
2. Build the source code
First create a new folder somewhere in your hardrive. It's better to leave the folder name short, with no space inside it.
Uncompress the source code tree you got in step 1, including all embedded directories.
Open the TestSQL3.dpr project.
3. FAQ
A. I've the following error message: [Pascal Fatal Error] TestSQL3.dpr(59): F1026 File not found: 'Synopse.inc'
If you downloaded the code from our repository, some units are in the SQlite3 folder, some in its parent folder: so just go to "Project/Options" then choose "Directories/Conditionals" and enter .. (two points) in the "Search path" field. So you'll get the Syn*.* files, and avoid the compilation error.
For Delphi 7, you should put ..;..\RTL7 in the "Search path" field.
B. Which version of the IDE are you using?
The framework was developed on Delphi 7.
It's tested for compilation and all unitary testing under Delphi 7, Delphi 2007 and Delphi 2009.
C. Can you supply us with a valid testing report?
Here is a testing report on my laptop, with the 1.8 version from today's repository source code, compiled with Delphi 2007...
Just notice the "2.5. Client server access" section and guess the speed of Client/Server requests: from 2357 per second for HTTP, up to 32870 per second for direct access... every request just return a 4 KB JSON Content... try to find a faster RESTful server serving JSON over HTTP !
You'll also note that a lot of low-level functions are tested (UTF-8, RTTI, integer conversion, compression) and even at higher level (pdf file generation, new WAL SQLite3 mode)... if you've got some testing ideas, just create new classes, and commit them on the source code repository!
Synopse SQLite3 Framework Automated tests
-----------------------------------------
1. Synopse libraries
1.1. Low level common:
- System copy record: 22 assertions passed
- Fast string compare: 7 assertions passed
- Url encoding: 103 assertions passed
- Soundex: 29 assertions passed
- Numerical conversions: 150000 assertions passed
- Curr64: 20012 assertions passed
- CamelCase: 5 assertions passed
- Bits: 4614 assertions passed
- Ini files: 7000 assertions passed
- UTF8: 3003 assertions passed
Total failed: 0 / 184795 - Low level common PASSED
1.2. Low level types:
- Iso8601 date and time: 24000 assertions passed
- Url decoding: 400 assertions passed
- RTTI: 21 assertions passed
Total failed: 0 / 24421 - Low level types PASSED
1.3. Cryptographic routines:
- Adler32: 1 assertion passed
- MD5: 1 assertion passed
- SHA1: 5 assertions passed
- SHA256: 5 assertions passed
- AES256: 600 assertions passed
- Base64: 2000 assertions passed
Total failed: 0 / 2612 - Cryptographic routines PASSED
1.4. Compression:
- In memory compression: 12 assertions passed
- Gzip format: 2 assertions passed
- Zip format: 6 assertions passed
Total failed: 0 / 20 - Compression PASSED
1.5. Synopse PDF:
- TPdfDocument: 4 assertions passed
- TPdfDocumentGDI: 3 assertions passed
Total failed: 0 / 7 - Synopse PDF PASSED
2. SQLite3
2.1. Basic classes:
- TSQLCache: 612 assertions passed
- TSQLRecord: 22 assertions passed
- TSQLModel: 3 assertions passed
Total failed: 0 / 637 - Basic classes PASSED
2.2. File based:
- Direct access: 5 assertions passed
- TSQLTableJSON: 20030 assertions passed
- TSQLRestClientDB: 2056 assertions passed
Total failed: 0 / 22091 - File based PASSED
2.3. File based WAL:
- Direct access: 5 assertions passed
- TSQLTableJSON: 20030 assertions passed
- TSQLRestClientDB: 2056 assertions passed
Total failed: 0 / 22091 - File based WAL PASSED
2.4. Memory based:
- Direct access: 4 assertions passed
- TSQLTableJSON: 20030 assertions passed
- TSQLRestClientDB: 68127 assertions passed
Total failed: 0 / 88161 - Memory based PASSED
2.5. Client server access:
- TSQLite3HttpServer: 3 assertions passed
- TSQLite3HttpClient: 3 assertions passed
- Http client keep alive: 3001 assertions passed
first in 7.18ms, done in 424.22ms i.e. 2357/s, average 424us
- Http client multi connect: 3001 assertions passed
first in 476us, done in 822.48ms i.e. 1215/s, average 822us
- Named pipe access: 3003 assertions passed
first in 57.06ms, done in 153.93ms i.e. 6496/s, average 153us
- Local window messages: 3002 assertions passed
first in 124us, done in 48.66ms i.e. 20550/s, average 48us
- Direct in process access: 3001 assertions passed
first in 34us, done in 30.42ms i.e. 32870/s, average 30us
Total failed: 0 / 15014 - Client server access PASSED
Synopse framework used: 1.8
SQlite3 engine used: 3.7.0
Time elapsed for all tests: 6.09s
Tests performed at 6/27/2010 5:47:31 PM
Total assertions failed for all test suits: 0 / 359849
! All tests passed successfully.
D. SynZip.TZipRead.Create() throws 'Range check error' exception / Sqlite3.CreateSQLEncryptTableBytes() throws 'Integer overflow' exception
You MUST set both Range checking and Overflow checking to OFF in your application options for using the framework.
Some code optimizations rely on it. But the code is safe thanks to all the unitary testing done. You won't except GPF or such.
Offline
Hopely V1.8 release quickly,and i can test it easily!
Offline
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.
Last edited by longge007 (2010-06-28 09:05:44)
Offline
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?
Offline
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.
Last edited by longge007 (2010-06-29 14:28:56)
Offline
About the samples, they do need to add the SynCommons unit in their "uses" clause.
If you need remote Client/Server, try using the HTTP protocol. Just change the classes to TSQLite3HttpServer and TSQLite3HttpClient, from units SQLite3HttpServer and SQLite3HttpClient.
I don't know exactly the settings for named pipes, but I guess Windows 7 is a bit aggressive about security. For example, named pipes won't work as expected on the same machine if the server is a windows service. So I won't be surprised if named pipes won't work remotely with Windows 7, using the default settings. There could be some settings to force... but don't know which by now.
In all cases, HTTP will work. Just be careful and choose a free port, not the standard HTTP port 80. For our tests, we use port 888. Don't forget to allow the server application have access to all network (private and publics) in the firewall settings. See also the AddApplicationToXPFirewall() procedure of SQLite3UI.pas if you want to do it programmaticaly.
Offline
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 .
Last edited by longge007 (2010-06-30 01:10:51)
Offline
i want to know how to convert onedata intoto TSQLRawBlob ,
var onedata:array of single.
or TSQLRawBlog to onedata.
thanks a lot.
Offline
HTTP is just a way of putting a header and data over TCP/IP.
It is exactly as fast than TCP/IP, but it is also very easy to pass through firewalls and networks. About security, it depends on the negotiation algorithms used.
Offline
The fastest way is to convert with the SetString() and move() standard procedures.
You have to know a bit about dynamic array and string memory layout, but that's not so complicated.
Here is some sample code:
var B: TSQLRawBlob;
onedata: array of single;
(...)
SetString(B,PAnsiChar(pointer(onedata)),length(onedata)*sizeof(single));
(...)
and to reverse the conversion:
var B: TSQLRawBlob;
onedata: array of single;
(...)
SetLength(onedata,length(B) div sizeof(single));
move(pointer(B)^,pointer(onedata)^,length(B));
You should better use procedures to make code clearer.
Offline
thanks a lot,
You should better use procedures to make code clearer.
you are right;
Offline
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?
Last edited by longge007 (2010-06-30 08:38:47)
Offline
Sir:
i want to how to save filestream or jpg or Blob DATA with your Framwok,thanks a lot
Offline
I wrote June 6 in blog:
Gimme please any example for working with blob fields.
Today is July 1. Answer no found.
I think this is bug in Framework.
Offline
There is a blob test in the automated tests: in the TSQLRecordPeople class used for testing, there is a BLOB field, which is tested and work as expected. There should be no bug in the Framework at this level.
type
// a record mapping used in the test classes of the framework
// - this class can be used for debugging purposes, with the database
// created by TTestFileBased in SQLite3.pas
// - this class will use 'People' as a table name
TSQLRecordPeople = class(TSQLRecord)
private
fData: TSQLRawBlob;
(...)
published
(...)
property Data: TSQLRawBlob read fData write fData;
end;
The only thing is that, as stated by the documentation in the SQLFromSelectWhere function or the SQLTableSimpleFields or GetSQLValues/GetJSONValues methods, BLOB fields are NOT retrieved or inserted with other fields.
The BLOB fields are not part of the standard field get or set, to spare bandwidth.
You'll have to explicitly set or get the blob fields values with the EngineExecute() method for setting values, and OneFieldValue() method for getting the value. You'll have to call the TSQLRawBlobToBlob() and BlobToTSQLRawBlob() functions in order to convert your data from and to TSQLRawBlob values, or use the TSQLRecord.FillValue() method from a OneFieldValue() result.
I just realized this was not so obvious, and neither easy to use. I'll add some more