You are not logged in.
Great! A very helpful reference!
Happy new year! I'm eager to see what improvements for mORMot will come in the new year! I'm especially excited about the linux server-side support ![]()
That's great, MPV! The current SyNode is already a great achievement you have achieved!
Thanks for your comments, very helpful!
Today I came across this go snippets, which directly support HTTPS (via let's encrypt) on the server side. Quite interesting, so I thought I'd posting it here as food for thought ![]()
package main
import (
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
"net/http"
)
func main() {
certManager := autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist("example.com"), //your domain here
Cache: autocert.DirCache("certs"), //folder for storing certificates
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world"))
})
server := &http.Server{
Addr: ":443",
TLSConfig: &tls.Config{
GetCertificate: certManager.GetCertificate,
},
}
server.ListenAndServeTLS("", "") //key and cert are comming from Let's Encrypt
}https://stackoverflow.com/a/40494806/133516
update 1: Synapse can do HTTPS on the server side: http://synapse.ararat.cz/doku.php/publi … ttpsserver
Leslie, that's very true! Maybe the initial transition is kinda uncomfortable, but the gains afterwards will be gigantic in terms of extensibility and freedom.
@Leslie7,
If we just talk about the cons (thus trying to overcome it), I think the biggest lost for a Delphi developer to transit to Lazarus is the **productivity lost** - the Change of the IDE, this lacking of the excellent IDE plugins such as MMX, GExperts, etc...
The Indy forum is http://forums2.atozed.com/viewforum.php?f=7, but is not accessible right now.
Running using WINE, screenshot below. there is also a wineconsole command for running windows console programs. I haven't tested it further, although I deeply wish to develop with Delphi but this non-native approach must have some limits...
update: xubuntu is so much faster and smoother than Linux Mint, which is already faster and smoother than the official Ubuntu desktop.
your ORDER BY statement seems to be correct. From the error message I guess it might doesn't related to the ORDER BY clause
Try remove "order by DispOrder" and try again to identify the source of the error first.
I just use TSQLRecord-descendants, it feels handy, simple and no over-abstraction, and so far I don't see any drawbacks.
I know people must use DDD/DTO for a reason, but so far I feel it's a little over-abstraction for my own purpose, I might be wrong ![]()
@mpv, if I'd create pull request, I'll use gitkraken, otherwise use tortoiseSVN.
hi ab,
TortoiseSVN does the job so good except the above mentioned small glitch that I cannot avoid.
And feeling "so last century" is not the correct reason to avoid a handy tool, you know, Delphi/Pascal is much older than SVN, all after all, TortoiseSVN did not exist until 2002 ![]()
Another possible reason - I usually checking out github repository with TortoiseSVN, and from time to time several lines of the .dpk file would become mangled, for example, "requires" would become "rrequire", "end" would become "nd".
I don't know why, just fix them manually.
Oh I see. Thank you ab.
Hello ab,
Sqlite FTS4 supports the 'notindexed' directive for excluding a specific column from indexing, when creating the table, for example:
CREATE VIRTUAL TABLE t USING FTS4(uuid, document, notindexed=uuid);Some details here: https://stackoverflow.com/a/18531449/133516
How to achieve this for TSQLRecordFTS4Unicode61?
Thanks.
I'm quite sure that **all files* related to the new Synode which is based on SpiderMonkey 52 is located in the 'SyNode' subfolder. And it seems that the new SyNode allow has support the the old SM45?
I'm quite sure the above is correct. But I've another observation I'm not certain of - The unit files for SM24 are located in the mORMot root folder, right? For example, SynSMAPI.pas, where I found the 'mozjs-24.dll' constant.
If so, I suggest to put all units related to SM24 into a sub-folder, to make things clear.
There are also sample projects still using SM24 in the '\SQLite3\Samples' sub-folder.
Just my 2 cents.
I agree.
JS engine for Linux? Well done MPV!
whenever I read 'dom' I think of the html DOM or XML DOM ![]()
@esmondb, that's a good hint!
use SQLITE's JSON1 syntax.
To work around the situation oz described, I think only "ID > ?" should be used with the LIMIT keyword, instead of using "id>=? AND id<?".
Reference: http://sqlite.org/rowvalue.html#scrolli … ow_queries
Hello,
So on the server-side function "/admin/resetpassword", instead of returning a HTML page, you return a JSON string, right?
Thanks.
Great ab!
@ab,
Well, after further testing, looks like the issue is not that DateTimeToSQL is not working, it DOES work.
But the SQL logged by the engine is not expected to be run by sample 12 - SynDB Explorer...
@ab,
Tried, it doesn't seem to work - without DateTimeToSQL, the TDateTime values in the resulting SQL look like this:
WHERE ((IsDisabled=:(0):) AND (StartTime <= :(42977.7362847222):) AND (EndTime >= :(42977.7362847222):))Hello ab,
I hit by this issue several times, so I thought I should post it here ![]()
The issue is that, following documentation https://synopse.info/files/html/Synopse … l#TITL_36), when querying with a TDateTime parameter wrapped by DateTimeToSQL, like following:
var
svrTime: TDateTime;
whereClause: string;
begin
...
whereClause := '((StartTime <= ?) AND (EndTime >= ?)) ORDER BY Priority ';
arbiPromoHdr := TSQLArbitraryPromo.CreateAndFillPrepare(aDb, whereClause, [DateTimeToSQL(svrTime), DateTimeToSQL(svrTime)]);
...
end;It'll return no result. It seems that the problem is coming from the SQL generated by the engine, check this screenshot below, I got the SQL from the engine's log file:
I removed the
:) prefix/postfix, the query still return no result.
The query will return the correct result, if I removed the mystery character before the datetime value, which I believe is JSON_SQLDATE_MAGIC
Not sure if I'm doing anything wrong, I followed the docs. I'll be appreciated if you can give me any hints.
That'll be a disaster for the mORMot project and its users.
@linbren, I think it's been included in the official mORMot package: https://github.com/synopse/mORMot/tree/ … qlite-demo
Since there are old databases not created by the mORMot framework, it'll make it hard to recreate mORMot's ActiveRecord objects. So if were you I'll do the following:
- Retrieve records from the source databases using TSQLTableJson;
- Use a TClientDataSet to consolidate all the 3 TSQLTableJson tables.
- Generate report from the data stored in the in-memory TClientDataSet.
That must involve a great amount of refactoring work, if ab go for it.
@ab,
I believe changing the name mORMot will take a lot of work and might introduce confusion since the name's been in use for so many years.
Maybe what we need is a simplified overview and getting started document written from a different perspective, or a lightweight wrapper around mORMot ![]()
@ab, I see.
It fixes a bug about auto-vaccum and I suggest mORMot to upgrade.
Hey Arnaud, I might be wrong, but since the rest db server is multi-threaded, will it possible for thread B to commit/rollback the transaction started by thread A? If yes, is it a design pitfall?
Sorry if I'm wrong.
I think I should call fServer.Db.Lock to get exclusive access to the database server on the server-side.
Correct me if I'm wrong. Thanks.
Hello Ab,
This is the second followup to this post: "cannot rollback - no transaction is active" error
I found new info - by looking at the logs, the error might caused by mix-up of **server-side** DB transactions (executed in a service method) and DB transactions initiated by batch operations, and I'll illustrate the problem with simplified pseudo code below - though I might be wrong.
// This is a server-side method that will query and update the db.
function TServerApi.ServerFuncA(): String;
var
isLocalTrans: Boolean;
begin
...
isLocalTrans := fServer.TransactionActiveSession < 1;
try
if isLocalTrans then
fServer.TransactionBegin;
fServer.Upate(TSQLTableA, ...);
// I guess the DB TRANSACTION has been committed by a batch-mode operation
at this point, thus the following Commit command will fail, thus the exception's
caught below and Rollback is called, thus causing the
"cannot rollback - no transaction is active" error.
if isLocalTrans then
fServer.Commit;
except
if isLocalTrans then
fServer.Rollback;
end;
...
end;The issue is causing my server program to hang. One idea occur to me is to **lock** the DB access in the server-side method above, but how? Thanks.
Yes, I agree with afarias, it's great to know about that!
BTW, this service is not very cheap, the pricing page is here:
https://azure.microsoft.com/en-us/prici … p-service/
Actually I think you asked yourself in your question - "...made with .NET, PHP, NodeJS and JAVA." Obviously Delphi is not in the list.
@turrican, thanks for getting back to this thread and sharing the info with us. And yes, good to hear that, SQLite3 never failed us:)
I had the same curiosity - turning performance is always a good topic.
IMHO this forum is the best for this purpose - talks are publicly available and searchable by SE's. why another?
Trust me, you should start with:
- The samples: https://github.com/synopse/mORMot/tree/ … e3/Samples
- and this blog: https://tamingthemormot.wordpress.com
Hello Arnaud,
The use case would be:
Set the "connection is broken" flag in the OnFailed event handler, and reset the "connection is broken" flag in the OnSuccess event handler.
Or there is a better place else I missed for doing this kind of task? Thanks.
Well, docker is a good idea - I can download it as a whole, in my country, internet censoring make it **never** success to get the the end of the process with fpcupdeluxe...
@Leslie7,
The excitement is coming from the expected performance improvement, right?
Thanks ab.
I was using it to locate the row index by ID value.
Hello Aranud,
The comment for the TSQLTable.RowFromID function:
/// get the Row index corresponding to a specified ID
// - return the Row number, from 1 to RowCount
// - return RowCount (last row index) if this ID was not found or no
// ID field is available
function RowFromID(aID: TID): integer;I'm confused by this line:
return RowCount (last row index) if this ID was not found.
How to distinguish the situation where the ID value is found in the last row (which equals to RowCount), and "if this ID was not found" quoted above?
Thanks.