Jump to content

Tom Chamberlain

Members
  • Content Count

    73
  • Joined

  • Last visited

Community Reputation

50 Excellent

About Tom Chamberlain

  • Birthday December 24

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

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

  1. Tom Chamberlain

    RichEdit with MSSQL

    I was 'assuming' TEXT or NTEXT, not plain varchar. We use TEXT so the blob stream's, load and save work. But per M$ https://learn.microsoft.com/en-us/sql/t-sql/data-types/ntext-text-and-image-transact-sql?view=sql-server-ver17 they are now saying to use nvarchar(max) or varbinary(max) instead, I would swap out for varbinary.
  2. Tom Chamberlain

    RichEdit with MSSQL

    No dataaware, it is a kind of cheat/lazy way to do it 'Select * From TableWithBlod Where ID = -1', Open this to get an empty dataset (assuming you do not have a ID = -1), and that dataset 'knows' about the fields, when you do the append you can then get the stream to the blob field and fill it with raw data from the rich edit stream, set your ID and any other fields and call post then close.
  3. Tom Chamberlain

    RichEdit with MSSQL

    I use a TRichViewEdit which has other methods but this should work for a regular TRichEdit as well, do not treat it like a string stream, it's a blob stream. To save the RichEdit var BlobStream: TFDBlobStream; ... ... dbQuery = Select statement for the record that you want to update/create ... dbQuery.Open; try ... ... dbQuery.Append; if you are creating a new record ... ... dbQuery.Edit; if you are editing one ... BlobStream := TFDBlobStream.Create(dbQuery.FieldByName('BlobFieldName') as TBlobField, bmWrite); try YourRichEdit.Lines.SaveToStream(BlobStream); finally BlobStream.Free; end; dbQuery.Post; except on e: exception do MessageDlg(e.Message, mtError, [mbOK], 0); end; dbQuery.Close; To load the RichEdit var BlobStream: TFDBlobStream; ... ... dbQuery = Select statement for the record that you want to read/load ... dbQuery.Open; BlobStream := TFDBlobStream.Create(dbQuery.FieldByName('BlobFieldName') as TBlobField, bmRead); try if not dbQuery.FieldByName('BlobFieldName').IsNull then begin YourRichEdit.Lines.LoadFromStream(BlobStream) ... ... Not sure if there is anything RichEdit needs to update/format the display ... end; finally BlobStream.Free; end; dbQuery.Close;
  4. Tom Chamberlain

    Copy MSSQL Database

    If your M$ SQL Server is NOT running at 80-90% memory it is not configured correctly, that's what it is suppose to do. A maintenance plan is a must for any SQL Server database, rebuilding indexes for performance over time needs to be done for performance in general. It takes our production system a little over a minute to backup a 6-7GB database during the day, the reason it only takes 20-30 minutes after you force the clients to exit is all the IO to the database stops, you could be fighting IO through-put and the SQL trying to get a good 'snap-shot' of the database. Our production system is a small 16GB VMware VM running on a host with 14 other VM's all connected to a SAN running SSD's. (could I put more acronyms in there?) Is this a 24/7 system? They are making regular SQL backups right? You could just restore after that, if not there are bigger problems. (This could/should be a backup script job in SQL) Is this a physical server or a VM (Hyper-V/VMware/Proxmox)? They are not running some anti-virus that is looking at the database and/or backup folders are they? (anti-virus on the server is fine as long as the DB/backup folders are excluded, some cheaper A/V solutions are not smart enough to know not to to this) Does the database have lots of BLOB fields? If so are they on their own database partition(s)? (more of a performance issue if not) Never tried it but you may want to look into SQL Log Shipping instead of doing full backup/restore. It should be able to be configured to run on the same server with different database names.
  5. Tom Chamberlain

    AI Rewrite and COBOL Port Announced for Immediate Development

    RPG has advanced beyond columns a long time ago with RPG Free. I also started with RPG and COBOL on an IBM 4331, System/38 and AS/400 from the late 80's through early 2000's, good memories. Even used Delphi/400 back when it first came out and I was learning Delphi.
  6. Tom Chamberlain

    New Book Delphi Quality-Driven Development

    Ordered the paperback from Amazon to go with the other 3 on my bookshelf, after I read it of course.
  7. Tom Chamberlain

    Buying a mini pc to install Delphi

    If your daily machine, PC or MAC has 16GB of RAM, is a multi-core CPU and has 100-150GB of free space go with a virtual machine. There are free options like Hyper-V and VirtualBox even VMwares Workstation/Fusion is free for personal use. Delphi will run in a VM with 4-6GB of RAM and a 2 cores, not speedy but it will run. You can get a real copy of Windows 10/11 for cheap online and it's easy to backup with just a file copy.
  8. Tom Chamberlain

    Which ODBC driver version is used by FireDac

    Use the TFDConnection object's GetInfoReport() method, it takes a string list. It shows everything you want to know about the connection and the driver it used/picked. We have this on our login/splash screen hidden behind a TLabel double-click event because we were having the same types of issues. Also look into the FDDrivers.ini file configuration. ================================ Connection definition parameters ================================ DriverID=MSSQL Database=******* User_Name=******* Password=***** ODBCAdvanced=TrustServerCertificate=Yes; MARS=Yes Server=192.168.56.109 VariantFormat=String ExtendedMetaData=True ================================ FireDAC info ================================ Tool = RAD Studio 12 FireDAC = 29.0.51961.7529 Platform = Windows 32 bit Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR ================================ Client info ================================ Loading driver MSSQL ... Loading odbc32.dll driver manager Creating ODBC environment handle Searching for ODBC driver ... Checking for ODBC driver [ODBC DRIVER 18 FOR SQL SERVER] ... Found [ODBC Driver 18 for SQL Server] Driver Manager version = 03.81.19041.0000 ================================ Session info ================================ Checking session ... Warning: The client [18.3.3.0.0] and server [16.0.0.0.0] major versions difference > 1. Warning: MS ODBC 11 does not support SQL_VARIANT data type. Warning: SQL Server 2016 and compatibility level >= 130 may lead to DATETIME comparision failure. Current catalog = Current schema = dbo Driver name = msodbcsql18.dll Driver version = 18.03.0003 Driver conformance = 3 DBMS name = Microsoft SQL Server DBMS version = 16.00.1130
  9. Tom Chamberlain

    Using same form for adding and editing data

    Depends on the complexity of the data needed to create the record(s). The our app can have many child records for a parent, but requires at least one child, so we use a 'wizard' type screen for creating these initial records. Our app is 25+yrs old, we have a mix of DB-aware for the the oldest forms, client datasets and even TMS string grids have been used to store data, but for 95% of all your 250+ tables we use one form for all create, view and edit of data. If a table contains multiple records we use a grid of some type with a panel that we show/hide depending on the status of the selected record to create/edit the data. We force the users to click an Edit button to change 99% of any data and then an Save or Cancel button.
  10. Tom Chamberlain

    Visually edit a custom component

    You may want to look at frames. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Working_with_Frames Different functionality and usage than creating a real component but may be what you are looking for. I have never used frames myself, but have several custom components to combine TEdit's, TComboBox's and TButton's into a TPanel that are added to a TScrollbox on the fly with different data in each.
  11. Tom Chamberlain

    Do runtime created forms close the TFDQuery connections?

    Depends where the TFDConnection is defined, are you using a shared data module or creating it in the form? Is it pooled?
  12. Tom Chamberlain

    Help to find database error

    The problem is the procedure is declared to a class that does not exist: Should be: procedure TfrmDatabaseTutorial.ShowSelectResults();
  13. Tom Chamberlain

    Project Options -> Version Info aka. dproj madness

    We use a set of shared resource files, one for the EXE's and another for the DLL's (the filetype changes) and leave the IDE out of it. We have our own mass build process for production (the only time we care about the version numbers and things) with the option to update the version number, it changes and rebuilds the resource files before starting any compiles so we always have the correct versions for production.
  14. Tom Chamberlain

    Trap TFDConnection error on data module create etc?

    No, not just for that feature I really like the component naming, renaming and replacement features. Makes migrating/upgrade older projects faster and the Tab Order as a tree saves time.
  15. Tom Chamberlain

    Trap TFDConnection error on data module create etc?

    We prevent this issue with GExperts -> Set Component Properties and having it set the Active and Connected properties to False on all DB components before compiling. It does it automatically so we don't have to remember to do it 🙂 One of the best features of GExperts for us.
×