#51 Re: mORMot 1 » [solved] Creating db with TSQLDBSQLite3ConnectionProperties.Create » 2022-11-19 03:26:28

OK, I was out and reading the docs without a computer to test when posting this question wink

Now just tested it, after calling TSQLDBSQLite3ConnectionProperties.MainConnection.Connect the db file will be auto created.

#52 mORMot 1 » [solved] Creating db with TSQLDBSQLite3ConnectionProperties.Create » 2022-11-18 14:54:12

edwinsn
Replies: 1

I've just started using direct SQLite db access (with TSQLDBSQLite3ConnectionProperties,TSQLDBSQLite3Connection and so on), without using the ORM layer.

The the db file is not existing yet, does TSQLDBSQLite3ConnectionProperties.Create auto creates the db file?
If not, how to create the db file?

Thanks.

#53 Re: mORMot 1 » Need imported data reference ($G) to access 'SUPERVISOR_ACCESS_RIGHTS' » 2022-10-09 09:16:55

ab wrote:

So the units are included twice?

No, just once, in the build-first package. As we know, a unit can only be included in one package.

#55 Re: mORMot 1 » Need imported data reference ($G) to access 'SUPERVISOR_ACCESS_RIGHTS' » 2022-10-09 02:25:12

So I found a solution for this issue.

According to the document: E2201 Need imported data reference ($G) to access '%s' from unit '%s' (Delphi)

The solution is to add the units that are missing imported data reference to the build-first package (which has the {$IMPORTEDDATA ON} directive).

For example, the following error is what I got today:

[dcc32 Error] E2201 Need imported data reference ($G) to access 'crcblock' from unit 'SynCrypto'
[dcc32 Error] E2201 Need imported data reference ($G) to access 'FillcharFast' from unit 'mORMot'

The solution was to add both SynCrypto.pas and mORMot.pas to my package that's supposed to be built and installed first.

#56 Re: mORMot 1 » SynZip.pas won't compile under 64bit (Delphi XE4) » 2022-10-08 14:13:31

Thanks, it works now.
Sometimes we have to bear with the Delphi compiler bugs/limitations, unfortunately...

#57 mORMot 1 » SynZip.pas won't compile under 64bit (Delphi XE4) » 2022-10-08 09:22:28

edwinsn
Replies: 2

SynZip.pas used to be compile-able under Delphi XE4 (platform = win64), but it's not now.
I'm using the latest mORMot.

Compilation error:
[dcc64 Error] SynZip.pas(896): E2032 For loop control variable must have ordinal type

The screenshot of Delphi IDE shown the error:
Syn-Zip-TZip-Write-Abstract-Internal-Add-error.png

#58 Re: mORMot 1 » Forum Search future does not work » 2022-09-22 14:53:31

I always use Google search instead of the search function provided by **any** forum software - how a forum software can beat the big G in terms of text searching wink

#60 Re: mORMot 1 » A small example in response to a question » 2022-07-20 03:29:08

Maybe put all the code in a github repository?

#61 mORMot 1 » Not very sure about when to use TDocVariant.NewFast or TDocVariant.New » 2022-07-19 08:43:16

edwinsn
Replies: 1

I know TDocVariant.NewFast is faster, but I'm still not very sure about when to use TDocVariant.NewFast or TDocVariant.New.

From the manual:

- by default, every internal value will be copied, so access of nested properties can be slow - if
you expect the data to be read-only or not propagated into another place, set
Options=[dvoValueCopiedByReference] will increase the process speed a lot
- in practice, you should better use _Obj()/_ObjFast() _Arr()/_ArrFast() functions or
TDocVariant.NewFast()

The obscure part is this:

if you expect the data to be read-only or not propagated into another place...

My json is not read-only, but what does "not propagated into another place" mean?

Thanks.

#62 Re: mORMot 1 » 'Variant method calls not supported' error when adding array » 2022-07-19 02:35:33

Oh I see.

masterJson.MyArray := arrayVar; 

equals to:

_Safe(masterJson).Value['MyArray'] := arrayVar;

Read the docs again and experimented again, I found that there are actually several ways to add an array of json objects to another json object wink

Thanks!

#63 mORMot 1 » 'Variant method calls not supported' error when adding array » 2022-07-18 15:16:54

