PHP Classes

Table from Insert: Generate create table SQL from an insert query

Recommend this page to a friend!
  Info   View files Example   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 35%Total: 489 This week: 1All time: 5,881 This week: 560Up
Version License PHP version Categories
table-from-insert 0.5GNU General Publi...3.0Databases, Text processing
Description 

Author

This class can generate create table SQL from an insert query.

It takes as parameter a SQL statement of a query to INSERT a table record.

The class builds a SQL query statement to create the given table from the field names used in the INSERT query. It parses the SQL INSERT query to extract all the field names and types.

Innovation Award
PHP Programming Innovation award nominee
February 2014
Number 6
If you have a SQL INSERT query complete with all the fields names and values, you may recover the structure of that table from the query.

This class can do that by parsing the SQL INSERT query and generating a CREATE TABLE statement with all the field names and types based on the parsed query values.

Manuel Lemos
Picture of Elminson De Oleo
  Performance   Level  
Name: Elminson De Oleo <contact>
Classes: 5 packages by
Country: United States United States
Age: 43
All time rank: 2415330 in United States United States
Week rank: 416 Up46 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php
$insert
="INSERT INTO `npanxx` (`id`, `npa`, `nxx`, `xi`, `xf`, `npanxx`, `region`, `provincia`, `cliente`, `servicio`, `tipored`, `localidad`, `remoto`, `central_host`, `fecha_inst`, `fecha_serv`, `compania`) VALUES (1, '809', '201', '00', '99', '809201', 'No aplica', 'No aplica', '', 'CELULAR PREPAGO', 'Movil', '30 de marzo', '', '30 de Marzo AUTOPLEX', '17/06/2005', '01/07/2005', 'CODETEL');
"
;
$class= new table_from_insert();
echo
$class->create($insert);

?>


  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetestfiles (1 file)
Files folder imagetests (1 file, 3 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file example.php Example example using the class
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data
Plain text file table_from_insert.class.php Class class generate sql table sql from insert sql
Accessible without login Plain text file test.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file SqlToTable.php Class Class source

  Files folder image Files  /  testfiles  
File Role Description
  Accessible without login Plain text file test.txt Doc. Documentation

  Files folder image Files  /  tests  
File Role Description
Files folder imagecss (7 files)
Files folder imagefonts (1 file)
Files folder imagejs (3 files)
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  tests  /  css  
File Role Description
  Accessible without login Plain text file bootstrap-theme.css Data Auxiliary data
  Accessible without login Plain text file bootstrap-theme.css.map Data Auxiliary data
  Accessible without login Plain text file bootstrap-theme.min.css Data Auxiliary data
  Accessible without login Plain text file bootstrap.css Data Auxiliary data
  Accessible without login Plain text file bootstrap.css.map Data Auxiliary data
  Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
  Plain text file table_from_insert.class.php Class Class source

  Files folder image Files  /  tests  /  fonts  
File Role Description
  Accessible without login Plain text file glyphicons-halflings-regular.svg Data Auxiliary data

  Files folder image Files  /  tests  /  js  
File Role Description
  Accessible without login Plain text file bootstrap.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.min.js Data Auxiliary data
  Accessible without login Plain text file npm.js Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 90%
Total:489
This week:1
All time:5,881
This week:560Up
User Ratings User Comments (1)
 All time
Utility:50%StarStarStar
Consistency:50%StarStarStar
Documentation:-
Examples:50%StarStarStar
Tests:-
Videos:-
Overall:35%StarStar
Rank:4093