Welcome Guest, Not a member yet? Register   Sign In
MySQL insert ignore query
#1

[eluser]m.christie[/eluser]
Hopefully this hasn't already been done, but I found it useful to add a MySQL INSERT IGNORE option in the database class.
I couldn't find any guides on how to do this, so I thought I'd write it up and post it here incase anyone finds it useful
http://christiesmedia.co.uk/blog/codeign...sertignore
#2

[eluser]Devon Lambert[/eluser]
This is great!

I was just looking for a way to enable this functionality myself.

<strike>Do you know if there's a way that we can extend the core as opposed to overwriting core files?</strike>

I just realized you can extend this functionality. Would be much better to do the hacking in an extension as opposed to the core files.
#3

[eluser]m.christie[/eluser]
[quote author="Devon Lambert" date="1267049992"]This is great!

I was just looking for a way to enable this functionality myself.

<strike>Do you know if there's a way that we can extend the core as opposed to overwriting core files?</strike>

I just realized you can extend this functionality. Would be much better to do the hacking in an extension as opposed to the core files.[/quote]

Yip it's unfortunate that you can't extend the database class, but I've tried this and I've not found any problems with it so you should be fine Smile

Although, doing something that isn't recommended by the original developers... at your own risk etc. ;-)
#4

[eluser]Devon Lambert[/eluser]
[quote author="m.christie" date="1267052736"]Yip it's unfortunate that you can't extend the database class, but I've tried this and I've not found any problems with it so you should be fine Smile

Although, doing something that isn't recommended by the original developers... at your own risk etc. ;-)[/quote]

No Christie,

I was actually saying that you CAN extend the core rather than overwriting it.

Take a look at this CI wiki post:

Extending Database Drivers

There's also the way discussed in the following post which doesn't involve any hacking but it makes use of 2 queries instead of 1.

http://ellislab.com/forums/viewthread/144660/
#5

[eluser]m.christie[/eluser]
[quote author="Devon Lambert" date="1267054414"][quote author="m.christie" date="1267052736"]Yip it's unfortunate that you can't extend the database class, but I've tried this and I've not found any problems with it so you should be fine Smile

Although, doing something that isn't recommended by the original developers... at your own risk etc. ;-)[/quote]

No Christie,

I was actually saying that you CAN extend the core rather than overwriting it.

Take a look at this CI wiki post:

Extending Database Drivers

There's also the way discussed in the following post which doesn't involve any hacking but it makes use of 2 queries instead of 1.

http://ellislab.com/forums/viewthread/144660/[/quote]

Ah sorry I misread your post.

I was just thinking of CI user guide where it says "Note: The Database classes can not be extended or replaced with your own classes".
But as always there are many ways of doing things, so everyone can use whichever ways suits their situation.




Theme © iAndrew 2016 - Forum software by © MyBB