chetana bhargav <[EMAIL PROTECTED]> writes:

> Auto increment seems to return a unsigned long long is there any way for it
> to make it as 32 bit, as I am depending on this feilds to generate unique
> id, and i have a constraint fot the id to be 32 bit only.

You'll have to add enough rows to the table to use up all id values that fit
in 32 bits before you'll have a problem.  You can, however, protect from wrap-
around with something like this:

CREATE TABLE x(i INTEGER PRIMARY KEY AUTOINCREMENT);

CREATE TRIGGER x_insert_tr
  AFTER INSERT
  ON x
  FOR EACH ROW
  BEGIN
    SELECT CASE
      WHEN new.i >= (1<<32) THEN RAISE(ROLLBACK, 'The table is full.')
      ELSE NULL
    END;
  END;

Derrell

Reply via email to