Guest User

Untitled

a guest
Oct 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. struct TwoInts {
  2. uint32_t int1;
  3. uint32_t int2;
  4. };
  5.  
  6. CREATE TABLE ints (
  7. id int,
  8. field bytea
  9. );
  10.  
  11. char query[100];
  12. struct TwoInts a = {44, 55};
  13. sprintf(query, "INSERT INTO ints (id, field) VALUES(0, decode('%08X%08X', 'hex'))", a.int1, a.int2);
  14.  
  15. INSERT INTO ints (id, field) VALUES(0, decode('000000210000002C', 'hex'));
  16.  
  17. struct TwoInts {
  18. uint32_t int1;
  19. uint32_t int2;
  20. };
  21.  
  22. CREATE TABLE ints (
  23. id int,
  24. int1 int,
  25. int2 int
  26. );
  27.  
  28. char query[100];
  29. struct TwoInts a = {44, 55};
  30. sprintf(query, "INSERT INTO ints (id, int1, int2) VALUES(0, %d, %d);", int1, int2);
  31.  
  32. INSERT INTO ints (id, int1, int2) VALUES(0, 44, 55);
Add Comment
Please, Sign In to add comment