YoungL

+Clients
  • Content count

    74
  • Joined

  • Last visited


About YoungL

  • Rank
    IPB Member
  • Birthday 09/19/1988

Contact Methods

Profile Information

  • Gender Male
  • Location Kingston upon Thames, UK

YoungL's Activity

  1. YoungL added a post in a topic: Inserting Multiple Rows...   

    Ok that makes a little more sense I guess. I'll test that out and see how it performs  :)
  2. YoungL added a post in a topic: Inserting Multiple Rows...   

    But if my Foreach loop is 100 items. Thats 100 insert queries. With my $this->DB->query() function, I am just using 1 query. The performance of using just 1 query is much better, and this is amplified if the latency between the webserver and the database server is great.
  3. YoungL added a post in a topic: Inserting Multiple Rows...   

    Having scoured the documentation I Cannot see if it is possible to insert multiple rows using the API.
     
    I have resorted to this...
    foreach ( $array as $k => $v ) { $insert[] = "( " . $v[1] . "," . $v[2] . " )"; } $query = "INSERT INTO " . $this->settings['sql_tbl_prefix'] . "table_name (col1, col2) VALUES " . implode( ",",$insert ); $this->DB->query( $query ); However this seems really messy and doesn't make use of the API. Why can the DB Class not take an array of values such as:
    $this->DB->insert( "table_name", array( "col1" => array( val1, val2, val3 ), "col2" => array( val1, val2, val3 ), ) ); Because at the minute, what this does, is it encourages you to use the API but to run the insert statement in a loop, which is far less efficient than running one query with multiple inserts.
     
    Unless of course I have missed the documentation which allows you to do multiple inserts?
  4. YoungL added a comment on a file: (Indo32) Prevent using URL in Status Update   

    This is a great addon thanks. Has helped me clear up the number of spammers posting links in their statuses. Highly recommend this.

About Me

Status Feed