Database - Specific Row and Column Retrieval

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Database - Specific Row and Column Retrieval

Post by Xombie »

I searched and didn't see this but I'll apologize if it's been asked.

Can there be any change that would allow for a value to be returned from a specific column and row? For example, PosgreSQL allows you to pass a row and column to the PQgetvalue() function to return the value at a specific location.

I mean, yeah, it can be programmed around and made so that you do each row in order and don't need to pass the row but it's nice to have the option (when the database supports it) to get the value from a specific row & column.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Database - Specific Row and Column Retrieval

Post by Fangbeast »

Using the reserved keyword of "rowid", I can use the following to go specifically to column 'mycolumn' in table 'mytable' in row 5 (if that's what you want?)

SELECT mycolumn FROM mytable WHERE rowid = 5
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Database - Specific Row and Column Retrieval

Post by srod »

Is that not SQLite only fangles?
I may look like a mule, but I'm not a complete ass.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Database - Specific Row and Column Retrieval

Post by Fangbeast »

srod wrote:Is that not SQLite only fangles?
As far as I am aware (and it's been a while I admit), it works on MySql as well. Don't have it handy to test but I seem to remember that rowid was a reserved SQL keyword and not a reserved SQLITE keyword.

But as I said, it's been a while.

I've been able to do this on old versions of MySQL (below) in the past to get a specific row (Don't know about now)..

SELECT mycolumn FROM mytable WHERE 5
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Re: Database - Specific Row and Column Retrieval

Post by Xombie »

Oh, no. I meant after a query like SELECT * FROM customers. But rather than going one row at a time and getting just the columns for that row you can select (with a function and not a SQL statement) any row and column value at any time during the execution of the statement.

I believe SQLite and PostgreSQL can both do this. Well, I know PGSQL can and SQLite can with the table thing, I think.
Post Reply