char **result;//result 的字段值是连续的,result是将二维表格映射成一维,索引0~col-1为字段名,之后依次是各行的数据
int row, col;
char *errmsg = NULL;
int ret = sqlite3_get_table(_database, SQL , &result, &row, &col, &errmsg);
if (ret == SQLITE_OK) {
int index = col;
for (int i=0; i < row; i++) {
for (int j=0; j < col; j++) {
printf("字段-> %-10s 值-> %-20s ", result[j], result[index]);
index++;
}
printf(" ");
}
}else{
printf("error : %s ", errmsg);
sqlite3_close(_database);
}
sqlite3_free_table(result);