Nothing to do with SQLite, but ...
On Fri, Mar 18, 2011 at 4:01 AM, Matt Young wrote:
>
> Here is my Javascript code, it works. Except I have to know the table field
> names within the javascript code itself: This little phrase:
>
> results.rows[i].f1
>
> f1 is a field name, I have to know this in the call.
> Yes I know indexDB is coming, but is there a workaround for this? I want to
> scoop up the roiw even though I do not know the column names.
>
> function executeSqlRead(sqlString) {
> db.transaction(
> function (tx) {
> tx.executeSql(sqlString, [],
> function (tx, results) {
> var numrows = results.rows.length;
>
> qout.innerHTML += tx + "Rd: " + numrows +" rows";
> var i = 0;
> while( i < numrows) {
> qout.innerHTML +=
> "" + results.rows[i].f1 + "" ;
> i += 1;
> }
How about:
while( i < numrows) {
qout.innerHTML += "";
for( var p in results.rows[i]) {
qout.innerHTML += results.rows[i][p];
}
qout.innerHTML += "";
i += 1;
}
Or variations that factor out the collection of property names
(outside of the loop), since they will be the same for every row.
> }, function (t, e) {
> qout.innerHTML += ' Error: '+e.message+'';
> }
> );
> }
> );
> }
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users