#1 2010-06-27 15:46:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

How to build SQLite3 framework in Delphi

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.

Online

#2 2010-06-28 07:27:24

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

Hopely V1.8  release quickly,and i can test it easily!

Offline

#3 2010-06-28 09:05:21

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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

#4 2010-06-28 10:20:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

What is your compiler version?

Did you succeed in compiling the SQLite3Test.dpr project?

Does all unitary tests pass on your computer?

Online

#5 2010-06-28 15:19:13

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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

#6 2010-06-28 21:01:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

What is your DELPHI COMPILER version, please?

Online

#7 2010-06-29 14:22:25

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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

#8 2010-06-29 15:18:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

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.

Online

#9 2010-06-30 01:03:33

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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 . tongue

Last edited by longge007 (2010-06-30 01:10:51)

Offline

#10 2010-06-30 06:15:06

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

i want to know how to convert onedata intoto TSQLRawBlob ,
var onedata:array of single.
or TSQLRawBlog  to onedata.

thanks a lot.

Offline

#11 2010-06-30 06:16:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

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.

Online

#12 2010-06-30 06:49:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

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.

Online

#13 2010-06-30 07:06:42

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

thanks a lot,

You should better use procedures to make code clearer.

you are right;

Offline

#14 2010-06-30 08:15:36

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

 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

#15 2010-07-01 03:14:26

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

Sir:
   i want to how to save filestream or jpg or Blob DATA with your Framwok,thanks a lot

Offline

#16 2010-07-01 07:09:00

mai62
Member
Registered: 2010-07-01
Posts: 5

Re: How to build SQLite3 framework in Delphi

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

#17 2010-07-01 08:39:38

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

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 direct methods to access blob fields, including direct TStream loading/saving.

Online

#18 2010-07-01 09:10:58

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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.
tongue

Last edited by longge007 (2010-07-01 09:25:29)

Offline

#19 2010-07-01 10:08:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

Good point: these BLOB fields were not used in my current applications, so I didn't make a lot of dedicated methods for them. But indeed they do work well.

About BLOB data, I should use the REST protocol for handling it. The RESTful protocol allows BLOB to be retrieved (GET) or saved (PUT) via a specific URL, like "ModelRoot/TableName/ID/BlobFieldName". This is even better than the standard JSON encoding, which works well but convert BLOB to/from hexadecimal values, therefore need twice the normal size of it. By using such dedicated URL, data can be transfered as full binary.

I'm adding some dedicated methods to handle blob fields, in TSQLRest, named UpdateBlob() and RetrieveBlob().

Online

#20 2010-07-02 00:52:24

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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.
tongue

Last edited by longge007 (2010-07-02 01:05:03)

Offline

#21 2010-07-02 07:14:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

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.

Online

#22 2010-07-02 07:55:15

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

ab wrote:

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.

Offline

#23 2010-07-02 17:24:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

I've implemented some new methods in the TSQLRest class, therefore these methods works both Client and Server side:

public
    /// get a blob field content from its record ID and supplied blob field name
    // - implements REST GET member with a supplied member ID and a blob field name
    // - return true on success
    // - this method is defined as abstract, i.e. there is no default implementation:
    // it must be implemented 100% RestFul with a GET ModelRoot/TableName/ID/BlobFieldName
    // request for example
    // - this method retrieve the blob data as a TSQLRawBlob string
    function RetrieveBlob(Table: TSQLRecordClass; aID: integer;
      const BlobFieldName: RawUTF8; out BlobData: TSQLRawBlob): boolean; overload; virtual; abstract;
    /// get a blob field content from its record ID and supplied blob field name
    // - implements REST GET member with a supplied member ID and a blob field name
    // - return true on success
    // - this method will create a TStream instance (which must be freed by the
    // caller after use) and fill it with the blob data
    function RetrieveBlob(Table: TSQLRecordClass; aID: integer;
      const BlobFieldName: RawUTF8; out BlobStream: THeapMemoryStream): boolean; overload;
    /// update a blob field from its record ID and supplied blob field name
    // - implements REST PUT member with a supplied member ID and field name
    // - return true on success
    // - this default method call RecordCanBeUpdated() to check if the action is
    // allowed
    // - this method expect the Blob data to be supplied as TSQLRawBlob
    function UpdateBlob(Table: TSQLRecordClass; aID: integer;
      const BlobFieldName: RawUTF8; const BlobData: TSQLRawBlob): boolean; overload; virtual; abstract;
    /// update a blob field from its record ID and blob field name
    // - implements REST PUT member with a supplied member ID and field name
    // - return true on success
    // - this default method call RecordCanBeUpdated() to check if the action is
    // allowed
    // - this method expect the Blob data to be supplied as a TStream: it will
    // send the whole stream content (from its beginning position upto its
    // current size) to the database engine
    function UpdateBlob(Table: TSQLRecordClass; aID: integer;
      const BlobFieldName: RawUTF8; BlobData: TStream): boolean; overload;
    /// update a blob field from its record ID and blob field name
    // - implements REST PUT member with a supplied member ID and field name
    // - return true on success
    // - this default method call RecordCanBeUpdated() to check if the action is
    // allowed
    // - this method expect the Blob data to be supplied as direct memory pointer
    // and size
    function UpdateBlob(Table: TSQLRecordClass; aID: integer;
      const BlobFieldName: RawUTF8; BlobData: pointer; BlobSize: integer): boolean; overload;

