Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Database Results Strategy

Database Results Strategy

Scheduled Pinned Locked Moved Database
databasequestionc++sql-serversysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    earl
    wrote on last edited by
    #1

    Folks, I mostly do systems programming but got suckered into writing an app for a business run by my brother. This is a POS system which is backed by SQL Server. I'm using WTL on the client and ODBC (because it seemed simple / straightforward) to communicate with the db. The question: there are a series of queries / reports that are run against the server. Exactly what is included in any individual report is variable -- eg a net sales report may or may not include gift certificates, employee discounts, etc. My question: what is the best strategy for passing query results around? They can be (1) displayed on screen, (2) saved to CSV, or (3) printed. I expect there may be future options in the future, such as blowing them directly into QuickBooks. Do people typically pass around the SQL statement handle and let the various consuming functions directly pull data via SQLFetch? That seems like a really bad idea. I currently have the SQL functions isolated and pull query results into an internal data structure -- vectors of structs right now. Unfortunately, I have to create structs for each query and pass around vectors. How do you deal with the fact that there are many optional fields -- just create an entry in the struct for each potential field? Also, what is the most convenient manner to deal with the fact that certain fields may be null? Are there better ways to do this? Thanks, Earl

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups