DHTMLX Docs & Samples Explorer

Index
dhtmlxconnector
Connectors and Oracle DB

## Connectors and Oracle DB

Sample of init code , can be checked here

### Inserting new records

Oracle has not auto ID generation functionality , so you need to provide some custom ID for each insert operations. There are two ways to do such task

- custom ID generation - id generated by PHP code

    	function pre_insert($data){
    	    	$new_id = time()%10000; //any other ID generation logic can be used here
        		$data->add_field("EMPLOYEE_ID",$new_id);
    	}
    	$grid->event->attach("beforeInsert","pre_insert");
    	$grid->render_table("EMPLOYEES","EMPLOYEE_ID","FIRST_NAME,LAST_NAME");

- use sequence for ID generation

    	$grid->sql->sequence("EMPLOYEES_INC.nextVal"); //sequence name
    	$grid->render_table("EMPLOYEES","EMPLOYEE_ID","FIRST_NAME,LAST_NAME");