#1 Re: mORMot 1 » Execute a dumpedfile » 2015-09-10 13:11:42

I solved my problem, but now seems like ExecuteNoResult, can't execute a lot of commands quickly.

If i put a sleep(1), it works well, but still take 1-2 minutes.

PS: I'm still executing line by line.

Edit1: My file have 220000 lines, and it's 220000 milisseconds stopped. If i take this sleep off, i get an access violation from Execute command.

#2 mORMot 1 » Execute a dumpedfile » 2015-09-09 21:34:16

Victor Zanella
Replies: 1

I have a dumpedfile, and now i have to execute it.
So i made a loop, that execute line by line.

I have a 150mb database, and it gives me a large dumpedfile, and if i made this loop, it take over 30 minutes.
When i execute this dumpedfile trough Sqlite3.exe, it take 10 seconds.

So, i want to know if is there's a way to execute more that one command per execute.

Something like this:

Props.ExecuteNoResult(RawUTF8('Begin transaction; Create table Blabla; Insert into blabla values (blabla ... ; Commit;'), []);

#3 Re: mORMot 1 » TSQLTableJSON - Compare data on where » 2014-10-23 16:45:22

I tried to use something like this:

    oCentralCompraLog.FillPrepare(BaseDeDados,
                                 'CodigoEmpresa=? and CodigoTipoInformacao=? and TipoIntegracao=? and Mensagem=? and CodigoTipoMensagem=? and  Date(DataHora)=?  limit 1',
                                 [AParametros.CodigoEmpresa, AParametros.CodigoTipoInformacao, AParametros.TipoIntegracao, AParametros.Mensagem, AParametros.CodigoTipoMensagem, DateToSQL(AParametros.DataHora)]);

and it works on small Database.

But when i try to use it at a client database, i got out of memory, and it happens cus i have a Text JSON field on database, so, this select will bring 665 rows, with bigs JSONs .
So if i dont want to bring JSON, how can i do that ?

I dont know how to do it with TSQLRecord object, only with TSQLTabelJSON, but with TSQLTabelJSON, i cant include Date on my where.

#4 mORMot 1 » TSQLTableJSON - Compare data on where » 2014-10-22 12:31:22

Victor Zanella
Replies: 3

I was trying to use FillPrepare to select my fields, with Date compare, but i got Out of Memory, cus i have 700mb of Logs on my Database.
So i tried to use TSQLTableJSON like this:

oSQLTableJSON := BaseDeDados.List([TCentralCompraLog], ' ID, Email ', sWhere);

its worked, but when i try to use something like this on where:

Date(DataHora)         = ''2014-10-22''

i got an AccessViolation, but the same command works on FillPrepare.

so i wanna know if is there a way to do it:

Select ID, Email From MyTable where Date(DataHora) = ''2014-10-22'' 

with TSQLTableJSON  or TSQLRecord.FillPrepare, whatever.

Thanks.

#7 Re: mORMot 1 » Select distinct with a text type field » 2014-10-13 16:45:36

Before my TSQLModel.Create i set all Collation to NOCASE, EX:
   TCentralCompraLog.RecordProps.SetCustomCollationForAllRawUTF8('NOCASE');
   Modelo := TSQLModel.Create([TCentralCompraLog]);

and if i check the Modelo.Tables[0].GetSQLCreate(Modelo), i got this:
   'CREATE TABLE CentralCompraLog(ID INTEGER PRIMARY KEY AUTOINCREMENT, CodigoEmpresa INTEGER, CodigoTipoInformacao INTEGER, TipoIntegracao TEXT COLLATE NOCASE, Mensagem TEXT COLLATE NOCASE, CodigoTipoMensagem INTEGER, DataHora TEXT COLLATE ISO8601, Parametro TEXT COLLATE NOCASE, JSON TEXT COLLATE NOCASE, Emai INTEGER);'


All my text type got NOCASE collation, but when i look my fields at SQLiteExpert Personal 3, they r all SYSTEMNOCASE.

have u ever saw it before?

#8 Re: mORMot 1 » Select distinct with a text type field » 2014-10-13 14:18:20

I saw a documentation about TSQLFieldType that says:
   " sftAnsiText, /// UTF-8 encoded TEXT: force a SYSTEMNOCASE collation ... "

But if i check in TSQLRecordProperties.SQLFieldTypeToSQL documentation, it says that:
   " ' TEXT COLLATE NOCASE, ',        // sftAnsiText"

so i changed my field type from RawUTF8 to AnsiString.

and if i use this command - Modelo.Props[TCentralCompraLog].Props.SQLFieldTypeToSQL(3) - i got a ' TEXT COLLATE NOCASE' mensage.

but it still creating a SYSTEMNOCASE field, in database.

so i tryed to change SQLFieldType to sftUnknown, cus it says: 
   " sftUnknown,  /// a WinAnsi encoded TEXT: force a NOCASE collation ... "

But it didnt create the field.

I read that post, but i couldnt understand very well.

I tried that SetCustomCollation* command, but it wasnt work to me.

Can u please show me an example of change Collation of a text type field ?

PS: i tried to follow that Example 12

#9 mORMot 1 » Select distinct with a text type field » 2014-10-10 20:38:14

Victor Zanella
Replies: 7

Hi, im trying to use Select distinct command, but i gotta problem.

To select distinct a text type field, it must be a Localized Collation.

When i create my Database, im using RawUTF8, and it makes my text type field, COLLATE SYSTEMNOCASE.

So i saw the SetCustomCollationForAllRawUTF8 procedure, and i wanna know the right  way to use it, and if this method will help me.

Board footer

Powered by FluxBB