Jump to content

weirdo12

Members
  • Content Count

    158
  • Joined

  • Last visited

  • Days Won

    1

weirdo12 last won the day on July 13 2023

weirdo12 had the most liked content!

Community Reputation

28 Excellent

1 Follower

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

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

  1. weirdo12

    Delphi procedure -> MS SQL stored procedure

    You should provide the values of sql_GetAnnex and sql_GetPaymentTax.
  2. Try adding a variable. I included a bunch of screen shots because it's not exactly obvious that you have to create a new Category before you can create a variable. Then add a Category: Select the Category and click Variable and assign it a value: Close Edit Variables. Now you *should* be able to drop that variable into the Rich Edit control.
  3. If you double-click the RichView component is there a Format tab? If so, look in expressions and pick your date/time column and set the format string there. If the RichView contains multiple columns, each one will be listed in Expressions.
  4. Add a BeforePrint handler to the memo control. Make sure that you clear the DataField and DataSet properties of the memo control or BeforePrint won't have any effect.. procedure Memo13OnBeforePrint(Sender: TfrxComponent); begin TfrxMemoView(Sender).Text := FormatDateTime('yyyy-mm-dd', <Ticket."ticket_date">); end; No formatting: With the BeforePrint:
  5. weirdo12

    libpq.dll found, but not loaded

    For sure. If there are 32-bit binaries from newer versions they will work. I will look into updating the ones I have been using too.
  6. weirdo12

    MyDAC copy to another DB

    As was said above, you just need to connect to both servers (databases) simultaneously. You should have a look a using some of the built-in functionality you get with MyDAC - like TCRBatchMove. Let it do all the tedious INSERT work for you. https://docs.devart.com/mydac/devart.dac.tcrbatchmove.htm
  7. weirdo12

    libpq.dll found, but not loaded

    You need the PostgreSQL 32-bit library files and that means you should install PostgreSQL 10.23. You can still get it here: https://get.enterprisedb.com/postgresql/postgresql-10.23-1-windows.exe These are the files you will need to copy from C:\Program Files (x86)\PostgreSQL\10\bin to the same directory as your exe: libssl-1_1.dll libcrypto-1_1.dll libiconv-2.dll libintl-8.dll libpq.dll And you also need correct version of Microsoft Visual Studio 2013 (VC++ 12.0) C++ Redistributable run-time library. You can download it here: https://aka.ms/highdpimfc2013x86enu
  8. Do you mean that you get that error when assigning a value to a date field that is part of a TDataSet?
  9. Another thing: I totally get using TFDQuery out of habit but don't forget that there is the more lightweight TFDCommand or TFDConnection.ExecSQL for doing INSERT, UPDATE and DELETE.
  10. If you use TFDScript you can use macros and and parameters. I tested this text and it works as expected. You end up with 2 rows in the table. DROP TABLE "&table_name" CASCADE; CREATE TABLE "&table_name" ( serial_number serial, ticket_date timestamp NULL DEFAULT LOCALTIMESTAMP, PRIMARY KEY (serial_number) ); BEGIN; INSERT INTO "&table_name" (serial_number, ticket_date) VALUES (1, CAST(:start_date AS TIMESTAMP)); INSERT INTO "&table_name" (serial_number, ticket_date) VALUES (2, CAST(:start_date AS TIMESTAMP)); END; BEGIN; INSERT INTO "&table_name" (serial_number, ticket_date) VALUES (3, CAST(:start_date AS TIMESTAMP)); INSERT INTO "&table_name" (serial_number, ticket_date) VALUES (1, CAST(:start_date AS TIMESTAMP)); END; The TFDScript.OnScriptError event is called when an attempt to INSERT serial_number 1 again and serial_number 3 does not exist in the table. [FireDAC][Phys][PG][libpq] ERROR: duplicate key value violates unique constraint "receipt_ticket_pkey". Key (serial_number)=(1) already exists. The TDScript.Status value at the completion of the TDScript.ExecuteAll is ssFinishedWithErrors. FDScript->ScriptOptions->CommandSeparator = ";"; FDScript->SQLScripts->Clear(); auto sql_script {FDScript->SQLScripts->Add()}; sql_script->SQL->Assign(cxMemoSQL->Lines); if (FDScript->Macros->FindMacro("table_name") == nullptr) { auto macro_ {FDScript->Macros->Add()}; macro_->Name = "table_name"; } FDScript->Macros->MacroByName("table_name")->AsRaw = FFrameTicketDateFilter->TableName; if (FDScript->Params->FindParam("start_date") == nullptr) { FDScript->Params->Add("start_date", ftString); } FDScript->Params->ParamByName("start_date")->AsString = FFrameTicketDateFilter->StartDate(); if (FDScript->Params->FindParam("end_date") == nullptr) { FDScript->Params->Add("end_date", ftString); } FDScript->Params->ParamByName("end_date")->AsString = FFrameTicketDateFilter->EndDate(); FDScript->ValidateAll(); if (FDScript->Status == ssFinishSuccess) { #if defined(_CODESITE) // Don't time how long it take to make the previous CodeSite calls. _di_ICodeSiteTimer timer_ {CodeSite->Timer({}, TCodeSiteTimingFormat::tfMilliseconds, true, false)}; #endif FDScript->ExecuteAll(); #if defined(_CODESITE) timer_->Stop(); #endif if (FDScript->Status == ssFinishSuccess) { auto msg_ {"The SQL Source text executed successfully."}; cxMemoSQLText->Clear(); cxMemoSQLText->Lines->Add(msg_); Dxmessagedialog::dxMessageDlg(msg_, mtInformation, TMsgDlgButtons() << mbOK, 0); } } void __fastcall TFrameGridLoadSummary::FDScriptError(TObject *ASender, TObject *AInitiator, Exception *&AException) { cxMemoSQLText->Clear(); cxMemoSQLText->Lines->Add(AException->Message); Dxmessagedialog::dxMessageDlg(AException->Message, mtError, TMsgDlgButtons() << mbOK, 0); } //--------------------------------------------------------------------------- Edit: I just wanted to add if I execute this code: BEGIN; INSERT INTO "&table_name" (serial_number) VALUES (3); INSERT INTO "&table_name" (serial_number) VALUES (1); END; Using TFDQuery instead of TFDScript I get exactly the same issue that was initially reported if immediately after I execute something like 'SELECT * FROM &table_name'.
  11. Edit: I'm going check this again tomorrow but I am pretty sure I am actually running code like below in a TFDQuery 😉 You could use TFDScript. For example, you could put these commands in the script: BEGIN; INSERT INTO t1(id) VALUES ('1'); INSERT INTO t1(id) VALUES ('2'); -- to test it cause an error INSERT INTO t1(id) VALUES ('1'); END; And the in the exception handler call ExecSQL("ROLLBACK');
  12. weirdo12

    TFDQuery editing fails randomly

    Are you calling the TFDQuery.ApplyUpdates() method somewhere after you call Post? https://docwiki.embarcadero.com/RADStudio/Athens/en/Caching_Updates_(FireDAC)
  13. weirdo12

    Alternatives for SQL Anywhere

    Like you, I used SQL Anywhere as the default for many, many years - starting when it was still known Watcom SQL and running on DOS. I switched to using SQLite as the default database that the product ships with because it provided the same kind of installation experience (along with maintaining SQL Anywhere support for existing customers). When a new multi-user server is required, I use PostgreSQL.
  14. weirdo12

    Naming abbreviations for controls

    Just to be clear, are you referring to renaming controls that you drag and drop or naming ones you are creating dynamically? I missed the previous post...
×