#1 Re: mORMot 2 » Example TCP Socket connection with openssl » 2024-07-29 08:07:24

Hello Ab
,

thank you for your answer and no worries.
Do you know about any sample or project, where this is already used?
Sometimes it is easier to see how this can be implemented instead of guessing what should be the right approach.
The Chat-programm in the examples is different as i can see.

#2 Re: mORMot 2 » Example TCP Socket connection with openssl » 2024-07-29 06:11:30

hey all,

i researched much over the weekend but i keep up my question and try to ask, if anyone has a working example for using TNetSocket.
This would be really great.

Thanks and have a great day

#3 mORMot 2 » Example TCP Socket connection with openssl » 2024-07-24 14:12:40

Mo0211
Replies: 4

Hey all,

does anyone has an example code for a TCP Socket Connection with openssl?
I want to use either windows or linux - both should be possible.

Thanks for your help!

#4 Re: mORMot 2 » Is it possible to make https requests through mORMot ? » 2024-07-08 09:29:50

Hey @Ab
is it possible to use a socks5 proxy with libcurl?
I read that HttpGet does not use compression per default.
What would you advice to use performance wise for downloading text from a website programmatically?
I googled quite some time to find an example how to use libcurl with a proxy - do you have a quick sample for me?

thanks!

#5 Re: mORMot 2 » Is it possible to make https requests through mORMot ? » 2024-06-27 07:30:35

i add another question here.
This is very easy to use and seems to be very smooth!

Is there a possibility to use a socks5 proxy or is only a http proxy possible?

#6 Re: mORMot 2 » undefined declare with mormot openssl » 2024-06-27 07:27:50

Hi Ab,

thank you for the possibility - will do!
But one more questions regarding the implementation:
I have one function and added this one as you did - but the difference is, that this function is new and only available in openssl 3.0.
This leads to errors when using a version beyond.
Is there a conditional loading possible (when loading openssl3XX then load this function else not?)

Really appreciate your answer!

Thanks!

#7 Re: mORMot 2 » undefined declare with mormot openssl » 2024-06-22 21:48:17

Hello AB,

oh shit - what a great support!
Really appreciate your help!
i used your changes to add some other functions which are used by me and are relevant to migrate my app to mormot openssl library.
I think my changes are not 100% perfect, but can i send you my functions and is it possible to add them?
Upgrades in the future would then be easier for me.

Thanks for your support!

#8 Re: mORMot 2 » undefined declare with mormot openssl » 2024-06-19 14:58:05

Hello ab,

really thanks for your quick answer!
it works now smile

When spending more time with your openssl library i searched for a possibility to get the full openssl version as here:

https://www.openssl.org/docs/man3.1/man … _TEXT.html

Currently i have the possibility to use OPENSSL_VERSION_NUM, but i'm not sure if there is a need to convert this to a full version string or if there is another option?

#9 mORMot 2 » undefined declare with mormot openssl » 2024-06-19 06:04:55

Mo0211
Replies: 7

Hi All,

i have a quick code example and i don't know why this is not working.
This seems to be a reayll beginner issue, but maybe you can support:

https://pastebin.com/1xk7Q2Ck

i included mormot2 in the search clauses, but when accessing the functions from mormot i get an error:

[dcc32 Fehler] Project1.dpr(16): E2003 Undeklarierter Bezeichner: 'OpenSslIsAvailable'
[dcc32 Fehler] Project1.dpr(19): E2003 Undeklarierter Bezeichner: 'OpenSslVersion'

Can you give me an advice why?

Thanks for your support!

#10 Re: mORMot 1 » Update Record with related table information » 2020-11-11 15:06:00

Hi ab,

thanks for your quick answer.

i have some more questions here:

when i want to update one TSQL-Record complete with all values, what is the best way to do this?
To I have to name all columns which i want to update?
I tried already to use the Update(tsqlrecord) but this does not seem to work (no error, but no values are changed in db).

In my TSQL-Record, there is another TSQL-Record as a property.
Is it possible to update directly within one update-command also the joined table?
When i want to update now the complete information in both related lines, what would be the best way?