edwinsn
Replies: 2

@ab,

I'm constructing a json object consists array of json objects, like the following:

{
	"MyItems": 
	[
		{
			"FileName": "111.txt",
			"Position": 0
		},
		{
			"FileName": "abc.exe",
			"Position": 1
		}
	]
}

Code for testing, and the 2 questions are written in the comments

procedure TForm4.btnTestAddArrayClick(Sender: TObject);
var
  i: Integer;
  itemVar: Variant;
  arrayVar: Variant;
  masterJson: Variant;
begin
  TDocVariant.New(arrayVar);
  TDocVariant.New(itemVar);
  TDocVariant.New(masterJson);

  for i := 0 to 1 do
  begin
    itemVar.FileName := 'file' + IntToStr(i);
    itemVar.Position := i;
    _Safe(arrayVar).AddItem(itemVar); // is there a better method for adding array item here?
  end;

  // the following two calls will cause 'Variant method calls not supported.' error, why?
  // masterJson.AddOrUpdateValue('ProjectItems', arrayVar);
  // masterJson.Value['ProjectItems'] := arrayVar;

  _Safe(masterJson).Value['MyArray'] := arrayVar; // ok

  ShowMessage(JSONReformat(VariantSaveJSON(masterJson)));
end;

Thanks for your help in advance!

#64 Re: mORMot 1 » A small example in response to a question » 2022-07-15 10:10:15

That's how a great library gets popularized. Well done, tbo!

Is it about mORMot 1 or mORMot 2?

#67 Re: Low level and performance » How to unzip or zip files content » 2022-07-01 02:40:23

Please also note that there are two types of comments:
- "zip file comment" and,
-  "comment of a file inside the zip file".

#68 Re: Low level and performance » How to unzip or zip files content » 2022-06-30 10:45:46

Does TZipWrite  support adding comments to the zip file?

#70 PDF Engine » Can one create bookmarks with SynPdf? » 2022-06-11 16:47:58

edwinsn
Replies: 2

Can one create bookmarks when creating a pdf file with SynPdf?
Pdf bookmarks are for navigation, you can see it as the TOC but shown on the left sidebar in pdf reader software like the folder tree in Windows File Explorer, like the following:

acrobat-bookmark-panel.jpg

#71 Re: mORMot 1 » mORMot 2 Release » 2022-06-08 06:18:26

Maybe an "Upgrade notes for mORMot 1 users" blog post is enough to get us start upgrading wink

#72 Re: mORMot 1 » mORMot 2 Release » 2022-06-08 06:16:50

Re. examples, I just pulled the latest source and found "\ex\ThirdPartyDemos\martin-doyle", I guess those samples done by Martin Doyle can already get me started.

That being said, based on your statement it seems that mORMot2 is stable for my use cases, so I might start using it instead of v1 for a new project.

#73 Re: mORMot 1 » Found sqlite-gui - a lightweit but quite usable sqlite manager tool » 2022-05-21 12:36:40

I main sqlite db tool is https://sqlitestudio.pl/

I've tried many in the past this one is the best IMHO.

#74 mORMot 1 » Found sqlite-gui - a lightweit but quite usable sqlite manager tool » 2022-05-21 11:06:56

edwinsn
Replies: 3

Found it over the weekend:

https://github.com/little-brother/sqlite-gui

It's written in c, very small in size, but seem to have enough function to be useful.

#75 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-17 15:12:08

@ab,

I think both routing syntax is OK as long as it's flexible enough and can also route to a method-based service wink

#76 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-14 03:42:17

ttomas wrote:

@ab,
Another idea

HttpServer.Route('$/$/overview', 'http://dynamicserver1.net/restroot/overview?lng=$&product=$');

Converting httpserver to proxy/gateway where dynamicserver1.net can dynamically add route to httpserver on start.
I know this is more complex change. Just idea.

If what you are proposing is possible with mORMot, when we can write a 'load balancer' with mORMot? big_smile

#77 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-14 03:39:38

@ab,
What your proposed above for mORMot2 is a very clean but useful idea I think! And it just meets the requirement I suggested above.

#78 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-14 03:29:51

ab wrote:

