On Feb 3, 2009, at 12:16 PM, Nathan Biggs wrote: > I have a question about version 3.6.10. > > I downloaded the amalgamation source code and built a static > library. I > have included the static library in my Windows console application. I > have noticed something very strange though. to execute my statement I > use the prepare and then step not execute. If I run the following > sql, > I get no return data. > > select a.column1, b.column2 > from aTable a > left join bTable b > on a.id = b.aTable_id > > If I run the same sql statement through the command-line program > downloaded from the site for 3.6.10, it returns the data with > b.column2 > being null. Which is what I expected.
The command-line program uses exactly the same interfaces you are using. Are you sure that szSql is correct? Why are you not checking the return code from sqlite3_perpare()? > > > Below is my code > > // open database > rc = sqlite3_open(szFile, &db); > if( rc ){ > fprintf(stderr, "Can't open database: %s\n", > sqlite3_errmsg(db)); > sqlite3_close(db); > exit(1); > } > > sqlite3_stmt *ppStmt = 0;; > const char *zLeftover; > > //compile sql statement > rc = sqlite3_prepare(db, szSQL, -1, &ppStmt, &zLeftover); > > //step through recordset > int i = 0; > int nCol = 0; > char rowstr[256] = ""; > const char *temp; > > //get column count > nCol = sqlite3_column_count(ppStmt); > > //for each row > while(sqlite3_step(ppStmt)==SQLITE_ROW){ > > //for each column > for(int j=0;j<nCol;j++){ > temp = (char *)sqlite3_column_text(ppStmt, j); > strcat(rowstr, temp); > strcat(rowstr, "|"); > } > > cout << rowstr << endl; > strcpy(rowstr, ""); > i++; //increment row counter > } > > //delete recordset > rc = sqlite3_finalize(ppStmt); > > // close database > sqlite3_close(db); > > cout << "finished" << endl; > > > -- > *Nathan Biggs* > Computerway Food Systems > System Controls Manager > > (336) 841-7289 /Work/ > (336) 841-2594 /Fax/ > nbi...@mycfs.com > > PO Box 5623 (27262) > 635 Southwest Street > High Point, NC 27260 > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users D. Richard Hipp d...@hwaci.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users