You are not logged in.
@Vitaly
Why not use NewPascal ? That is trunk !
Perhaps caused by this:
https://sourceforge.net/p/zeoslib/code-0/3951/
Well, this one is much more complicated !
No mORMot code, ZEOS (version ?), Postgresql (version ?), no code at all.
Hard to solve/help for me ...
As a temporary fix, while waiting for Ab, please change this in mORMot.pas:
In function
function TTypeInfo.EnumBaseType: PEnumType;
{$ifdef FPC}
var base: PPTypeInfo;
begin
result := PEnumType(GetFPCTypeData(@self));
// no redirection if bool <------------------- add
if TTypeInfo(self).Kind=tkBool then exit; <------------------- add
ab,
+1 !!
Please follow Ab's advice: use mORMot trunk.
It will run very well with FPC !
But do follow the documents when using FPC !!
http://synopse.info/files/html/Synopse% … l#TITL_113
Good !
Some updated info about FPC/Lazarus and RTTI.
The whole rtti branch of FPC is abandoned. But it is also not needed anymore.
Just use NewPascal: it has all the RTTI (and more) you need for the mORMot. See http://synopse.info/forum/viewforum.php?id=21
Or use fpcupdeluxe to install NewPascal anywhere you want ! See https://github.com/LongDirtyAnimAlf/Rei … /tag/0.99c
Yep.
The most simple way to get Lazarus working with the mORMot, is just to open the dpr file as a normal Lazarus project.
Lazarus will then ask you if it has to create a Lazarus project.
Select Simple Program for command line samples.
Select Application for samples with a form.
After that, set the correct paths for
"Other unit files" ... has to point to both the mORMot base directory and the SQLite3 directory.
"Include files" ... has to point to the mORMot base directory.
That's it !
Yes, you can. And should ... ;-)
However, this separate mORMot is (only) created for the benefit of the NewPascal initiative.
This NewPascal has some features that require (small) changes in the mORMot source.
If things are more or less stabilized, the changes could/should be merged with official mORMot. After review.
Much better to have a single source, also because changes required are minor.
But untill then, you are free (with FPC) to use the special mORMot !
Latest mORMot for FPC here: https://github.com/newpascal-ccr/mORMot/
With CodeTyphon, you need to change a setting (synopse.inc):
{$ifdef VER3_1}
{$define ISFPC27}
{$define HASDIRECTTYPEINFO} // <-------------------------------- enabled for CodeTyphon !!!!!
// define this for trunk revisions older than June 2016 - see
// http://wiki.freepascal.org/User_Changes_Trunk#RTTI_Binary_format_change
{$endif}I just ran Sample 01 on Linux64 with fresh CT out-of-the-box !
We (NewPascal team) are maintaining a special version of the mORMot for NewPascal that is tailored for FPC.
See: https://github.com/newpascal-ccr/mORMot
This version fixes your error.
See latest commit: https://github.com/newpascal-ccr/mORMot … d82044a2fe
Also, see NewPascal intiative for more options and features (especially for the mORMot ... interface RTTI) !!
http://newpascal.org/
Good news !!!
Some recent changes in FPC trunk (optimizers for i386 by Florian) now allow for a flawless mORMot with -O0, -O1, -O2 and -O3 on i386 !
NewPascal release will soon be updated to include these changes.
You could try NewPascal.
http://newpascal.org
Look also at its releases.
In ccr, you will find the mORMOt for FPC and Lazarus.
This question has been asked before.
There is no row security feature. As there is no column security feature. Only table security.
You have to write your own method to get (limit) the data you want.
I have been struggling with the same !
Anyway, thanks for sharing your code Maciej !
Hi Maciej,
I would be very very interested in these offline features and auto-sync.
In my case, a lot of data-acquisition systems are running with the mORMot. They store local and must sync remote.
Any intelligence to handle this (without me reinventing the wheel) would be a very welcome addition.
And for Android, it is nearly a natural must-have-feature.
The core code for improved master/slave replication (rejected by ab)
Is this a redundant feature, already available ? Or any other reason ?? Any hint would be welcome.
@hnb
Thanks for your info. Will use your settings.
(about your code-snippet: nice, but why a class function with a GClientPing that must have been created somewhere ?)
While we are discussing Android, I have a few more Android related questions. I would appreciate your opinion.
How do you handle off-line functionality ?
I am now doing the following:
On the Android device itself, I have a slave database that is a slave of the remote master database.
The app always connects with this slave, unless there is a connection available with the master.
Problem: the slave database can be read by anybody with some hacking knowledge (master is safe and can be ecrypted).
Main question:
How to handle off-line behavior in a secure way, while not loosing to much functionality ?
On mobile, off-line behavior is very important !
@hnb
According to your experience, what are sensible values for the three timeouts on Android ?
Just checked with FPC fixes (3.0.1 = future 3.0.2) : same error.
Pointers are initialized correct: the version string is received (3.14.1).
Again, after sqlite3 := TSQLite3LibraryStatic.Create, all function pointers are set to the value of initialize (@sqlite3_initialize) !!
Screenshot: https://drive.google.com/open?id=0B96fg … UdXMXk5MEU
As you can see, the version is received correct. After that .... ??????
Found the error for static on Linux !
No solution however.
Description:
In constructor TSQLite3LibraryStatic.Create all functions are assigned correctly.
I can see their correct (pointer) values.
I have removed anything else from this constructor. So only the function assignments are there.
If the debugger jumps over the sqlite3 := TSQLite3LibraryStatic.Create; all function pointers are set to the value of initialize (@sqlite3_initialize) !!
????????
@warleyalex
Just checked : mORMot contains all necessary patches to run for 100% on Linux i386 !
My system result:
https://drive.google.com/open?id=0B96fg … UU0SlhPOWc
So, unfortunately, I cannot reproduce.
@warleyalex
My Linux mORMots run on Arch Linux 64 bit, in the cloud thanks to Amazon Web Services.
Never had a single problem. I have never tried Kylix.
The final problems you encounter with Linux are known.
The record error is a simple (FPC) string problem that is not relevant nor solvable by the mORMot.
Some time ago, I have solved the DDD error (time consuming), but it got lost.
Will try to find it again.
Look here: http://synopse.info/forum/viewtopic.php … 363#p20363
You need
{$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING}
{$ifdef CPUARM}
//if GUI, then uncomment
//{$linklib GLESv2}
{$endif}
{$linklib libc_nonshared.a}
{$endif}
{$endif}Put the above at the start of your lpr/dpr !
This:
Paths --> Libraries (-Fi): C:\NewPascal\cross\lib\i386-linux\; C:\NewPascal\cross\bin\i386-linux\
should not be necessary (I hope).
Dynamic linking:
synopse.inc:
{$ifdef LINUX}
{$ifdef CPUX86}
{.$define FPCSQLITE3STATIC} // disable with dot !! <----------------------------
{$endif}
{$endif}Thanks !
FPC 3.1.1 from where ?
Linux: also try dynamic linking (more or less the normal practice for Linux).
The interfaceRTTI branch of the compiler from SVN does not work (does not compile). So don 't use it.
All "FPC features" of the mORMot from https://github.com/LongDirtyAnimAlf/mORMot are already included in the oficial mORMot. So don 't use it.
Unfortunately, there is no official FPC with interface RTTI.
Best Windows sources for FPC with RTTI:
http://newpascal.org/
https://github.com/dathox/newpascalpack … ss-v1.0.22 (also for easy cross-compiling towards Linux and Android)
Best Linux sources for FPC with RTTI:
Use fpc(laz)up and build the right FPC/Laz yourself.
FPC fixes: fpclazup --fpcURL="fixes" --lazURL="fixes" --fpcPATCH="fpc300rtti.patch" --verbose
FPC trunk: fpclazup --fpcURL="trunk" --lazURL="trunk" --fpcPATCH="fpctrunkrtti.patch" --verbose
Fpclazup: https://github.com/LongDirtyAnimAlf/Reiniero-fpcup
@Ab
Thanks ! Looks to be working as expected.
Another addition (delete) that would be nice, but I am very unsure about the correctness of my code.
I am using it, looks to be working, but doubts remain. Be you the judge !
procedure TSynSQLTableDataSet.Delete;
begin
CheckActive;
if IsEmpty then exit;
if State in [dsInsert] then
begin
Cancel;
end else begin
DataEvent(deCheckBrowseMode,0);
DoBeforeDelete;
DoBeforeScroll;
Table.DeleteRow(RecNo);
SetState(dsBrowse);
Resync([]);
DoAfterDelete;
DoAfterScroll;
end;
end;You're welcome.
Question: would it be an idea to include the (below) simple locate code into TSynSQLTableDataSet ?
TSynSQLTableDataSetWithLocate = class(TSynSQLTableDataSet)
public
function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions) : boolean; override;
end;
function TSynSQLTableDataSetWithLocate.Locate(const KeyFields: string;
const KeyValues: Variant; Options: TLocateOptions): boolean;
function SearchForField(const aLookupFieldName:RawUTF8;aLookupValue:variant):boolean;
var
f,r: integer;
begin
result:=false;
f := Table.FieldIndex(aLookupFieldName);
if (f<0) then exit;
r := Table.SearchFieldEquals(VariantToString(aLookupValue),f);
result:=(r>0);
if result then RecNo:=r;
end;
var
i, l, h : Integer;
FieldList: TList;
begin
Result := inherited;
CheckActive;
if IsEmpty then exit;
Result:=True;
if VarIsArray(KeyValues) then
begin
FieldList := TList.Create;
try
GetFieldList(FieldList, KeyFields);
l := VarArrayLowBound(KeyValues, 1);
h := VarArrayHighBound(KeyValues, 1);
if (FieldList.Count = 1) and (l < h) then
begin
if SearchForField(KeyFields,KeyValues) then exit;
end
else for i := 0 to FieldList.Count - 1 do
begin
if SearchForField(TField(FieldList[i]).FieldName,KeyValues[l+i]) then exit;
end;
finally
FieldList.Free;
end;
end else
if SearchForField(KeyFields,KeyValues) then exit;
Result:=False;
end;@all.
For TvPlanit, a new datastore was made, based on the mORMot.
Just for the fun of it ... ;-)
Source:
https://github.com/LongDirtyAnimAlf/mORMotTvPlanit
Release:
https://github.com/LongDirtyAnimAlf/mOR … es/tag/1.0
Lazarus forum:
http://forum.lazarus.freepascal.org/ind … 20583.html
Yes !
Could you imagine ... the power of mORMot with Delphi starter ... all for free !!
Unfortunately ... just limited in time ... at least the Delphi part.
For a limited time (ends 9 sep 2016), Delphi starter for free !!
@mpv
Would be good to ask the FPC devs on the FPC forum.
@Bo
The whole NewPascal install that has been made available at
https://github.com/LongDirtyAnimAlf/fpc … i/releases
has been made with fpclazup.
So, it would be fairly simple to make your own with fpclazup.
Also, it has clearly been stated that this release only works in C:\NewPascal.
Being a work-in-progress, please accept the limitations at this moment.
More features will be added in the future !
Hi Maciej,
The library was added into the demo to give the user an out-of-the-box experience when using this demo, without changing the original source too much.
As an extra, the very nice generic library also gains more visibility towards users that do not know of its existence !
Greetings, Alf.
ps:
may I add a feature request ?
a threadsafe list ?
;-)
You could investigate two other possibilities, also to be explored with the help of FPC.
1) make a library (.so) with FPC and export some (ORM) methods to be used directly by you Delphi client.
2) make a localhost server (.so library) with FPC and connect with localhost with your Delphi client (exported methods: StartServer, StopServer).
You have to include this library into your Delphi app.
For sure.
And, for your info, I have executed much more complicated SQL with the mORMot, without any problem.
So, you will be able to reach your goal ! But you have to debug every single step to get to your particular problem.
lSQLTable := Client.ExecuteList([], sSQL);
writeln(lSQLTable.GetJSONValues(True));Then you have to dig deeper : what is the output (JSON) of :lSQLTable.GetJSONValues, after you executed your SQL ?
Have you tried to run your SQL on your table from within some kind of database test environment, to validate your SQL string itself ?
(for SQLite3, I use http://sqlitebrowser.org/)
sSQL := 'select a.Kode, a.Nama, a.DefaultValue, a.Description , b.Kode as UOMKode ' + <-----
' from AssetProperty a' +
' LEFT JOIN UOM b on a.UOM = b.ID ' + <------
' ORDER BY a.Nama;'; <----No hints from me yet ... ;-)
I am eagerly awaiting fixes 3.0.2, to try to fix the remaining problems !!
So, you just need a bit of patience ...
Current trunk has some optimalization problems. Please try -O1 as optimization level.
@Chaa
We will allow changes. But this is just a preview. Final will have a small app that adjusts all paths to whatever location you want.
@edwinsn
Will check your remarks ... one moment ...
Edit: checks done
Win64 issue:
I cannot reproduce.
Files are there (C:\NewPascal\fpc\units\x86_64-win64)
Cross-compiler is there (C:\NewPascal\fpc\bin\i386-win32\ppcrossx64.exe)
mORMot64 runs out-of-the-box.
Linux issue:
For cross-compiling towards Linux from Windows, you indeed need:
{$ifdef FPC}
{$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING}
{$linklib libc_nonshared.a}
{$endif FPC_CROSSCOMPILING}
{$endif Linux}
{$endif FPC}in your dpr or lpr file.
With this added: out-of-the-box success !
(naturally, after installation of static link files, if needed: http://synopse.info/files/sqlite3fpc.7z)
@hnb
Sure !!
Btw, I tried to add these releases into your repo, but I did not succeed.
In fact, I want them into NewPascal ! :-)
The thing that is not ok ATM, is the fact that you need to install into c:\NewPascal.
So, a script, or a small app to adjusts paths would be nice.
But again, we are still moving towards full integration. NewPascal perfection is lingering in the near future ... ;-)
Ok.
I have created a NewPascal release that can also be used for cross-compiling.
Win64 is included in the base.
As always with these types of releases, you have to follow the install instruction.
Things will not work otherwise !
This install is fully self-contained. Will not influence other FPC or Lazarus on your system.
In the future, these releases will be easier to install.
Here you go:
https://github.com/LongDirtyAnimAlf/fpc … i/releases
ps:
fpclazup is included, together with install-scripts.
you can use this to compile your own self-contained version of NewPascal !
@Chaa
I hope you mean by "your project" my version of FPC on GitHub (https://github.com/LongDirtyAnimAlf/fpctrunkrtti).
Answer.
Nothing. But mine is just an older version of FPC trunk. With only the RTTI for interfaces as an extra.
To prevent further fragmentation, I decided to join the newpascal effort.
NewPascal has already interface RTTI. And is updated on a daily base. And will contain more (sometimes bleeding edge) improvements by other contributors.
It has its own website, which will (also, hopefully) become a meeting place for mORMot and FPC users.
Its still in its development phase however. So, you have to be a bit patient ... ;-) ... until all quirks are solved ... !
I am preparing a whole FPC/Lazarus suite, 100% based on newpascal.
Including cross-compiling.
Will replace the old RTTI repo by me.
Good !
Would you mind trying the normal latest official mORMot too ?
My "longdirtyanimalf" version will be removed sooner or later, because all changes are added to the official mORMot !
Just downloaded latest mORMot, compiled and ran TestSQLite3.exe 32bit on my Win8.1 codepage 1252 machine: 100% success and (as a trivial result) no AV.
My conclusion: there is something special about your PC or your mORMot / FPC setup !?
@edwinsn
No, its not (yet) the same.
But I think the main goal for NewPascal will be to get rid of the framentation and bring everything (and everybody) together.
So, I will work together with the NewPascal founders to have one access point for a FPC that is, among other features, tailored to run the mORMot on all platforms.
Cross-compile support will be included naturally !
Stay tuned.
I am sorry, but I do not know how to help you with this error.
The compressed string is just a string. So, it should work.
However, many problems stem from utf8 / ansi codepage problems.
Perhaps you could try base64 encoding of your string ?