Or you have the THttpServerGeneric.OnBeforeRequest event which allows to change the URI on the fly before it is actually sent to the REST server(s).

I have just made THttpServerRequest URI/Method fields writable - could be customized in this OnBeforeRequest event handler.
See https://synopse.info/fossil/info/02c03e4147
and https://github.com/synopse/mORMot2/commit/898858e9

I did not test this method, but I guess this is soon enough to customize whatever input you need, and make internal redirection.

Thanks! From what I read and understand, I think the changes will help achieve the URL directing I want.

#79 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-14 03:24:58

igors233 wrote:

Why not make language a root, so you'll have en root and de root?

Because everything about the languages and product names are dynamic.

#80 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-13 12:31:27

pvn0 wrote:

You can with nginx, I don't use IIS. I don't know why you would want to remove method name, with mORMot you can dynamically link a method to any string using TRestServer.ServiceMethodRegister(...).

Consider a website that's mostly for representing products and you might have the following pages:

http://server.com/en/product1/overview
http://server.com/en/product1/reviews
...
http://server.com/de/product2/overview
http://server.com/de/product2/reviews

The URIs above is obviously cleaner than something like:
http://server.com/root/www/en/product1/overview

And that's why I want to remove both the root name uri and method name (www in the above example)  in this case.
Hope it makes sense.

#81 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-13 10:18:23

ok, maybe pvn is right, to handle it with the reverse proxy like IIS or nginx.

I guess the reverse proxy can also hide the method name? I mean, currently for method-based service in mORMot, the URI will be like:
http://server.com/root/methodname

Can I remove both the root and method name? I use IIS and I wonder if can point to to some technical article or tell me which keywords to use for googling wink

#82 Re: mORMot 1 » Enhanced URI routing for method-based services » 2022-05-13 08:01:58

@ab, Can overriding TSQLRestServerURIContext.URIDecodeREST retrieve the following URI resolving?


http://server.com/[language]/[companyname]/[contact or teams or overview]?

Note, there is no root nor method name are specified in the above URI.
If not, how can I achieve the above URI resolving? Thanks.

#83 Re: mORMot 1 » Benchmark PostgreSQL, SQLite and mORMot » 2022-05-01 15:37:45

@tihory,

From your description I guess you might have misunderstood the batch updating mode in mORMot.
Basically, it's a cache you put your updated, deleted or newly added records in a **cache**, then send all the data in a single shot.

I don't use Postgresql with mORMot, so couldn't comment.

#84 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-05-01 07:22:27

pvn0 wrote:

I would 100% expect tortoise to not auto overwrite your modifications if the two conflicted. Maybe you encountered a bug like you said but this just sounds normal operation to me.

Actually my manual changes to the SynCommons.pas file were not shown in the above screenshot at all, my changes were in other lines, all are similar to:

//{$define DOPATCHDISPINVOKE}

these change of mine are not shown in the above screenshot.
So I'm 100% sure the code differences shown in the above screenshot were not done by me wink

#85 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-30 03:28:09

ab wrote:

The commit in the above screenshot is indeed a real commit, https://github.com/synopse/mORMot/commi … 0717d58c5a
smile

Yes, I knew it's a real commit, what I said I don't know is why svn didn't merge it correctly smile

PS, may this case of mine can be listed in that kind of "what strange bugs you've experienced" article wink

#86 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-29 13:52:30

pvn0 wrote:

Nice that you found out why but it really isn't the tools fault, there was clearly a conflict with your manual changes.

Thanks for your comments, but no no no, the code differences as shown in the screenshot I posted above IS NOT my manual changes, I did not change those two lines.

I actually don't know why the code differences existed, my changes were located in other 3 lines related to the `DOPATCHTRTL` definition. The screenshot above was captured after I synced my changes to the latest downloaded source and only leaving the mysterious code differences as shown in the screenshot.

sorry I didn't make it clear.

#87 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-29 09:10:32

Wow! Unbelievable! The issue is neither coming from the mORMot code nor my code, it's an issue of TortoiseSVN - I use TortoiseSVN to download latest mORMot source from github and since I've done minor changes in SynCommons.pas, it somehow  failed to update/merge that file. See attached screenshot.

