Topic: SQLitePass in Delphi 7

Hello list,

Did anybody tried the SQLitePass 0.32 on Delphi 7? I get an error when tried to compile/install under Delphi 7.

Can somebody point me?

Thanks

Re: SQLitePass in Delphi 7

Hi Chukkan,

I don't have Dephi 7 running here but I will be glad to help you if you give me some details about the compilation problem.

Thanks.

Luc

Re: SQLitePass in Delphi 7

Dear Luc,

Thanks for your reply.

I get an  "undelcared identifier error: 'SListIndexError'" on line number 253 in SQLitePasUtil file when compile under Delphi 7. In Procedure "Delete".

Hope this will help you to identify the error.

Thanks

Chukkan

Re: SQLitePass in Delphi 7

Hi Chukkan,

the SListIndexError is a constant string declared (with Delphi 4) in the Borland unit "Consts".

Obviously, this unit was renamed or merge with another one in Delphi 7.

SListIndexError  is a simple string so, as a quick fix you can directly change the SqlitePassUtils code :

  if (Index < 0) or (Index >= FCount) then Error(SListIndexError, Index);

by

  if (Index < 0) or (Index >= FCount) then Error('List Index out of bounds (%d)', Index);

Hope it helps.


I'm working on 0.33 version which will be more stable. It will be out soon, so let me know if this fix work so I can adapt the code to D7.

Thanks

Luc

Re: SQLitePass in Delphi 7

Dear Luc,

Thanks for your post.

I have done according to what you instructed. However, I have changed the same in the following procs:
delete, Exchange, Get, Insert, Move, Put, SetCapacity, and in SetCount.

Then it complained on DsgnIntf which changed to DesignIntf, and added DesignEditors (support for TStringProperty). Then it went on complaining on proxies.pas which worked out by adding DesignIde.dcp to the list of required packages.

Packages are now installed. On a trial run, I was unable to load the 'libsqlitepass3.so' but .dlls are loading fine.

One thing which I don't understand is that if I put a TSqlitePassDatabase object on a form (and set the library file), and tried to compile it produces an error message informs "Database property is not defined !" and then program starts. Is it suggests that I must point a valid database file which should be existing before the program get started? Would you please clear this point? I wish to create a database file after the program start and then open it.

Looks forward for your instructions.

Thanks

Re: SQLitePass in Delphi 7

Hi Chukkan

I won't be able to answer directly to your post until the end of the week (busy).
Many thanks for the info on compiling problems with Delphi 7. I'll try to add  a package soon.

For you problem, I'll check it later (next week), sorry.

In fact I always use existing databases, so it is a good subject of study but you can may be try with connected := false (not sure it works...)

Regards

Luc

Re: SQLitePass in Delphi 7

Hi Chukkan,

From version 0.33, a database can be created at runtime like this :

procedure TForm1.BtCreateDatabaseClick(Sender: TObject);
begin
if Not FileExists('NewDb.db3')
   then SqlitePassDatabase1.CreateDatabase('NewDb.db3');

SqlitePassDatabase1.Close;
SqlitePassDatabase1.Database := 'NewDb.db3';
SqlitePassDatabase1.Open;
SqlitePassDatabase1.TableDefs.CreateTable(
'CREATE TABLE [SampleTable] ( [AutoIncField] AUTOINC, [BinIntField] BIGINT,' +
'[BinaryField] BINARY, [BlobField] BLOB, [BooleanField] BOOLEAN, [CharField] CHAR,' +
'[ClobField] CLOB, [CurrencyField] CURRENCY, [DateField] DATE, [DateTextField] DATE,' +
'[DateTimeField] DATETIME, [DecField] DEC, [DecimalField] DECIMAL, [DoubleField] DOUBLE,' +
'[DoublePrecisionField] DOUBLE PRECISION, [FloatField] FLOAT, [GaphicField] GRAPHIC,'+
'[GuidField] GUID, [IntField] INT, [Int64Field] INT64);');
SqlitePassDataset1.DatasetName := 'SampleTable';
SqlitePassDataset1.Open;
end;

This example can be found in ../demo/delphi4/Demo_Test

Be Aware that kexi databases cannot be created this way because kexi uses specials internal tables that won't be created that way. May be in the next versions...

A new package for D6 and D7 is available too. Let me know if you still have problems compiling under D7.

Luc.

Re: SQLitePass in Delphi 7

SListIndexError is at least from Delphi 6 located in RTLConsts (so the same as Free Pascal).
So Chukkan quick and dirty solution for you is (at least for 0.32 version smile) that you do change only in one place in SqlPassUtils.pas:

unit SqlitePassUtils;
{$i SqlitePassDbo.inc}
interface

uses
{$IFDEF FPC}
RtlConsts,
{$ELSE}
    {$IFDEF VER150} //This is for Delphi 7
    RTLConsts,
    {$ELSE}
    Consts,
    {$ENDIF}
{$ENDIF}
{$IFDEF WIN32}
Windows,
{$ENDIF}
Classes, SysUtils, Db;

But in further I think this compiler directives (IFDEFs smile) should be arranged similar (or almost equal) as in jedi.inc (so that
anyone can use sqlitepass instantly) file of project JEDI (JCL, JVCL,...),
because Delphi 4 is rather old and not anyone use the Free Pascal (or Lazarus framework) as first choice Object Pascal language (as in my case smile).

Re: SQLitePass in Delphi 7

I must correct myself because in new version (0.33) this is already changed.
I can report that if we add lines below to the SqlitePassDbo.inc is compilable for the Delphi 2006 (and I assume that this is valid for all versions between ver150 and ver180) compiler too  smile .

....

{$IFDEF WIN32}
  {$IFDEF VER180}
    {$DEFINE Delphi7}
    {$DEFINE Delphi6}
    {$DEFINE Delphi5}
    {$DEFINE Delphi4}
  {$ENDIF}

  {$IFDEF VER150}
    {$DEFINE Delphi7}
    {$DEFINE Delphi6}
    {$DEFINE Delphi5}
    {$DEFINE Delphi4}
  {$ENDIF}

....

Re: SQLitePass in Delphi 7

Ok,

Thanks, I will add this to the next release.

Luc

Re: SQLitePass in Delphi 7

Hi!

I try to install SQLitePass_045 under D7, and with the runtime and designtime packages,  D7 (or D6) returns a compiler error on the field   'ftWideMemo' : ie SqlitePassSqlSmts.inc  : undeclared identifier ftWideMemo

I am transferring programs from XP delphi/access -> sqlite to Ubuntu lazarus-sqlite

Can somebody help me ?

Thanks for your help

agur

Re: SQLitePass in Delphi 7

Hi Agur,

Open the ..\SQLitePass\Sources\SqlitePassDbo.inc file and undefine the {$DEFINE HasftWideMemo} compiler directive.

    
{$IFDEF VER150}
      {$DEFINE Delphi7}
      {$DEFINE Delphi6}
      {.$DEFINE HasftWideMemo} // Support Unicode ftWideMemo
      {$DEFINE NeedSqlitePassWideStringUtils}
      {.$DEFINE UseTNTComponents}
    {$ENDIF}

It should fix the problem.

Let me know in order to update the next version.

Regards

Re: SQLitePass in Delphi 7

It's now OK. ( It's the same problem with D6.)

Merci beaucoup pour cette assistance rapide ! et la qualité de ce travail.

Now I'll test the performance on large bases with blob and memo... and  begin migrating to Ubuntu

Many Thanks

agur