Jump to content

insert into mysql clusterdb table that has no primary key but unique values


Recommended Posts

hello

 

i am inserting into a table that has no primary key, i make sure tehre is no entery in it that matche sthe one i am about to insert, but it kicks up the Duplicate entry '0' for key 'PRIMARY' error, any ideas ?

 

thanks

Then you *do* have a primary key.... post the SHOW CREATE TABLE.

 

i figured it out, my ip to decimal function is creating - minus values for some ip's that are not in teh 10's range, and minus values into key's are interperated as 0 hence duplicate 0 key.

 

Do you know where i may find a good ip to decimal conversion funmction or should i just write it , thanks

what happened was i have to apply the subnet mask to the ip's as our networks are usualy subnetted into a few nets and this provisioning tool also acts as a router config generator so theres alot of stuff done with XOR and AND on devimal values of ip's the problem i had is that the php.net fiunction ip2long() returns a -minus value wich is of no real decimal representation then on teh site it says to show the decimal value format it with sprintf using %u i seriously ddont know what that does but fixes it, anyhow i need the minus value that is retunred to convert from decimal back to quad octet ipv4, the php function long2ip() takes the minus value from the previouse function and uses that, there was confusion over this anyways it seemed to be happy with ip's in the 10's range with the unformated values.

 

My app's look and flow great there super advanced kicking with windows GUIS and magical stuff and a fully zend framwork with controlers im like ajax api/controler/getthisstuffasJSON and then the json is fed into things its sooo powerfull ExtJs and Zend framework.

 

in controler methods u can just exit with a true false u can use ajax to ask ur server questions very very easily 1 func and 1 call its done, the mod rewrite makes it further powerfull ajax(url:/module/controler/method) thsi is due to the zend framework.

 

http://extjs.com/deploy/dev/examples/desktop/desktop.html

 

http://extjs.com/deploy/dev/docs/?class=Ext.Component

http://php-ext.quimera-solutions.com/

http://framework.zend.com/manual/en/

 

its mind blowing, that demo is nothing compared to what u can actualy do

 

on top of this i am using a ExtJs wrapper so i can do all teh extjs styuff in PHP and then on events write pure Extjs js in a php string in teh event handler of that ExtJS PHP wrapped objjext.

 

 

MArvel at my glory lol

 

<?php $templateStore = new PhpExt_Data_JsonStore();
$templateStore->addField(new PhpExt_Data_FieldConfigObject("template_id"));
$templateStore->addField(new PhpExt_Data_FieldConfigObject("name"));
$templateStore->addField(new PhpExt_Data_FieldConfigObject("desc")); 
$templateStore->setRoot("items");
$templateStore->setUrl("/api/inventory/filterTemplates");
$templateStore->attachListener("load", new PhpExt_Listener(
			                PhpExt_Javascript::functionDef(null,
			                       "
			                        Ext.Ajax.request({
									   url: '/api/inventory/checkiftemplatevalidindbagainstportalandproduct',
									   success: function(result, request){
											exists = result.responseText;
											Ext.getCmp('provisonFormPanel').getForm().findField('p_template_id').setValue($_p_template_id);
											if(exists == 'true'){
												myArray = Ext.arrayData.templates;
					                       		
												for (i=0; i < myArray.length; ++i){
					                       			if(myArray[i][0] == {$_p_template_id}){
					                       				name = myArray[i][1];
					                       				id = myArray[i][0];
					                       			}
												}
												Ext.getCmp('provisonFormPanel').getForm().findField('p_template_id').setValue(id);
											}
											else{
												if({$_p_template_id} != '0'){
													myArray = Ext.arrayData.templates;
						                       		for (i=0; i < myArray.length; ++i){
						                       			if(myArray[i][0] == {$_p_template_id}){
						                       				name = myArray[i][1];
						                       			}
													}
													Ext.getCmp('prov_template_id').setValue();
													Ext.getCmp('prov_template_id').markInvalid('Due to changes in the provisioner validation the template configured (<b>'+name+'</b>) is not allowed in this portal device combo and is not product specific.');
						                    	}
					                       	}
									   },
									   failure: function(){
									   },
									   params: { 
									   		template_id: '{$_p_template_id}', 
									   		portal_id: Ext.getCmp('property_id').getValue(),
											product_id: Ext.getCmp('product').getValue()
									   }
									});

			                       ",
			                       array('c'))
			                ));

$provTemplateCombo = new PhpExt_Form_ComboBox("prov_template_id","prov_template_id","prov_template_id","prov_template_id");
$provTemplateCombo->setTemplate('<tpl for="."><div ext:qtip="{desc}" class="x-combo-list-item">{template_id} {name}</div></tpl>')
                 ->setStore($templateStore) // $templateStore 
                 ->setDisplayField("name")
                 ->setValueField("template_id")
                 ->setHiddenName("p_template_id")
                 ->setTypeAhead(true)
                 ->setMode(PhpExt_Form_ComboBox::MODE_REMOTE)
                 ->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL)
                 ->setEmptyText("Select a template...")
                 ->setSelectOnFocus(true)
                 ->setForceSelection(true) // only allow what's inthe pulldown
                 ->setfieldLabel("Provisioned Template")
                 ->setId("prov_template_id")
                  ->attachListener("render", new PhpExt_Listener(
			                PhpExt_Javascript::functionDef(null,
			                       "
			                        if(Ext.getCmp('property_id').getValue()){
					                    Ext.getCmp('prov_template_id').store.baseParams = {
											portal_id: Ext.getCmp('property_id').getValue(),
											product_id: Ext.getCmp('product').getValue()
										}
					                }
					                else {
					                	Ext.getCmp('prov_template_id').store.baseParams = {
											product_id: Ext.getCmp('product').getValue()
										}
					                }
			      					Ext.getCmp('prov_template_id').store.reload();
			                       ",
			                       array('c'))
			                )); ?>

 

in fire fox you attach it to firebug and then trhat lets you programm the @GUI str8 thro a command line in firfox and also you can dump stuff into firefox without having to echo it, you can turn query profiling on to see all your queries in teh firbug console.

 

 

create a grided output in 2 secs on wich you can double click and a gui window dragable apears with an easy define method of forms etc and its infinate just like windows proepr cloud computing.

 

 

Thanks guys

Congratulations, but is it really relevant to this topic?

Interesting as it is, why don't you post about in 'Miscellaneous' section? Or blog about it and drop us a link? ;)

 

maybe, yeh should get moved into misc probs anyways

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.