Of course, I had to implement the new 100% RESTful URL to get blobs from any HTTP browser: GET or PUT methods are handled for BLOB fields with URL as such:

ModelRoot/TableName/ID/BlobFieldName

And most used MIME type are also retrieved from the content: you can put a JPEG or GIF picture in such a blob, then use it in your HTML code just as a true picture, ready to be displayed.

It's available in the last Leaf of our source code repository.

I still have corresponding unitary tests and sample application to write for these methods... smile

Online

#24 2010-07-02 21:46:24

mai62
Member
Registered: 2010-07-01
Posts: 5

Re: How to build SQLite3 framework in Delphi

I found error in unit SQLite3Commons in function TSQLRecord.FieldProp(PropName: PRawUTF8).
Line
        if IdemPropName(result^.Name,PropName) then
should be replaced with line
        if IdemPropName(result^.Name,PropName^) then

After thjs modification UpdateBlob and RetrieveBlob work for me. I use Delphi 2007.
Thank you.

Offline

#25 2010-07-02 22:55:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

The bug was not in the TSQLRecord.FieldProp function but in the IdemPropName() overloaded function...

It's available in the last Leaf of our source code repository.

Online

#26 2010-07-03 06:29:12

mai62
Member
Registered: 2010-07-01
Posts: 5

Re: How to build SQLite3 framework in Delphi

OK. Thanks.

Offline

#27 2010-07-04 05:12:18

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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'

Offline

#28 2010-07-04 05:28:18

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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)

Offline

#29 2010-07-04 06:01:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

I guess you're using a Window or an IDE with Asiatic characters... and the accents éèà in these 3200 and + lines are not handled as expected.

In all cases, you may have to adapt the software to your needs, so example with setting the WinAnsi charset for the editor. Or upgrade to Delphi Unicode version.

Online

#30 2010-07-04 06:41:57

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

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;

Offline

#31 2010-07-04 07:24:52

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

i want to when Individual SQLite3 Framework 1.8 will be released?
tongue

Last edited by longge007 (2010-07-04 07:25:50)

Offline

#32 2010-07-04 09:03:36

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

longge007 wrote:

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

Offline

#33 2010-07-04 09:55:16

mai62
Member
Registered: 2010-07-01
Posts: 5

Re: How to build SQLite3 framework in Delphi

longge007

Try using new obj-files from http://synopse.info/files/sqlite3obj.7z

Last edited by mai62 (2010-07-04 09:56:02)

Offline

#34 2010-07-04 13:17:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

longge007: mai62 is right, you NEED new .obj files from link above!

Online

#35 2010-07-04 13:17:29

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

mai62 wrote:

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.
tongue

Offline

#36 2010-07-04 13:32:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

longge007 wrote:

perhaps it's asiatic Characters,these are what i looking at codes

