#1 Re: mORMot 1 » Strange index sqlite database corruption » 2022-12-07 17:24:11

Thank you very much,

May i ask yet what is the simplest way to copy all database to new one. With the preserve of IDs? I found one update query with error in my db: (ErrorCode":11,"SQLite3ErrorCode":"secCORRUPT","Message":"Error SQLITE_CORRUPT (11) [Step] using 3.40.0 - database disk image is malformed, extended_errcode=779)
And now i thinking that copy all data to new database will be the best option.

SOLVED: forceID is your friend.

#2 Re: mORMot 1 » Strange index sqlite database corruption » 2022-12-07 15:55:42

You are right, i use third party tool to check integrity.
So i tought i found something wrong, but that was simply my mistake, and my problems comes from other side. Sorry for bothered you, and other members.
I return to investigation.

Best Regards

#3 Re: mORMot 1 » Strange index sqlite database corruption » 2022-12-07 15:26:02

ab wrote:

The root should never be '' anyway.

Sorry for that - of course - i'am trying many ways and made mistake.

But I don't see any error in the log file of the gist.
And I have no problem running your dropbox project.

If you check database file data.db with integrity check there is no problems?

Ensure you downloaded the latest static files for mORMot 1 - current version of SQLite3 is 3.40.0, and from the logs, you have an older revision.
I doubt it is the root cause, but I suspect there is something wrong with your local mORMot setup.

I tested last mormot version with same results - but try it again.

#4 Re: mORMot 1 » Strange index sqlite database corruption » 2022-12-07 14:56:04

Thanks ab,
Here is a gist:
https://gist.github.com/juwo123/f48e275 … 1341c1a5bb
Here is a simple project: https://www.dropbox.com/s/j6c0kwhe1ar1p … m.zip?dl=0 - only 2 standard TSQLAuthGroup, TsqlAuthUser
I run with CreateMissingTables.
I noticed one more thing - index problem appears only when root in TSQLModel.Create([TSQLAuthGroup, TsqlAuthUser],'sss') is different than ''

#5 Re: mORMot 1 » Strange index sqlite database corruption » 2022-12-07 12:22:33

Thanks for respond. This is empty database. I only add two records and this causes (from integrity check):

row 1 missing from index IndexAuthUserLogonName
row 1 missing from index sqlite_autoindex_AuthUser_1
non-unique entry in index sqlite_autoindex_AuthUser_1

On production database with this index problem user cannot login (random user). After vacuum indexes are ok and user can login. But after few houres problem return.

#6 mORMot 1 » Strange index sqlite database corruption » 2022-12-07 09:59:43

juwo
Replies: 10

Hi,
I have users table with emails as a logonname. I found very strange thing. If i add 2 users with logonname like below then i have:
row 1 missing from index IndexAuthUserLogonName
row 1 missing from index sqlite_autoindex_AuthUser_1
non-unique entry in index sqlite_autoindex_AuthUser_1
in my database. But if i remove "_" and add this 2 users all is fine. If i change 'aa_g@ot.eu' to 'a_ag@ot.eu' also work ok.
Index problems have impact to users login. Some cannot login to database. I spent 3 days trying to isolate problem and at this moment don't have idea what to do next. I will be gratefull for any idea.
(tested on last mormot 1)

   Model_srv := CreateModel_srv('');
   Db_srv2 := TSQLRestClientDB.Create(Model_srv,nil, ed_wynik.Text, TSQLRestServerDB, false, '');
   a := TAuthUser.Create;
   a.LogonName := 'a_d@ap.com';
   Db_srv2.Add(a,True);
   a.Free;
   a := TAuthUser.Create;
   a.LogonName := 'aa_g@ot.eu';
   Db_srv2.Add(a,True);
   a.Free;
   db_srv2.Free;
   Model_srv.Free;

#7 Re: mORMot 1 » Windows authentication 64bit » 2021-12-03 08:25:20

Chaa wrote:

There is a bug in SecDecrypt.


juwo, try remove line

FreeContextBuffer(InBuf[1].pvBuffer);

from the end of function SecDecrypt (SynSSPI.pas). This should solve your problem.

Yes, this is it!
ab, Chaa, many, many thanks for help.

Special statement to ab:
i'm impressed what is going on in mormot world. Your (and other mormot devs) work, have a big impact on my professional live. I think not only my. So, thank you one more time (with small danation for today dinner smile ).

#9 mORMot 1 » Windows authentication 64bit » 2021-12-02 12:23:58

juwo
Replies: 7

Hi,
I'm fighting with this problem:
Mormot1 sources from 25.11.2021.
Delphi Seattle.
Client server app (TSQLHttpClient) tested also locally (TSQLRestClientDB) with the same error
- on 32bit all works fine
- compiled to 64bit can't login with windows auth (via SetUser('','')).
When debugging (screenshots from my breakpoints):
- https://gyazo.com/3f5bbb2422c26828a0ec898318d4bd5a
- https://gyazo.com/2a7fa19ddfcfa03f80ac8e460b7cf53f
- error coming from F8 in function Base64ToBinSafe on last "End":
https://gyazo.com/1f3613f6f9515ed6ff04e3693b9b5105

I will be grateful for any hint.

Best Regards

#10 Re: mORMot 1 » Rtree and ExecuteList » 2020-03-12 16:57:21

Sorry for bothering - solution: o.FillFrom(table, i)

Thanks for this great framework

#11 mORMot 1 » Rtree and ExecuteList » 2020-03-12 13:00:54

juwo
Replies: 1

Hi,
Since i can't find better way to use rtree index with simple max, min bound, i'm trying this way:

