In my C++ program, i want to partition sql table, there is sample code below. It is working right. the problem is after func called 2 or 3 times in func1, PQntuples results 0 although tablename exist. Also when i disabled PQntuples at if statement, other psql function PQgetvalue(res) return error that is"row number 0 is out of range 0..-1
there are a couple function call same as func1(to check tablename ), at func. when i disabled one of them another at PQntuples funcx return 0.
i check so may times. it is so weird.
So i think you can help me.
Best regards.
Zafer,
Sample code :
func1{ char cmd[100]=""; snprintf(cmd,sizeof(cmd),"select tablename from pg_tables where tablename='%s'", tablename);