Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Support IGNORE clause for INSERT
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Janich  
View profile  
 More options Jul 22 2012, 4:09 am
From: Janich <jan...@gmail.com>
Date: Sun, 22 Jul 2012 01:09:18 -0700 (PDT)
Local: Sun, Jul 22 2012 4:09 am
Subject: Re: Support IGNORE clause for INSERT

From a quick search, it doesnt look like MSSQL supports this either, so it
would seem a very MySQL specific case.

But there are other ways to do it.
Try check this thread out for inspiration on alternatives:
http://stackoverflow.com/questions/548541/insert-ignore-vs-insert-on-... (both
MySQL and non-MySQL specific solutions there)

/ Janich

On Saturday, 21 July 2012 20:37:59 UTC+2, Aerendir wrote:

> Hi at all,
> this is my first post on this group, so excuse me for any error of any
> kind :)

> I'm developing an app using Joomla! Platform 12.1 and i need to use IGNORE
> clause for a set of multiple insert.

> Actually, the framework doesn't support the use of this clause, but,
> reading the code, it seems quite simple to add it.

> If i'm not wrong it could be sufficient to edit the method insert of the
> JDatabaseQuery class (joomla/database/query.php).

> Now the function is this:

> *public function **insert*($table, $incrementField*=**false*)
> {
> $this*->*type *=* 'insert';
> $this*->*insert *= new *JDatabaseQueryElement('INSERT INTO', $table);
> $this*->*autoIncrementField *= *$incrementField;

> *return *$this;
> }

> I think (but i could be wrong! I don't yet fully know the logic of the
> entire database package) that the function could be rewrote in this way:

> *public function **insert*($table, $incrementField*=**false*, $ignore=*
> false*)
> {
> $this*->*type *=* 'insert';

>   *if*($ignore)
> {
> $this*->*insert *= new *JDatabaseQueryElement('INSERT IGNORE INTO', $table
> );
> }
> *else
> *{
> $this*->*insert *= new *JDatabaseQueryElement('INSERT INTO', $table);
> }

> $this*->*autoIncrementField *= *$incrementField;

> *return *$this;
> }

> What do you think about?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.