Model:

  TSQLObj = class(TSQLRecord)
  private
    fTyp: RawUTF8; 
    fVisible : Boolean;
    fX: TDoubleDynArray;
    fY: TDoubleDynArray;
  published
    property Typ: RawUTF8 read fTyp write fTyp;
    property Visible : Boolean read fVisible write fVisible;
    property X: TDoubleDynArray index 1 read fX write fX;
    property Y: TDoubleDynArray index 2 read fY write fY;
  end;
  TSQLObj_box = class(TSQLRecordRTree)
  private
    FminX: Double;
    FmaxX: Double;
    FminY: Double;
    FmaxY: Double;
  published
    property minX: Double read FminX write FminX;
    property maxX: Double read FmaxX write FmaxX;
    property minY: Double read FminY write FminY;
    property maxY: Double read FmaxY write FmaxY;
  end;

Query:

table := mainfrm.database.ExecuteList ([TSQLObj, TSQLObj_box],
       'select obj.id,obj.x,obj.y from obj, obj_box where (obj.rowid=obj_box.rowid) and '+
       '(minx<='+f2str(maxx)+') and (maxx>='+f2str(minx)+') and (miny<='+f2str(maxy)+') and (maxy>='+f2str(miny)+') and '+
       '(typ='+quotedstr(typ)+') and (visible=1)');

But i stuck with probably very simply problem. X and Y column are defined as TDoubleDynArray. How to access to them from table:TSQLTable. Simple table.getbytes not work. I can't figure it out sad

#12 Re: mORMot 1 » many mormot services on same computer » 2018-04-22 12:44:23

@edwinsn @ab thanks again for yours hints. I will try (for learning purpose) all suggestions. I have no words how valuable for me is mORMot. Thanks to this framework, in last few years, i discovered many new ways in pascal world.

#13 Re: mORMot 1 » many mormot services on same computer » 2018-04-20 09:52:08

Thank you. This is new field for me and these tips are invaluable. I join @edwinsn's request - any examples will be really appreciated.

#14 Re: mORMot 1 » many mormot services on same computer » 2018-04-20 06:48:49

Thanks a lot for new directions. Looks like i need to back to SAD documentation and rethink server part. But returning to my first question if i run mormot server as service for each client on different port with ssl (max. number of services is about 150) may i expect any problems?
I made some tests on weaker machine (2core, 2gb ram). I ran about 40 services and all worked very smooth. Surprisingly, since mormot is very well optimized,  processor usage was 0% most of the time (in real use with connected clients).
Of course so many services is not best solutions and definitely i need rework it. But, as temporary solution, windows server will be able to handle about 150 services? Someone has any experience?

edwinsn: thanks for reverse proxying sub-domains idea

#15 mORMot 1 » many mormot services on same computer » 2018-04-19 18:49:35

juwo
Replies: 11

I plan to deploy my application on windows server 2012 (4 core 4 Gb RAM). Standard TSQLHttpServer running as a service. Each client will be using separate database, so i will install many services (on different ports). My question is: how many Mormot servers can be installed on one computer. Is there any limitations?
(each database will be used by 2-5 users)

PS ab - Many, many thanks for Mormot. Each time i post question i'm reminding myself to make donation - same this time.

#16 Re: mORMot 1 » how to check whether server uses the same model » 2017-01-13 17:03:14

Thanks a lot for your answers. I applied @edwinsn sugestion: variable and api on server

procedure TNoteServer.Model(Ctxt: TSQLRestServerURIContext);
begin
    case Ctxt.Method of
    mGET:
      Ctxt.ReturnsJson(_ObjFast(['ver', model_ver]));
    end;
end;

That works perfectly. Thanks!

@Bo you are correct i would like to avoid problems when not all clients was upgraded, or someone upgrade clients without server

#17 mORMot 1 » how to check whether server uses the same model » 2016-12-30 11:00:13

juwo
Replies: 7

Hi,
Is it possible to check (from client side - TSQLHttpClient) whether the server uses the same data model?
For example to show message "Please upgrade your server"

Regards

#18 Re: mORMot 1 » CreateAndFillPrepare and national chars » 2014-09-06 13:17:00

Thanks for explanation and many thanks for your effort.

PS
I made small donation - I promise more when I will sell my first mormot powered application

#19 Re: mORMot 1 » CreateAndFillPrepare and national chars » 2014-09-05 18:26:05

Thanks for reply,
I tested it on last nightly zip with the same result. "LIKE" return record "=" not. I prepare simply project with my SQLite db: https://dl.dropboxusercontent.com/u/23593726/test.zip

Best Regards

#20 Re: mORMot 1 » CreateAndFillPrepare and national chars » 2014-09-05 11:01:43

After some tests:
This work fine:
sza := TSQLSzablon.CreateAndFillPrepare(form1.Database, 'Nazwa LIKE ?',[nazwa_wzoru]);
this not:
sza := TSQLSzablon.CreateAndFillPrepare(form1.Database, 'Nazwa = ?',[nazwa_wzoru]);
(only with national chars, without work as expected)

#21 mORMot 1 » CreateAndFillPrepare and national chars » 2014-09-05 10:12:22

juwo
Replies: 6

Hi,
First many thanks for great framework.
I use old delphi version (6) and have a problem with polish national chars.
Field is defined as fNazwa: RawUTF8;
How to correctly pass params in CreateAndFillPrepare when field nazwa have chars like ą, ś, ć. If field contain this chars CreateAndFillPrepare return empty list. I try StringToUTF8 - not work.

Regards

Board footer

Powered by FluxBB