Hi,
I use command-line to query the table:
# sqlite3 listtable
sqlite> select Name,Value from TblDeviceInfo;
AdditionalHardwareVersion
AdditionalSoftwareVersion
Description
DeviceLog
DeviceStatus
EnabledOptions
FirstUseDate
HardwareVersion 01B
Manufacturer III
ManufacturerOUI 001A2A
ModelName
ProductClass Speedstrea
ProvisioningCode 000.000.00
SerialNumber A000000001
SoftwareVersion 1.09.000
UpTime
I write a program:
===================================================================
#include <stdio.h>
#include <sqlite3.h>
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
char **result;
int nrow, ncol, i;
rc = sqlite3_open("listtable", &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_get_table(db, select Name,Value from TblDeviceInfo", &result,
&nrow, &ncol, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
sqlite3_free_table(result);
return -1;
}
fprintf(stderr, "Row = %d, Col = %d\n", nrow, ncol);
for (i = 0 ; i < nrow ; ++i)
fprintf(stderr,"%s\n", result[i]);
sqlite3_free_table(result);
sqlite3_close(db);
return 0;
===================================================================
The output is
Row = 16, Col = 2
Name
Value
AdditionalHardwareVersion
AdditionalSoftwareVersion
Description
DeviceLog
DeviceStatus
EnabledOptions
FirstUseDate
I don't know why I just get the 16 rows of data. I expect to get the 34 rows
of data.
What should I do?
Thank you.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users