How to get rowid for select query?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get rowid for select query?

Andy-3
I successfully insert blob. I use sqlite3_last_insert_rowid afer calling
sqlite3_step.
But how to retrieve blob?
I try "select rowid, field1,field2 from table" but first value was not
number rowid but literary string "rowid".
I can get blob if I know rowid.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get rowid for select query?

Andy-3
I don't know why sqlite3_get_table
for 'SELECT rowid, id, Bytes, BytesCompr, flags FROM Articles where id=5
limit 1'
give me column names:
rowid id Bytes BytesCompr flags
instead od values of this columns

pt., 10 sty 2020 o 13:36 Andy <[hidden email]> napisał(a):

> I successfully insert blob. I use sqlite3_last_insert_rowid afer calling
> sqlite3_step.
> But how to retrieve blob?
> I try "select rowid, field1,field2 from table" but first value was not
> number rowid but literary string "rowid".
> I can get blob if I know rowid.
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get rowid for select query?

Clemens Ladisch
In reply to this post by Andy-3
Andy wrote:
> I try "select rowid, field1,field2 from table" but first value was not
> number rowid but literary string "rowid".

Please show the actual code (not SQL, but your program) that you're executing.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get rowid for select query?

Andy-3
In reply to this post by Andy-3
OK, first row is always header, next rows are values of query,

pt., 10 sty 2020 o 13:56 Andy <[hidden email]> napisał(a):

> I don't know why sqlite3_get_table
> for 'SELECT rowid, id, Bytes, BytesCompr, flags FROM Articles where id=5
> limit 1'
> give me column names:
> rowid id Bytes BytesCompr flags
> instead od values of this columns
>
> pt., 10 sty 2020 o 13:36 Andy <[hidden email]> napisał(a):
>
>> I successfully insert blob. I use sqlite3_last_insert_rowid afer calling
>> sqlite3_step.
>> But how to retrieve blob?
>> I try "select rowid, field1,field2 from table" but first value was not
>> number rowid but literary string "rowid".
>> I can get blob if I know rowid.
>>
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get rowid for select query?

Andy-3
In reply to this post by Clemens Ladisch
previous:
  rescells.Clear;
  rc := sqlite3_get_table(db, PChar(selectquery), @selres, @nRow, @nColumn,
@zErrmsg);
  Result := rc = SQLITE_OK;
  for i := 0 to nRow * nColumn - 1 do
  begin
    rescells.Add(selres[i]);
  end;
  if selres <> nil then
    sqlite3_free_table(selres);

current, working
  rescells.Clear;
  rc := sqlite3_get_table(db, PChar(selectquery), @selres, @nRow, @nColumn,
@zErrmsg);
  Result := rc = SQLITE_OK;
  for i := 0 to (nRow+1) * nColumn - 1 do <---------- nRow+1  - it is works
  begin
    rescells.Add(selres[i]);
  end;
  if selres <> nil then
    sqlite3_free_table(selres);



pt., 10 sty 2020 o 14:01 Clemens Ladisch <[hidden email]> napisał(a):

> Andy wrote:
> > I try "select rowid, field1,field2 from table" but first value was not
> > number rowid but literary string "rowid".
>
> Please show the actual code (not SQL, but your program) that you're
> executing.
>
>
> Regards,
> Clemens
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users