#1 Re: mORMot 1 » CreateSQLIndex and external db. » 2015-05-18 16:04:59

Sure. I`m just new to mORMot.

Thanks.

#2 mORMot 1 » CreateSQLIndex and external db. » 2015-05-17 22:00:39

GetCoffee
Replies: 3

Ok, the code.

	FModel := TSQLModel.Create([TModelUser]);
	VirtualTableExternalRegister(FModel, TModelUser, FOwner.ConnectionProperties);
	FServer := TSQLRestServerDB.Create(FModel, SQLITE_MEMORY_DATABASE_NAME);
	GetRestServerDb.CreateSQLIndex(TModelUser, ['UserName'], True);
	GetRestServerDb.CreateMissingTables;

Where FOwner.ConnectionProperties is a connection property to postgresql server.

When i try to create the index i get:

Project Shell.exe raised exception class ESQLite3Exception with message 'Error SQLITE_ERROR (1) using 3.8.9 - 'no such table: main.ModelUser' extended_errcode=1'.

Is this a known issue?

Thanks in advance.

------

Solved:

Just reverse the last two lines. ;)

#4 mORMot 1 » mORMot and building an TSQLRecord at runtime. » 2015-05-17 19:39:47

GetCoffee
Replies: 2

Hi there again.

Since mORMot handles fields by published properties i got another question, it is possible to add to the mORMot kernel fields at runtime (i will just provide the size/memory for it).
Or is there a builtin funcionality available for such cases?

Thanks in advance.

#5 Re: mORMot 1 » mORMot and ZEOS error handling. » 2015-05-17 18:24:21

Hi, thanks for the reply.

So it seems that the zeos postgresql (maybe others) implementation should be extended as there is a ZSQLException but without any status code in the estabilishment of a connection part.

#6 mORMot 1 » mORMot and ZEOS error handling. » 2015-05-17 15:03:32

GetCoffee
Replies: 2

Hello,

I`m trying to investigate how should i handle connection errors code. Especially with postgresql such as bad database name, invalid user password etc. Any advice? The exceptions doesnt have any code errors just, a message, wich can be either in English or other language depending on pgsql so its not a good way to check it. ZdbcPostgreSqlUtils: CheckPostgreSQLError

Thanks in advance.

#7 Re: mORMot 1 » TSQLRecord and TSQLRestServerDB » 2014-09-20 18:50:41

Hm, I just saw that FDatabase.Add doesnt add any fields to it... Anyway, should i do something more than just inherit from TSQLRecord and make published properties so they should be visible as fields?

ps. Thats quite strange, because the sample works as expected - but not mine..
ps2. I did find out, that my model TSQLTest = class(TSQLRecord) doesnt have any fields, just an ID. Solved: I did have the fields in the public section of the class not published... Omg. wink

#8 Re: mORMot 1 » TSQLRecord and TSQLRestServerDB » 2014-09-20 18:11:21

FModel := TSQLModel.Create([TEntryDb]);
  FDatabase := TSQLRestServerDB.Create(FModel, AFilename);
  TSQLRestServerDB(FDatabase).CreateMissingTables(0);
  FList := TSQLRestServerDB(FDatabase).RetrieveList(TEntryDb, nil, []);

Hm, nothing special same code like in sample 2. I did add the records like in the sample 02.

#9 mORMot 1 » TSQLRecord and TSQLRestServerDB » 2014-09-20 16:52:25

GetCoffee
Replies: 4

Hi there,

I got a simple question and cannot find the answer in the samples.

I got an class that inherit TSQLRecord and TSQLRestServerDB. I do everything as in the 02 - Embedded SQLite3 ORM sample, anyway now i want load the data from the sqlite3 file (its created). An here is the problem i use the method RetrieveList wich retrieves me some records but all of them are empty (only the headers of TSQLRecord are saved or assigned somewhere).

Cannot get it to load data from the TSQLRestServerDB.

Any hints? I tried FillPrepare, FillRow, FillOne no success.

Best Regards,
LB.

Board footer

Powered by FluxBB