Are there some examples for updating information in an sql-lite database, also for joined tables?

Really thanks for your support here.

#11 mORMot 1 » Update Record with related table information » 2020-11-09 14:33:54

Mo0211
Replies: 2

Hi,

i found this shorted example for updating a value on another site:

var
  ExistingMovie: TMovie;

  ExistingMovie := TMovie.CreateAndFillPrepareJoined(DBServer,
      'Title = ?', [], ['District 9']);
    ExistingMovie.Title := 'District 10';
    ServerDB.Update(ExistingMovie);

What is the best way to implement an update for a joined table here?
For Example we have another table which references with a id here and the update should take care of both tables.

I hope my question is clear.
If not, i can post a small part of the code.

Thanks.

Moe

#12 Re: mORMot 1 » Getting TStringlist-Value from Json-Database » 2020-08-09 19:24:37

ab wrote:

So I guess your TSQLRecord field is a TStringList.
The instance needs to be initialized before.

Thats the trick!

Thanks for your really quick answer smile

#13 mORMot 1 » Getting TStringlist-Value from Json-Database » 2020-08-09 17:41:36

Mo0211
Replies: 2

hi,

i setup a TStringList-Value in my Database, which Values are currently shown in Json-Format.

What is the best way, getting those Values back from Database and write them in a local TStringList Variable?

i thought i can do it like this:

fSQLRecord.Liste :=fSQLRecordRec.Liste;

Where fSQLRecordRec is filled with fillone, but the value is nil everytime.
All Other Strings and Integer Values are written in this way.

I searched already for the JSONToObject-function, but i didn't get it working and don't know if it is needed to do like that.

Thanks for your support!

#14 Re: mORMot 1 » Aggregate SUM() Function in mORMot » 2019-05-15 20:34:28

Hey ab,

I tried now what you explained, but it not clear to me, because i can't find a retrieveOne function.
I tried this example:

Form1.Database.Retrieve('src=? AND section=?', [], [source,section], classObj, 'SUM(size)')

As i Understand correct, the classObj will be filled with the related lines from sql.
But how can i access the SUM Column?

Also another question related to this: is it possible to have foreignkeys from referenced sqlrecordclasses in the where clause?
So, the src is a foreignkey which is referenced in another class.
Do you maybe have an example for me for those two cases?

Thanks a lot!

#15 Re: mORMot 1 » TDateTime Functions in Aggregate Mode » 2019-05-09 19:54:18

Hey ab,

any news here?

Thanks for your answer.

#16 Re: mORMot 1 » TDateTime Functions in Aggregate Mode » 2019-05-04 07:32:13

Hi ab,

preferred with ORM.
My goal is to change the current usage from sqlite and mysql to the general ORM format, which is really pretty straight forward and simple (when you know how to use it wink ).

The query in sql is clear.

Is this possible with ORM?

I asked many questions in the last time.
Are those functions documented and i didn't find them?
i don't want to bother you, but for me it is hard to find the correct usage for those questions.

One last compliment - your support here in the forum is really great!
This is one reason to use mormot!

#17 mORMot 1 » TDateTime Functions in Aggregate Mode » 2019-05-03 17:34:33

Mo0211
Replies: 4

Hi,

Are there implemented Methods to get Values from a Specific Month, Day, Year or others?

For example i want to get the sum of a column from a specific month of a TDateTime Object.

Thanks for any advice!

Moe

#19 mORMot 1 » Aggregate SUM() Function in mORMot » 2019-04-28 07:20:36

Mo0211
Replies: 4

Dear all,

what is the best way to call

"SELECT SUM(Col1) AS 'sum of col1' FROM table1 WHERE col2 = 'Value' " in mORMot?

i wasn't successfull in finding an example whether in docs nor in examples.

Thank you for your help and a working example is much appreciated!

#20 mORMot 1 » Unique Constraint Error on variable.add() » 2019-04-04 15:39:53

Mo0211
Replies: 1

Hi Guys,

