Skip to main content
deleted 1 character in body
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address, and as the primary key. Use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As itsit's a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address, and as the primary key. Use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As its a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address, and as the primary key. Use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As it's a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

and primary key
Source Link
danblack
  • 8k
  • 2
  • 12
  • 28

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address, and useas the primary key. Use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As its a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address and use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As its a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address, and as the primary key. Use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As its a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.

Source Link
danblack
  • 8k
  • 2
  • 12
  • 28

For Unique Impression IP as there is no need for a autoincrement primary key, use VARBINARY(16) for IP address and use INET6_ATON() when inserting it to keep it in a compact form.

Use:

INSERT IGNORE INTO `Unique Impression IP` VALUES (INET6_ATON($var))

And look at rows affected to see if that exists or not for your UPDATE Banner statement branch. As its a unique key (primary keys are unique) it will only be inserted once. This removes a race condition in your current code.