I think I should now switch to a real git client to pull public code, but I really like TortoiseSVN shows what files were changed/added after executing the "Update" command.

m-ORMot-Syn-Commons-compare.png

#88 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-29 07:58:14

OK, I'm getting  the following error:

Project My_Server.exe raised exception class EORMBatchException with message 'TDbServer.EngineBatchSend: Unknown @GeneralEvent'.

Where GeneralEvent is a table name.

Strange, I check the project's svn logs and there is no recent changes, but just updated mORMot. But I don't know where and the old mORMot revsion. I think now I should have a text file for recording each time I pull the latest mORMot source to local...

#89 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-29 04:35:06

ok, another related issue must be related - in a project that's not using the mORMot authentication (aHandleUserAuthentication is False for TSQLRestServerDB.Create), the batch update operation is no longer allowed - BatchSend returns HTTP_FORBIDDEN 403

I will now have to check mORMot commit logs one by one to determine which revision changed the behavior...

#90 Re: mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-27 13:40:28

ok, Since I use the default 'User' user,  I guess it has something to do with the fact that in `TSQLAuthGroup.InitializeTable`, it excludes the `reSQLSelectWithoutTable` attribute:

...
          Exclude(A.AllowRemoteExecute,reSQLSelectWithoutTable);
...

#91 mORMot 1 » Suddenly getting "Method Not Allowed" after updated mORMot » 2022-04-27 13:26:04

edwinsn
Replies: 10

@ab,

I'm using `ExecuteList` without supplying the `Tables` parameter, something like:

myDbClient.ExecuteList([], 'select...')

Both the client and the server has been running ok for years (the mORMot version was last years), but recently after upgraded to the latest mORMot, the client is getting 'Method Not Allowed' errors, but I couldn't identify since which revision of mORMot the issue is start raising.

Does it have anything to do with reSQLSelectWithoutTable or TSQLAllowRemoteExecute? Please advise how to make ExecuteList work without supplying the `Tables` parameter. Thanks.

#92 mORMot 1 » postlite - enables remote sqlite db admin using existing GUI tools. » 2022-04-01 12:33:54

edwinsn
Replies: 0

In short, postlite sits between a Postgres database management GUI tool and a SQLite db.

https://github.com/benbjohnson/postlite

But I'm afraid it won't support dbs created by mORMot since mORMot uses custom collations...pity..
What do you think @ab?

#93 Re: mORMot 1 » Abort long running sqlite query » 2022-03-16 05:24:19

First time heard of the `sqlite3_interrupt` function, it seems to be very helpful!

#94 Re: Low level and performance » an idea - include FastBase64_EncDec in benchmark next time » 2022-03-14 08:03:05

@ab,
Oh I see, you are professional in this area, and I only look at the description.

#95 Low level and performance » an idea - include FastBase64_EncDec in benchmark next time » 2022-03-14 00:31:35

edwinsn
Replies: 2

@ab,

Just an idea - in case you are interested, this is a new Base64 encoder which you can include in any benchmark wink

https://github.com/fatihtsp/FastBase64_EncDec

#96 Re: mORMot 1 » SQLite 3.38.0 supports JSON path in query now! » 2022-02-28 13:34:19

Great! Downloading wink

Thanks for your great job, as aways!

#97 mORMot 1 » SQLite 3.38.0 supports JSON path in query now! » 2022-02-27 14:43:18

edwinsn
Replies: 3

You can now query JSON stored in a table like this:

select id, name, interests from user 
where interests->'likes'->>'[0]' = 'skating';

It's very convenient!

More details: https://tirkarthi.github.io/programming … ments.html

#98 Re: mORMot 1 » Stop the war! » 2022-02-25 08:39:09

@MPV,
Sorry to hear about that, take care of yourself and your family and stay safe!

#99 Re: mORMot 1 » mORMot 2 ORM Performance » 2022-02-16 09:56:32

Great! Thanks for clarifying things.

#100 Re: mORMot 1 » mORMot 2 ORM Performance » 2022-02-16 09:28:37

Great news!

@ab, one suggestion - while new projects should use mORMot2, there might be old projects that'll keep using mORMot1.
So the question is - will it possible to use both mORMot v1 and v2 in the same time? Even in the same project?

Board footer

Powered by FluxBB