Jump to content

Alberto Fornés

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

3 Neutral

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alberto Fornés

    Persist data in a stream

    Hi Kas Ob, thanks again. Updated the sample, I included an incorrect file, in case of string fields I save the Tipo and the field size as metadata to generate the dataset again. Stream_Sample_2.zip
  2. Alberto Fornés

    Persist data in a stream

    Hello Kas Ob, thanks for you reply. As I said in second message the problem is not related to Delphi version, is related to computer where I execute the program. The DB is the same, I attach a small demo with the esential part of code where I can verify the error. When I open the program a TFDMemTable with different fields defined is open, I add a record with some values and use the add image button to load a blob field (in this case bitmap image included in sample code, that you can see on picture) : When Save Table button is pushed the data and some table metadata is used to fill a stream that can be saved in a file, although you can use de load table button to fill a second TFDMemTable with this stream, and assign the dataource to this dataset, in this case and in a certain computer the image is not readed correctly (in other blob cases this is an error): If you want to load the stream from saved file, push load stream button and then load table). The same program in other computer (it doesn't matter Delphi 10.3 or Delphi 10.4) works well, so I think it's a pc configuration that I can't guess. Stream_Sample_2.zip
  3. Alberto Fornés

    Persist data in a stream

    I expand the information, doing more tests I have verified that it is not a problem associated with Delphi 10.3 vs Delphi 10.4, I made that statement because I have two computers, one with Delphi Rio and the other with Delphi Sydney, but installing Delphi 10.3 on the other computer I have verified that the problem is due to the computer (Windows 10 in both cases). Any suggestions on any pc configuration that might motivate this?
  4. Alberto Fornés

    Persist data in a stream

    Hello, in a data exchange between vcl clients and a REST server, I have implemented a method to save the data in a stream, that stream I send to the client and it loads the data in a reverse process. I do this to reduce the information to be sent as much as possible and I do not directly use a SaveToStream of the table, query or stored procedure. The information of the fields I read from the IFDDataSetReference interface, and I have a problem when saving the blob fields, the procedure worked with Delphi 10.3 but with Delphi 10.4 there is something different that I cannot guess (I have a professional version and I do not have access to the FireDac code ) . The abbreviated code for the procedure is: //iData = IFDDataSetReference //FieldData = array of Fields ab: TArray<Byte>; bd: AnsiString; nl: Int64; var ADest:= TMemoryStream.Create; var wr:= TBinaryWriter.Create(ADest,TEncoding.UTF8,false); for i:= 0 to iData.DataView.Rows.Count - 1 do begin for c:= Low(FieldData) to High(FieldData) do begin //when blob field I do this begin //ValueI is a variant bd:= iData.DataView.Rows[i].ValueI[c]; //bd value is not the same in Delphi 10.3 as in Delphi 10.4 ab:= TEncoding.ANSI.GetBytes(bd); nl:= Length(ab); wr.Write(nl); wr.Write(ab); end; end; end; In client side I can read de stream with: ADest: TFDMemTable; nl:= sR.ReadInt64; if (nl = 0) then begin ADest.Fields[c].AsBytes:= nil; end else begin ADest.Fields[c].AsBytes:= sR.ReadBytes(nl); end;
  5. Alberto Fornés

    Close a TIdTCPClient connection

    Thanks Remy, your words are greatly appreciated on this topic. That's right, the host only accepts one connection, and the message is sent by it. I will find a way to close the connection (maybe restart the device) so that I can connect again.
  6. Alberto Fornés

    Close a TIdTCPClient connection

    Hello, I have created a thread where there is a TIdTCPClient component that receives readings from a barcode reader connected through an ethernet base. The goal is for you to be in a connected service all day without stopping. The thread works, I can start and stop it several times, when I stop the thread I execute these steps to close the connection (FClient = TIdTCPClient): FClient.IOHandler.InputBuffer.Clear; FClient.IOHandler.CloseGracefully; FClient.Disconnect; FClient.Socket.Close; I don't know if they are all necessary, but I have tried to get the desired result. To test, I need to achieve a reconnection when a network failure is detected (for this I disconnect the cable from the pc), when I detect an error in the reading: try FData: = FClient.IOHandler.ReadLn; except on E: Exception do begin FClient.IOHandler.InputBuffer.Clear; FClient.IOHandler.CloseGracefully; FClient.Disconnect; FClient.Socket.Close; // Terminate thread end; In this second case, when I try to connect again, I get this message from the base: This channel is already in use, no slot is available. It seems that the old host-port socket remains active: how can I ensure that it is closed?
  7. Alberto Fornés

    Install recent Delphi versions on Windows XP

    Hello, sorry for delay to respond, I was talking about executables generated with Delphi 10.3, not about installing Delphi 10.3 in a XP computer. I'm able to run the programs, except the problem with themes in some contros, as datatimepicker so I need to disable theme for that controls.
  8. Alberto Fornés

    Speed of Graphics32

    Years ago I was testing various possibilities to display points, lines, polygons, etc. on a map, with various libraries and OpenGL was the one who did it the fastest, perhaps showing text found worse performance.
  9. Alberto Fornés

    Speed of Graphics32

    I think OpenGL can be a good option for this.
  10. Alberto Fornés

    Firedac - Sqlite - DateTime field

    You are right (maybe you know something about FireDac 😀), previously I used this format to insert values: UPDATE FICHADAS SET HASTA = ' + QuotedStr(FormatDateTime('dd-mm-yyyy HH:nn',FDMemTbCSV.FieldByName('Fecha').AsDateTime)) Now it works with this (using DateTimeFormat driver parameter to DateTime): 'UPDATE FICHADAS SET HASTA = ' + QuotedStr(FormatDateTime('yyyy-mm-dd HH:nn',FDMemTbCSV.FieldByName('Fecha').AsDateTime)) what made me doubt was seeing that with SQLiteStudio 3.2.1 it was possible to see the data (there was no error in the update, I imagine because it is finally a double). Thank you.
  11. Alberto Fornés

    Firedac - Sqlite - DateTime field

    Hello Dmitry, thanks for your response, but changing DateTimeFormat driver parameter to Binary or DateTime the grid don't show me this two datetime fields data, also I tried this select: SELECT FICHADAS.IDFICHADA,FICHADAS.IDEMPLEADO,FICHADAS.DESDE AS "FDESDE::DATETIME",FICHADAS.HASTA AS "FHASTA::DATETIME" , but get the same behaivor.
  12. Alberto Fornés

    Firedac - Sqlite - DateTime field

    I have created a table with firedac using sqlite as database, using this script: CREATE TABLE FICHADAS (IDFICHADA INTEGER PRIMARY KEY AUTOINCREMENT,IDJORNADA INTEGER,IDEMPLEADO INTEGER,DESDE DATETIME ,HASTA DATETIME ,MINORMAL SMALLINT,MINEXTRA SMALLINT) Therefore I define the DESDE and HASTA fields as datetime, I can insert into the table as datetime fields and when I put a TFDTable component bound to the table it recognizes the fields as TDateTimeField, but when I try to visualize it in a TDBGrid it does not show anything in those two fields and nothing appears if I run the select on the connection editor: but using SQLiteStudio 3.2.1 , I can see the data: I guess I need to configure something in Firedac to work with these fields, but I can't know what, any suggestions? Thanks.
  13. Hello, which tool do you use to do this enumeration?, thanks.
  14. Alberto Fornés

    Your RAD Studio 10.4 Sydney issues

    Also I see that "in order to proceed", and in Project --> Options a label 'Panel1' is displayed until you click the left menú.
  15. Alberto Fornés

    Install recent Delphi versions on Windows XP

    I have installs with Delphi 10.3.3 on Windows XP, some problems with vcl themes (datatime picker don't work), so I don't use it with that SO, but it works.
×