These are not asiatic characters, these must be some accents like

   Demo.Execute(ins+WinAnsiToUtf8('Samuel Finley Breese'+s+''', ''Morse'', ''aéàç'', 1791, 1872);'));
Demo.Execute(ins+WinAnsiToUtf8('Sergei'+s+''', ''Rachmaninoff'', ''ézçb'', 1873, 1943);'));
Demo.Execute(ins+WinAnsiToUtf8('Alexandre'+s+''', ''Dumas'', ''éçb'', 1802, 1870);'));
Demo.Execute(ins+WinAnsiToUtf8('Franz'+s+''', ''Schubert'', ''éàça'', 1797, 1828);'));
Demo.Execute(ins+WinAnsiToUtf8('Leonardo'+s+''', ''da Vinçi'', ''@çb'', 1452, 1519);'));
Demo.Execute(ins+WinAnsiToUtf8('Aldous Leonard'+s+''', ''Huxley'', ''éà'', 1894, 1963);'));

As I said, you are using an asiatic code page for Ansi character encoding in your IDE, and our sources expect WinAnsi - i.e. ISO-8859-1 or ISO-8859-15 encoding.

When you open our files in your IDE, they are read with an asiatic code page, and the characters are changed. I don't have an asiatic Delphi IDE, but perhaps try to right click on your source code file, the choose "File format", then perhaps you could be able to select WinAnsi or CP1252 or ISO-8859-1 or ISO-8859-15 encoding.

Online

#37 2010-07-04 13:34:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

longge007 wrote:

yeah,mai62, thanks a lot.
hopely we can discuss how to use SQLite3 Famework frequenctly here.
tongue

Good idea: and don't be shy, you can open new topics on the SQlite3 Framework forum, on for every new subject, so that future users could get their information directly from the topic title.

Online

#38 2010-07-04 14:04:50

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

oh yeah,
testSqlite3 have tested. only *pdf  doesn't passed. Tpdfdocument 1/4 failed.

Offline

#39 2010-07-04 14:10:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

I suspect it's all about accents characters: in the test, there is some accents. If it was converted to asiatic code page, it will fail...
Or perhaps it's because you don't have the same font definition. Could you send me by email the TestSQL3.pdf file generated by the test, available in the TestSQL3.exe folder?
You can download the expected version (generated under Windows 7) from http://synopse.info/files/pdf/TestSQL3.pdf

Online

#40 2010-07-04 14:16:38

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

longge007 wrote:

i want to when Individual SQLite3 Framework 1.8 will be released?
tongue

It will be released when SQlite 3.7 "final" will be released officialy... should have been at 1st of July, but now it says on July 15th... see http://www.sqlite.org/draft/releaselog/3_7_0.html

Online

#41 2010-07-04 14:31:54

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: How to build SQLite3 framework in Delphi

oh yeah, only TestSqL3 project shows Tpdfdocument 1/4 failed.In fact in 05 project it can work well. perhaps only a joke.

Offline

#42 2011-04-22 14:24:49

RiderV
Member
Registered: 2011-04-22
Posts: 2

Re: How to build SQLite3 framework in Delphi

TestSQL3 build error on RAD 2010:
[DCC Error] SynBigTable.pas(2193): E2003 Undeclared identifier: 'Offsets64'

Offline

#43 2011-04-23 18:15:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

RiderV wrote:

TestSQL3 build error on RAD 2010:
[DCC Error] SynBigTable.pas(2193): E2003 Undeclared identifier: 'Offsets64'

You don't have the latest version of the units.

Here is the current line 2193:

aID, aIndex, aAliasIndex: integer; var aNewIndex: cardinal): integer;

Online

#44 2011-04-26 11:17:25

RiderV
Member
Registered: 2011-04-22
Posts: 2

Re: How to build SQLite3 framework in Delphi

ab wrote:
RiderV wrote:

TestSQL3 build error on RAD 2010:
[DCC Error] SynBigTable.pas(2193): E2003 Undeclared identifier: 'Offsets64'

You don't have the latest version of the units.

Here is the current line 2193:

aID, aIndex, aAliasIndex: integer; var aNewIndex: cardinal): integer;

I download first time SynopseSQLite3.zip. Why not last version that unit there?

Offline

#45 2011-04-26 12:00:17

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to build SQLite3 framework in Delphi

Get the latest version from our source code repository.

See http://synopse.info/fossil/wiki?name=Get+the+source

Online

Board footer

Powered by FluxBB