Skip to content

Instantly share code, notes, and snippets.

@iffy

iffy/a.nim Secret

Created February 13, 2019 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iffy/c31198e66fe51f8dcaf6c4289fab8f43 to your computer and use it in GitHub Desktop.
Save iffy/c31198e66fe51f8dcaf6c4289fab8f43 to your computer and use it in GitHub Desktop.
What in that loop could cause the first string of `res.rows[5]` to be overwritten with nulls?
# type
# AllResult* = object
# rows*: seq[seq[string]]
# cols*: seq[string]
# types*: seq[string]
# res is a `ref AllResult`
for row in res.rows:
var jrow = newJArray()
for col in row:
if col.startsWith("\0\0"):
echo "STARTS WITH NULL"
echo "res.rows[5]: ", res.rows[5].repr
jrow.add(newJString(col))
jrows.add(jrow)
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"5", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"\0\0\0\0", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"\0\0\0\0", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"\0\0\0\0", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"\0\0\0\0", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
STARTS WITH NULL
res.rows[5]: 0x107b07db8[0x107b41800"\0\0\0\0", 0x107b41828"0", 0x107b41850"0", 0x107b41878"INTEGER", 0x107b418a0"deposit", ""]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment