You are not logged in.
The Synopse SQLite3 Database Framework was just released under version 1.9:
- internal SQLite3 database engine is updated to version 3.7.1;
- new TSQLRecordFTS3 record, for using FTS3 virtual tables, i.e. implementing full-text search;
- new SQLite3UIEdit unit, to edit table content with a dialog created from RTTI;
- new dedicated BLOB methods and JSON array serialization;
- a lot of fixes and speed enhancements (including HTTP server using Thread Pool).
Changes in SynCommons.pas unit:
- now compiles under CrossKylix, and tested under Linux
- new JSONEncodeArray procedures, to create JSON array content from supplied Delphi arrays (handle RawUTF8 text, double or integer arrays)
- new AddCSV methods in TTextWriter handling Delphi arrays to be added as Comma-Separated-Values (handle RawUTF8 text, double or integer arrays)
- new definition of PtrInt/PtrUInt, to match NativeInt/NativeUInt types, available since Delphi 2007 - some code rewrite in order to avoid any implicit conversion from/to integer/cardinal
Changes in SynCrtSock.pas unit:
- avoid some GPF during client deconnection when the server shut down
- rewrite HTTP Server handle request loop keep alive timing
- HTTP Server now use a Thread Pool to speed up multi-connections: this speed up a lot HTTP/1.0 requests, by creating a Thread only if necessary
Changes in SynCrypto.pas unit:
- now use direct Windows threads, since we don't need any exception handling nor memory usage inside the AES encryption Thread handler
-> avoid classes.TThread and system.BeginThread() use
-> application is still "officialy" mono-threaded (i.e. IsMultiThread=false), for faster System.pas and FastMM4 (prevent CPU locking - see http://synopse.info/forum/viewtopic.php?id=57 about Delphi & multi-core)
- some other minor fixes and enhancements
Changes in SynZip.pas unit:
- crc32 is now coded in inlined fast asm (crc32.obj is no longer necessary)
- crc32 hashing is performed using 8 tables, for better CPU pipelining and faster execution
- crc32 tables are created on the fly during unit initialization, therefore save 8 KB of code size from standard crc32.obj, with no speed penalty
Changes in SynSelfTests.pas unit:
- test multi-threaded AES encryption/decryption of 4 MB blocks
- added crc32 tests
Changes in SynGdiPlus.pas unit:
- small enhancements for framework Main Demo release (RectNotBiggerThan and MaxPixelsForBiggestSide parameter in SaveAs function e.g.)
Changes in SQLite3.pas unit:
- database engine updated to 3.7.1
- fix issue in TSQLRestServerDB.CreateMissingTables when an exception occured
- handle now RowID as a valid alias to the ID field (needed for TSQLRecordFTS3)
- handle TSQLRecordFTS3 record, for using FTS3 virtual tables, i.e. implementing full-text search (including dedicated regression tests)
Changes in SQLite3Commons.pas unit:
- update engine to version 3.7.1
- fixed error calling a TSQLRestServerCallBack with both record & parameters
- TSQLRecordSigned must now be signed with a specified content (content was formerly a fixed field of type RawUTF8, but it didn't apply in all cases, e.g. if content field is defined as TSQLRawBlob)
- new TSQLRestClientURI.ForceBlobTransfert property which enable to get and set BLOB fields values with usual Add/Update/Retrieve methods
- new TSQLRestClientURI.RetrieveBlobFields/UpdateBlobFields methods for retrieving/updating all BLOB fields of a record at once
- better handling of sftID in the User Interface and database use (e.g. creates a dedicated index for the TSQLRecord published fields)
- some code rewrite in order to avoid any implicit conversion from/to integer/cardinal after new definition of PtrInt/PtrUInt (matching NativeInt/NativeUInt types, available since Delphi 2007)
- updated TSQLRibbonTabParameters object, with some new fields dedicated to the automatic edition of records, via the new SQLite3UIEdit unit
- new sftSet SQL field kind, handling a TSQLRecord published property with a set of enumeration as Delphi type (stored as bit-mapped INTEGER)
- handle now RowID as a valid alias to the ID field (needed for TSQLRecordFTS3)
- defines a new TSQLRecordFTS3 type, for defining a FTS3 virtual table, i.e. implementing full-text search
Changes in SQLite3UILogin.pas unit:
- improved Delphi 2009/2010 UnicodeString compatibility
- new PassWord method to enter a password e.g. for Cypher (i.e. with no UserName)
Changes in SQLite3ToolBar.pas unit:
- improved Delphi 2009/2010 UnicodeString compatibility
- add TMS components stylers coherency update
- added TSQLRibbon to factorize most used Ribbon-related User Interface data, functions and events in one class
Changes in SQLite3UIQuery.pas unit:
- custom queries can now handle standard operators, following a specified set
- TSQLQueryEvent() usage has therefore been modified for custom queries
Changes in SQLite3UI.pas unit:
- improved Delphi 2009/2010 UnicodeString compatibility
- fix some issues, and complete implementation of marking from time elapsed
New SQLite3UIEdit.pas unit:
- Initial Release, handling most common kind of SQL field (sftRecord, sftTimeLog, sftCurrency, sftDateTime, sftFloat and sftBlob) are not handled yet, because is not needed; perhaps sftTimeLog, sftCurrency, sftDateTime and sftFloat should be handled in the future (using TDateTimePicker or a to be written TSynExtendedLabeledEdit components)
- all user interface (fields, layout, etc...) is created from RTTI data and some custom parameters
Changes in SQLite3Pages.pas unit:
- new AppendRichEdit method to draw RichEdit content
- new WordWrapLeftCols property used to optionaly word wrap caLeft columns into multiple lines, i.e. if the text is wider than the column width, its content is wrapped to the next line (set to false by default) - this also will handle #13/#10 in column text as a "go to next line" command
Changes in SQLite3i18n.pas unit:
- new TLanguageFile.BooleanToString method, returning 'No' or 'Yes'
- new TLanguageFile.PropToString method to convert a TSQLRecord published property value into ready to be displayed text
Changes in SQLite3UIOptions.pas unit:
- some code refactoring to share code with the new SQLite3UIEdit unit
- minor fixes and enhancements
See http://blog.synopse.info/post/2010/08/2 … mework-1.9 to download instructions
Offline
Last minute update:
Main version updated to 1.9.1:
We had to update the SQLite3 internal engine to version 3.7.2: an obscure but very old bug makes SQLite authors recommend to use 3.7.2 for all new development.
Upgrading from all prior SQLite versions is also recommended. See http://sqlite.org/releaselog/3_7_2.html
So we do. And increase our version number to 1.9.1.
Offline
One new nice feature, which is worth highlighting, is the new sftSet SQL field kind.
It handles a TSQLRecord published property as a set of enumeration as Delphi type (stored as bit-mapped INTEGER).
type
TEnumerate = (eOne, eTwo, eThree);
TEnumerates = set of TEnumerate;
TNewRecord = class(TSQLRecord)
private
fName: RawUTF8;
fSet: TEnumerates;
published
property Name: RawUTF8 read fName write fName;
property Set: TEnumerates read fSet write fSet;
end;
Then the SQLite3UIEdit unit is able to create a RadioGroup with checkboxes for every enumeration item, for easy editing of this set of enumerates.
That is, for the above type, a RadioGroup labelled "Set" containing checkboxes labelled "One", "Two" and "Three".
With no IDE. Just call a generic method, and most work is done for you by the RTTI!
Offline
I cannot compile the main demo with this new version...
Offline
I checked before the release, and compiled the main demo under both Delphi 7 and Delphi 2010.
It works fine, under both IDE. You can even open the same database file safely from both exe.
It's worth saying that the Main Demo need the TMS components (for the ribbon). The trial version is enough.
You have to perform minimal settings:
- add ..\.. to your Project Search path;
- launch the FileMainRes.bat file to create the FileMainRes.res.
You can download an executable from http://synopse.info/files/samples/synfile.zip
Offline
sir:
In last Version 1.91.i test it.
can you test the function JSONENCODEArray(). i add the Values :Array of Single. and the retriveblob processing is right
now define new TSQLRestServer added DataasHex function . when the Client http://127.0.0.1/root...,it can't return right JSONArray structure.or give me some quesiton,how to save the Values( Array of single).
Offline
the GDIPlus can't handle Chinese Font. can you tell me where is the Font transfer in thsi *.pas. perhaps i can do more for the Chinese font convertion in PDF report
Offline
can you test the function JSONENCODEArray(). i add the Values :Array of Single. and the retriveblob processing is right
now define new TSQLRestServer added DataasHex function . when the Client http://127.0.0.1/root...,it can't return right JSONArray structure.or give me some quesiton,how to save the Values( Array of single).
Can you be more precise?
Without your source code, it's not possible to help you!
I can't get your point here with so laconic answers, sorry.
the GDIPlus can't handle Chinese Font
This is quite vague also. Please give some samples.
Offline
OK,about the JSONEncodeArray(),next is my codes,
//TSQLRecord
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 stored false; //made Unique
property Question: RawUTF8 read fQuestion write fQuestion;
property Wave: TSQLRawBlob read fWave write fWave;
public
function DataAsHex(aClient: TSQLRestClientURI): RawUTF8;
end;
the add procedue In Client
procedure TForm1.AdvGlowButton5Click(Sender: TObject);
var Rec: TSQLSampleRecord;
i,n:integer;
aWave:array of single;
tempstream:tMemorystream;
begin
n:=1024;
setLength(aWave,n);
for i := 0 to n - 1 do
aWave[i]:=100*sin(i*20+110);
tempstream:=TMemoryStream.Create;
Tempstream.Write(AWave[0], (High(aWave) + 1) * SizeOf(Single));
Rec := TSQLSampleRecord.Create;
try
Rec.Time := Now;
count:=count+1;
// 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);
if Database.Add(Rec,true)=0 then
ShowMessage('Error adding the data') else begin
NameEdit.Text := '';
QuestionMemo.Text := '';
NameEdit.SetFocus;
end;
if Database.UpdateBlob(TSQLSamplerecord,rec.ID,'Wave',TempStream) then
statusbar1.Panels[1].Text:=Inttostr(Rec.id)+'条Blob';
finally
Rec.Free;
Tempstream.Free;
aWave:=nil;
end;
end;
the new TSQLRestServer class
type
TSQLRestServerWave=class(TSQLRestServerDB)
function DataAsHex(aRecord: TSQLSampleRecord; aParameters: PUTF8Char;
const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer;
end;
........
function TSQLRestServerWave.DataAsHex(aRecord: TSQLSampleRecord; aParameters: PUTF8Char; const aSentData: RawUTF8; var aResp: RawUTF8; var aHead: RawUTF8):integer;
var aData: TSQLRawBlob;
Values:Array of double;
begin
result := 404; // invalid Request
if (self=nil) or (aRecord=nil) or not aRecord.InheritsFrom(TSQLRecord) or
(aRecord.ID<0) then
exit; // we need a valid record and its ID
if not RetrieveBlob(TSQLSampleRecord,aRecord.ID,'Wave',aData) then
exit; // impossible to retrieve the Data BLOB field
setLength(Values,Length(aData) div 4);
Move(pointer(aData)^,Values[0],Length(aData));
//aResp := JSONEncodeResult([SynCommons.BinToHex(aData)]);
aResp:=JSONEncodeArray(Values,3);
// idem: aResp := JSONEncode(['result',BinToHex(aRecord.fData)],TempMemoryStream);
result := 200; // success
end;
Offline
about the GDIPages, in the example testSQLite3Page ,
.....
DrawTitle(edt1.Text,true);
for i := 1 to 10 do
DrawText('This is some text '+IntToStr(i));
NewLine;
...///
in the top Line DrawText(), i changed it with DrawText('中国汉字'+InttoStr(i))' // Chinese Text
the PDF file can't dispaly Chinese Text rightly,
Offline
about the GDIPages, in the example testSQLite3Page ,
in the top Line DrawText(), i changed it with DrawText('中国汉字'+InttoStr(i))' // Chinese Text
the PDF file can't dispaly Chinese Text rightly,
You are using Delphi 2007 I guess?
This code will work under Delphi 2010.
But it should work under Delphi 2007, if you don't use SQlite3i18n unit. It uses row VCL Canvas methods.
Do you use this unit?
If you use it, you'll have to set the main language to Chinese, to set the global CharSet for the VCL.
Offline
OK,about the JSONEncodeArray(),next is my codes,
You've some architectural problems in your code (like using a TSQLRestClient in the table definition). But it's not an issue, it's just that it's not following the n-tier separation.
You didn't post the Client-side here...
So what is your problem, i.e. how do you access to the data, what is the returned JSON content, etc...
You can't just use JSONEncodeArray instead of JSONEncodeResult!
JSONEncodeResult returns a JSON object with a "result" property containing the result.
JSONEncodeArray returns a JSON array.
So you'll have to code something like this, to insert the JSON array inside a valid JSON object with a "result" property:
aResp := '{"result":'+JSONEncodeArray(Values,3,TempMemoryStream)+'}';
Note the use of TempMemoryStream parameter to use the temporary MemoryStream available in any TSQLRest instance. This is not mandatory, but can speed things up.
Offline
OK. I have solve my problem now the demo works. However I don't understant why you need integrated TMS component with your framework. Why don't you create a stand alone framework with a good demo with visual (and common) VCL?
Offline
OK. I have solve my problem now the demo works. However I don't understant why you need integrated TMS component with your framework. Why don't you create a stand alone framework with a good demo with visual (and
common) VCL?
I already answered to this particular point in http://synopse.info/forum/viewtopic.php?pid=328#p328
And also to the same question you already posted in http://synopse.info/forum/viewtopic.php?pid=289#p289
So it's my intent to allow VCL usage, in the near future. It won't be difficult, because it's just a matter of change of classes.
But since my last Client wanted a Ribbon look, and the Delphi 2009 integrated component was buggy, I used the one from TMS.
Have you any feedback about the Delphi 2010 ribbon?
Perhaps just using TPageControl and TToolBar could be nice enough. I'll try to do use it.
Offline
OK. I have solve my problem now the demo works. However I don't understant why you need integrated TMS component with your framework. Why don't you create a stand alone framework with a good demo with visual (and common) VCL?
yeah,i only think the TMScomponent is good in special SKIN ,not other need.
Offline
longge007 wrote:OK,about the JSONEncodeArray(),next is my codes,
You've some architectural problems in your code (like using a TSQLRestClient in the table definition). But it's not an issue, it's just that it's not following the n-tier separation.
You didn't post the Client-side here...
So what is your problem, i.e. how do you access to the data, what is the returned JSON content, etc...
.
about the Client ,i have post the Add procedure Codes. in Fact, i use retrieveBlob() method ,i can get the right Values that shows i have saved the Values(array of single) in the table blob field.
now i only hope the DataasHex Method can return the right JSONArray in the http request.Unfortunly, now it's wrong .Moreever you can write a test, add the values(array of single) by the Client.and then visit it in the http request, whether or not get the right JSONArray fomat.
perhaps you can look at this post.
http://synopse.info/forum/viewtopic.php?id=87
Last edited by longge007 (2010-08-26 21:58:59)
Offline
In HttpServer side, i add the breakpoint in the DataasHex, it does't work, so i don't know whether or not there is Degger swtich in the Server.
Offline
The debugger automatically switch the the Server thread, if you put a breakpoint in there.
If you can't reach the DataAsHex method, this is because it is not called.
I think you've perhaps missed something, but the source code you posted here is not enough to guess what's wrong.
Offline
@longge007: I received your source code by email.
As stated in the framework documentation and in this forum (e.g. in http://synopse.info/forum/viewtopic.php?pid=233), you must declare the DataAsHex method as published:
type
TSQLRestServerWave=class(TSQLRestServerDB)
published
function DataAsHex(aRecord: TSQLSampleRecord; aParameters: PUTF8Char;
const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer;
end;
Otherwize, the RTTI is not generated, and this method is never called by the server!
Offline
I already answered to this particular point in http://synopse.info/forum/viewtopic.php?pid=328#p328
And also to the same question you already posted in http://synopse.info/forum/viewtopic.php?pid=289#p289
So it's my intent to allow VCL usage, in the near future. It won't be difficult, because it's just a matter of change of classes.
But since my last Client wanted a Ribbon look, and the Delphi 2009 integrated component was buggy, I used the one from TMS.Have you any feedback about the Delphi 2010 ribbon?
Perhaps just using TPageControl and TToolBar could be nice enough. I'll try to do use it.
I don't like Ribbon interface (TMS or Delphi 2010) but this is not a problem. I think your framework shouldn't create the interface. The developer can create the GUI as he want. So the demo should show only how use your framework without create the GUI on runtime.
In my opinion you should create a demo with GUI (on design time) that explane the common functions of your framework. This is only a my opinion but I think this can help me young developer and not only me.
Offline
yeah,Through the published ,the debugger is working, thanks a lot.
Sir, In fact ,my codes can work well all the time,the return error is for the Sigle to double.
for my client add procedue ,define the values is Array of single. however in the Server i use the JsonEncodeArray () which only handle Double type Array.i use the Values ( Array of double). finally, the return JsonArray is wrong.
perhaps, you should and one new function like add( value: single, decimals). not only add( value:double,decimals).
Last edited by longge007 (2010-08-27 11:45:26)
Offline
I don't like Ribbon interface (TMS or Delphi 2010) but this is not a problem. I think your framework shouldn't create the interface. The developer can create the GUI as he want. So the demo should show only how use your framework without create the GUI on runtime.
Since the ORM approach is not RAD-oriented, it did sense to me that the UI should be also code-generated.
Therefore, since we have a lot of useful information accessible through RTTI (thanks to the ORM approach of the framework), it was easy to create most of the User Interface from RTTI.
In any n-tier architecture, you don't have to stay on the Data-tier, or the Logic-tier. The presentation layer integration is one benefit of such a framework.
It's perhaps worth saying that, because of the JSON RESTful approach of our framework, any other presentation layer (like an AJAX layer) can be developed.
The integrated UI classes and methods were the one we used for our projects. And it was fulfilling our customers needs. Delphi Clients are easy to develop and setup (no installation is required). IMHO it's an interesting alternative to AJAX clients. But it's still relying on a Windows OS.
So you can use the framework without any interface. As you stated: "The developer can create the GUI as he want. " It is already the case.
For example, you can create a server side with no interface at all, then create clients in either AJAX or Delphi, with or without
The main units of the framework (SynCommons, SQLite3Commons, etc...) are not linked to the UI units of the framework (SQLite3UI, SQLite3Toolbar, etc...).
Even the reporting units (SQLite3Pages, SynPdf...) are independent from the UI units.
So you can use whatever GUI layer you want. With no GUI layer at all if you want.
The first published demos where with simple GUI, standard VCL components.
We released this main demo for showing one example of what could be done with the framework, by using the integrated UI units, which are not mandatory.
In my opinion you should create a demo with GUI (on design time) that explane the common functions of your framework. This is only a my opinion but I think this can help me young developer and not only me.
Did you take a look at the framework documentation?
What are the concepts or implementations of the framework you still don't get?
Feel free to put some questions here.
Offline
longge007 wrote:about the GDIPages, in the example testSQLite3Page ,
in the top Line DrawText(), i changed it with DrawText('中国汉字'+InttoStr(i))' // Chinese Text
the PDF file can't dispaly Chinese Text rightly,You are using Delphi 2007 I guess?
This code will work under Delphi 2010.But it should work under Delphi 2007, if you don't use SQlite3i18n unit. It uses row VCL Canvas methods.
Do you use this unit?
If you use it, you'll have to set the main language to Chinese, to set the global CharSet for the VCL.
yeah,i am using Delphi2007, can you say details about how to use One Way: row VCL Canvas Methods and the second way:if i use SQLite3i18n unit,and how to set the Main Language to Chinese,to set the gloal Chart for the VCL.. i am Puzzled with The SQlite3Pages unit and SynPdf unit and SynGDIPlus unit.
i think if SQLite3Page is powerfula and easy to create a report in project. thanks your hard work!
Offline
i add one new function addCSV(values:array of single,formatsetting:string),JSONEncodeArray(Values: array of single, formatsetting, TempMemoryStream: TMemoryStream=nil);
so i have solved my problem. thanks a lot,
i see that i need to spare more time in study your Framework Codes.
thanks a lot
Offline