V
V
Vladimir Kai2017-03-07 10:49:53
MySQL
Vladimir Kai, 2017-03-07 10:49:53

How to undo all changes (including restore deleted records) from a MySQL database - Delphi 7?

Good afternoon!
There is a table in MySQL database named b_sale_basket.
The data is fetched using zQuery from the Zeos component package.

procedure TOrdersForm.ViewBtnClick(Sender: TObject);
begin

with OrderView.ZQueryBasket do                   
begin
Close;                // Опрос таблицы "Корзины"
SQL.Clear;
SQL.Add('SELECT order_id, product_id, price, currency, weight, quantity, name, detail_page_url, discount_price, base_price FROM b_sale_basket');
SQL.Add('WHERE order_id = :nav_ord');
ParamByName('nav_ord').Value := zQuery1.FieldByName('ID').Value;
Open;
end;
end;

The selected data is displayed in DBGrid.
Editing is done through DBEdit components. The Grid itself is in ReadOnly.
The question is, how to cache changes?
Had no experience with cached changes.
The goal is to apply changes only after pressing the "Save" button to the entire selected data set.
That is, the user can first edit one entry, then edit another, then delete a third entry or add a fourth.
How to organize the cancellation of all changes, including the deletion of records, if the user suddenly changes his mind about changing something in the table?
As I understand it, there is a change caching mechanism for this.
I found the ZUpdateSQL component on the ZEOS ACCESS tab. I read about it, it seems to be what you need.
But it doesn't work. When I try to double-click to open the field editor, I get an error message:
b849deff149b4963826e7486bb9f25f0.jpg
I tried to set it up using this instruction: www.delphisources.ru/pages/faq/base/tupdatesql.html
Help organize the secure editing process.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vladimir Kai, 2017-03-07
@gold_dezmor

I figured it out .
The ZQuery component can cache changes itself, including deleting information.
This instruction helped:
www.delphiplus.org/sql-v-delphi5/sql-v-delphi5_43.html
But it is not clear how to work with MySQL via UpdateSQL, more precisely, the component does not work for me.

A
Anton, 2017-03-07
@karminski

Perhaps transactions will help you?
https://dev.mysql.com/doc/refman/5.7/en/commit.html

G
GreatRash, 2017-12-04
@GreatRash

You are implementing a fill with a linear gradient, and you want an angle gradient, or sometimes called a conic gradient. As far as I know, SVG, CSS, and other canvases cannot do it, because the W3C cannot agree on what formulas to calculate it.
Try to google it: it can probably be emulated somehow through one place, but personally I wouldn’t drag crooked solutions into production, it’s easier to agree with the designer on altering the diagram.

I
Ivan Ivanov, 2017-12-06
@romalu

Perhaps not in the topic, but here 2018newyear.ru - the counter at the top with a gradient, can it be done in the likeness as you need?

A
Artyom Maltsev, 2018-06-22
@vivazzi

In the simplest case, you can do this: two arcs are built, connected to each other. Next, create two gradients: from 0 to 0.5 transparency and from 0.5 transparency to 1:

<defs>
    <linearGradient id="gradient" x1="0%" y1="50%" x2="100%" y2="50%">
      <stop offset="0%" stop-color="#f00808" stop-opacity="0"></stop>
      <stop offset="100%" stop-color="#f00808" stop-opacity="0.5"></stop>
    </linearGradient>
    
    <linearGradient id="gradient_2" x1="100%" y1="50%" x2="0%" y2="50%">
      <stop offset="0%" stop-color="#f00808" stop-opacity="0.5"></stop>
      <stop offset="100%" stop-color="#f00808" stop-opacity="1"></stop>
    </linearGradient>
  </defs>

And finally, apply 1 gradient to the first arc, and the second gradient to the second arc.
Example: https://codepen.io/vivazzi/pen/yEjxPV
For animation, you can use the css property transform: rotate(15deg); or @keyframes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question