It does not work delete from

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

CHERTS
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 21.11.2011, 13:09
Location: Chelyabinsk
Contact:

It does not work delete from

Postby CHERTS » 21.11.2011, 13:26

hello

I'm using the latest version from SVN zeoslib

I want to delete all data from a table uin_test

when the query: delete from uin_test where 1;
from the table uin_test nothing is removed

what could be wrong?

I create a table like this:

Code: Select all

CREATE TABLE uin_test (
  id integer primary key autoincrement not null unique,
  proto_name int(2) default 0 not null,
  my_nick varchar(128) default null,
  my_uin varchar(128) default null,
  nick varchar(128) default null,
  uin varchar(128) default null,
  msg_direction int(1) default 0 not null,
  msg_time timestamp(14) not null,
  msg_text text
);


insert data and execute procedures SQL_Zeos_Exec('delete from uin_test where 1;');

MainForm.pas:

Code: Select all

procedure TMainForm.DeleteAllHistoryClick(Sender: TObject);
begin
SQL_Zeos_Exec('delete from uin_test where 1;');
end;

procedure TMainForm.SQL_Zeos_Exec(Sql: WideString);
begin
    if ZConnection1.Connected then
    begin
         ViewerQuery.Close;
         ViewerQuery.SQL.Clear;
         ViewerQuery.SQL.Text := Sql;
         ViewerQuery.ExecSQL;
    end;
end;


MainForm.dfm:

Code: Select all

  object ZConnection1: TZConnection
    TransactIsolationLevel = tiReadCommitted
    Left = 216
    Top = 200
  end

  object ViewerQuery: TZQuery
    Connection = ZConnection1
    Params = <>
    Left = 288
    Top = 200
  end
Last edited by CHERTS on 22.11.2011, 04:20, edited 2 times in total.

jeremicm
Senior Boarder
Senior Boarder
Posts: 61
Joined: 18.10.2006, 17:07
Contact:

Postby jeremicm » 21.11.2011, 13:49

You need to add condition...


delete from uin_test where uin_test.id = 1; (i guess you're deleting values by index field)

CHERTS
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 21.11.2011, 13:09
Location: Chelyabinsk
Contact:

Postby CHERTS » 22.11.2011, 04:03

jeremicm wrote:You need to add condition...
delete from uin_test where uin_test.id = 1; (i guess you're deleting values by index field)


I want to delete all data from a table uin_test

I run a query

delete from uin_test;

but data is not deleted

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 17.12.2011, 22:17

In that case I would do 'Delete from uin_test;'
Is 'where 1' equal to 'where true' in sqlite?

Mark
Image


Return to “SQLite”

Who is online

Users browsing this forum: No registered users and 1 guest