Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 417881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:37:26+00:00 2026-05-12T18:37:26+00:00

I am working on a certain application. Its basic structure is as follows: a

  • 0

I am working on a certain application. Its basic structure is as follows:

  • a database
  • a web interface to control the whole system
  • a number of client applications on remote machines

The clients poll the database at regular intervals, to check if there are any tasks to perform. A task is:

  1. A formal name of the task (a string), for example “run-regression-test”
  2. A number of arguments. For simplicity, let’s assume, that those are strings. There is no need to support more, than, say, ten arguments.

If the client retrieves a task, it parses the name and the arguments and performs certain actions.

Since all of the state information is stored in the database, the tasks must be stored there as well. What I really don’t know, is how to implement this as cleanly as possible. Every solution I can come up with seems almost like an anti-pattern. One could store it in a single table like this:

create table tasks (
  id int not null auto increment primary key,
  name varchar(255),
  arg1 varchar(255),
  arg2 varchar(255),
  ...
)

I also thought of doing it in using two tables:

create table tasks (
  id int not null auto_increment primary key,
  name varchar(255)
)

create table task_args (
  id int not null auto_increment primary key,
  task_id int,
  arg varchar(255)
)

This is a bit more flexible and easy to implement as well. However, it is impossible to tell which argument out of a number of argumens is first, which is second, etc (can be fixed by adding a “sequence” column to the task_args table).

I am sure there are better and cleaner ways to do what I want. Perhaps someone with better skills in app-design can give me some inspiration.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:37:26+00:00Added an answer on May 12, 2026 at 6:37 pm

    Based on the auto_increment column, I guess your target database is MySQL. In PostgreSQL I’d probably use an array of varchars for this. It’s more practical for things like this where the values in the list are not foreign keys or you don’t need to query them. In MySQL you can’t do that, and using argX columns or serializing the array yourself is just wrong, so I’d use this:

    create table tasks (
        id int not null auto_increment primary key,
        name varchar(255)
    );
    
    create table task_args (
       task_id int not null,
       no int not null,
       arg varchar(255),
       primary key (task_id, no)
    );
    

    To get all arguments for a task you would run SELECT arg FROM task_args WHERE task_id=? ORDER BY no.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 227k
  • Answers 227k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm don't think this will give you exactly what you… May 13, 2026 at 1:27 am
  • Editorial Team
    Editorial Team added an answer Try setting [timeline] ticket_show_details = true in your trac.ini, then… May 13, 2026 at 1:27 am
  • Editorial Team
    Editorial Team added an answer Well I won't answer what I want (which is change… May 13, 2026 at 1:27 am

Related Questions

I am working on a desktop application in PyGTK and seem to be bumping
I am working on an Audit Log for an application that uses Linq-To-Sql. I
I am working with a wrapper class for CFHTTPMessage , which contains a CFHTTPMessageRef
I'm working on a large, aging code base for an MFC app. The code

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.