i search already in all related documents (Docu, Forum, web) but can't find the correct way how to check if a unique entry in database already existed.

So, how can i avoid the unique constraint error when the value is already in the database and check this before in a multithreading environment?

I hope my question is clear and you can point me in the right direction - thanks!

#22 Re: mORMot 1 » Access Violations getting empty Strings from sqlite » 2019-01-07 20:47:32

Sorry for posting this peace of code.

I will not do it again, but any way thanks for checking!

#23 Re: mORMot 1 » Access Violations getting empty Strings from sqlite » 2019-01-07 20:22:43

Hi,

few days but no response, so i tried to make it a little easier for you.
i created a programm to test the problem in a fast way.
You only need to copy mormot Files to mORMot-Folder and sqlite3 file to the directory.

Please execute this program several times.
In some cases it needs long time to finish the select and also in some cases it ends up i a access violation.

I hope this helps to find the problem.

Thanks for your support!


program SQLITE_ISSUE;
{$APPTYPE CONSOLE}

{$IFDEF FPC}
	{$MODE Delphi}
{$ENDIF}

// fpc -MDelphi -O3 -FumORMot/ sqltest.pas

uses
    {$IFDEF MSWINDOWS} Windows, {$ENDIF}
    {$IFNDEF MSWINDOWS}cmem,{$ENDIF} SysUtils, Classes, math, SyncObjs, SynDBSQLite3, SynDB, SynSQLite3;

Var
  C : TSQLDBSQLite3ConnectionProperties = nil;
  Q: TQuery;
begin
	sqlite3 := TSQLite3LibraryDynamic.Create({$IFDEF MSWINDOWS}SQLITE_LIBRARY_DEFAULT_NAME{$ELSE}'./libsqlite3.so'{$ENDIF});
	C := TSQLDBSQLite3ConnectionProperties.Create('testdb.db', '', '', '');
	C.MainSQLite3DB.LockingMode := lmExclusive;
        C.MainSQLite3DB.WALMode := True;
	C.MainSQLite3DB.Execute('CREATE TABLE IF NOT EXISTS Test (testColumn TEXT NOT NULL DEFAULT unknown);');
	
	Q := TQuery.Create(C.ThreadSafeConnection);
	try
		Q.SQL.Text := 'INSERT INTO Test (testColumn) VALUES (:value);';
		Q.ParamByName('value').AsString := ''; // empty string
		try
			Q.ExecSQL;
		except on E: Exception do
			Writeln('Error: '+ E.Message);
		end;
	finally
	  Q.Free;
	end;
Writeln('test4!');
	try
		Q := TQuery.Create(C.ThreadSafeConnection);
		try
			Q.SQL.Text := 'SELECT testColumn FROM Test';
			try
				Q.Open;
				While not Q.EOF do
				  begin
				  writeln(Q.FieldByName('testColumn').AsString);
				  Q.Next
				  end;
				Q.Close;
			except on E: Exception do
				Writeln(E.Message);
			end;
		finally
		  Q.Free;
		end;
	finally
	C.Free;
	sqlite3.Free;
	writeln('done!');
	end;
end.

#24 mORMot 1 » Access Violations getting empty Strings from sqlite » 2018-12-30 20:27:04

Mo0211
Replies: 5

Hi Guys,

i have the following issue getting data from a sqlite Table:

CREATE TABLE Test(
      testColumn TEXT DEFAULT NULL);

INSERT INTO Test VALUES ('')

element.str_list.CommaText := fQuery.FieldByName('testColumn ').AsString;

This Code written and compiled with fpc version 3.3.1 on a 64bit linux distro takes a long time to execute and even after few executions in a row it results in a access violation.

Is there something wrong in my code or is there a problem getting empty strings from database?

if i replace the emptry string in the sql command with NULL (dbnull) everything works as expected.

Thanks for your feedback and feel free to ask if my questions is not clear.

Moe

Edit:

some more maybe needed information:

i load the dll dynamically
i use tquery for my sql queries
i use this class for the connection: TSQLDBSQLite3ConnectionProperties

Board footer

Powered by FluxBB