GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

🌸 GOLF(2gg) β€” the current-row page, bestie edition 🌸

okay so this is a page from the 2gg manual (yep, that's the manual name, and it lives in the Development section), and it's about a little cutie called current-row. let's get into it πŸ’–


✨ NAME ✨

current-row β€” a database thing πŸ—„οΈπŸ’…


πŸŽ€ PURPOSE πŸŽ€

bestie, this is how you get the row number of the current row inside a query's result-set, or print it out. that's the whole job. iconic behavior honestly 🫢


🌈 SYNTAX 🌈

current-row [ to <current row> ]

like, that's it. that's the whole thing. no cap ✨


πŸ’– DESCRIPTION πŸ’–

If you call current-row without the to clause, it just prints out the current row number. and the first row is numbered 1 β€” so it's 1-indexed, we love a girl who starts at 1 πŸ’…

If you do use the to clause, then the row number gets stored into the variable <current row> instead. like, you're catching it and keeping it πŸŽ€

⚠️ important one, bestie: current-row must be within a run-query loop, and it always refers to the most inner one. so if you've got loops inside loops inside loops, she's only ever talking about the innermost one. periodt. πŸ™ˆ

🌸 EXAMPLES 🌸

okay so here's the vibe β€” displaying the row number right before a line that has the first and last name of each employee 🧚✨

run-query @mydb="select firstName, lastName from employee" output firstName, lastName
    @Row #<<current-row>><br/>
    print-out firstName
    @,
    print-out lastName
    @<br/>
end-query

look at her go. the row number, then the name, every single time. ate. πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

Database β€” and literally all of these besties:

  • begin-transaction
  • commit-transaction
  • current-row
  • database-config-file
  • db-error
  • mariadb-database
  • postgresql-database
  • rollback-transaction
  • run-query
  • sqlite-database

and hey β€” See all documentation if you want the whole tour πŸŒˆπŸ’œ


and that's the page!! this version was dated $DATE and tagged $VERSION, and yeah, it's still GOLF(2gg) at the end of the day πŸ¦‹ mwah, go run some queries bestie πŸ’–βœ¨

πŸ“¦ where this page comes from