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 7558059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:16:58+00:00 2026-05-30T12:16:58+00:00

I’m writing a database class for my site based on a fluent interface. First,

  • 0

I’m writing a database class for my site based on a fluent interface. First, I collect all the meaningful terms then put them into the “stack”, which is basically an array. Then, I sort them in order that they would appear in an actual SQL query.

const stmt_select = 1;
const stmt_insert = 2;
const stmt_delete = 3;

const sql_select = 10;
const sql_from = 11;
const sql_into = 12;
const sql_where = 13;
const sql_join = 14;
const sql_group = 15;
const sql_order = 16;
const sql_limit = 17;

For example, the query below (although in a total rubbish order, and purposely trying to throw the class off):

Query::Select('name', 'age', 'height')
    ->Order('a')
    ->From('table')
    ->From('asd')
    ->Group('a')
    ->Execute();

.. produces:

Array
(
    [0] => Array
        (
            [0] => 10
            [1] => Array
                (
                    [0] => name
                    [1] => age
                    [2] => height
                )

        )

    [1] => Array
        (
            [0] => 11
            [1] => asd
        )

    [2] => Array
        (
            [0] => 11
            [1] => table
        )

    [3] => Array
        (
            [0] => 15
            [1] => a
        )

    [4] => Array
        (
            [0] => 15
            [1] => a
        )

)

The problem I have is that some array members I want to merge together (for example multiple ->Selects()/->Where() clauses) and some array members I want to delete entirely if there are multiple instances because it isn’t possible for there to be more than one (for example ->Limit(), ->Order()), however I’m not entirely sure what the easiest way to do this is.

I was thinking something along the lines of a function I could call for each subkey;

DeleteDuplicates(sql_order);
Merge(sql_select);

Not sure how to write these without a massive performance hit per query.

  • 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-30T12:16:58+00:00Added an answer on May 30, 2026 at 12:16 pm

    Your class should handle duplicates as early as possible. E.g., each call to select() should not add another item to the main array, but all calls to select() should be collected in the same stack item.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a text area in my form which accepts all possible characters from
I am writing an app with both english and french support. The app requests
I have a reasonable size flat file database of text documents mostly saved in
I am doing a simple coin flipping experiment for class that involves flipping a

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.