#1 mORMot 2 » Prepared statements without using ORM files » Yesterday 16:10:56

vennexedu
Replies: 1

Hello,

is it possible to use prepared statements with TTextWriter in SQLite3 with just the low-level functions and without higher ORM .pas files? And would that possibly yield a performance boost on a single PC system?

#2 Re: mORMot 2 » Type-Casting from String to RawUTF8 » Yesterday 13:47:17

Thank you! In now use TTextWriter.AddNoJsonEscapeString() instead of AddString and the conversion warnings are gone. I also found AddComma, so instead of writing '),', I can simply use Add(')') and then AddComma. AddNull also comes in handy.

#3 mORMot 2 » Type-Casting from String to RawUTF8 » Yesterday 12:01:46

vennexedu
Replies: 2

Hello,

is it more efficient to type-cast from String to RawUTF8 or to use RawUTF8 directly and implement new functions that return RawUTF8? And is the performance enhancement significant or marginal? I am talking about several million conversions overall.

Edit: Is there a function in TTextWriter that takes a string as an argument and converts it to RawUTF8 internally? I just want to avoid all the warning about implicit type conversions.

#4 Re: mORMot 2 » BEGIN CONCURRENT transactions implemented? » 2024-11-15 15:04:24

But are your columns dynamic or static? Because mine are dynamic and therefore ORM wouldn't make sense for me, right?

#5 Re: mORMot 2 » BEGIN CONCURRENT transactions implemented? » 2024-11-15 07:44:54

So there's actually no way to write concurrently into the SQLite3 db? Yes, I use low-level access, so to speak. I suspected high-level ORM functions to be slower than direct access. First I used a single thread for writing into the DB that collects the strings of multiple threads with direct access. That was relatively fast though. I use TTextWriter, btw. It's brilliant!

But shouldn't multi-threading be possible with SQLite3 if we use THREADSAFE=2? My data consists of records, each of which doesn't have an index (maybe that's the bottleneck?), but a timestamp and a box number, whereas the combination makes this record unique. I thought that since each row in unique, SQLite3 would use different b-trees for each entry. The order in which the rows arrive does not matter since we sort them afterwards anyway. I know it's not an SQLite3 support forum, but mORMot2 and SQLite3 are a bit intertwined. smile

#6 Re: mORMot 2 » Delphi Package (.dkp file) » 2024-11-14 21:31:35

A little update: Installing the package worked well and now my string building and db insertion combined is about 40% faster than before! Thanks a lot!

#7 mORMot 2 » BEGIN CONCURRENT transactions implemented? » 2024-11-14 21:29:38

vennexedu
Replies: 5

Do transactions with the flag "BEGIN CONCURRENT" exist in mORMot 2 as specific methods? So far I couldn't find this option anywhere. I'm trying to write into my SQLite3 db concurrently with multiple threads, but first I got "db is locked" errors and after using "BusyTimout := 10000" I get "NOTADB" errors. I already use WAL2 mode. Couldn't find this one implemented in mORMot 2 either. I'm also using serialized mode. Is there a way to change it into multithread with the library? I figured it's possible with "BeforeInitialized".

#8 Re: mORMot 2 » Delphi Package (.dkp file) » 2024-11-13 11:27:03

Thanks a lot. I will try this one out. Would you care to share how you created that package so I could make my own ones as well?

#9 Re: mORMot 2 » Delphi Package (.dkp file) » 2024-11-13 10:43:44

Javierus wrote:

I have a big package with all the mormot2 units on it
I don't have any multithreading knowledge, and so don't know if the threadvars will work properly on a package. I suppose they will, but as I said, I can't really judge

Hello Javier. Would you be so kind to share this package with me? It would really help me out a lot! I use Delphi 11.3. Don't know if that matters though.

#10 mORMot 2 » Delphi Package (.dkp file) » 2024-11-12 21:43:20

vennexedu
Replies: 9

Has anyone here tried creating a Delphi package from /src and would like to share how he did it or even share the file? I use Delphi 11.3.

Board footer

Powered by FluxBB