[Easymod-cvs] easymod2/mods/easymod/em_includes em_schema.php,1.2,1.3
Status: Beta
Brought to you by:
wgeric
From: Brendan K. <bk...@us...> - 2005-05-01 12:23:39
|
Update of /cvsroot/easymod/easymod2/mods/easymod/em_includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25556/easymod/em_includes Modified Files: em_schema.php Log Message: Redoing some of Erics edits for title length, applying a small fix for the default spaces, and fixing a typo. Index: em_schema.php =================================================================== RCS file: /cvsroot/easymod/easymod2/mods/easymod/em_includes/em_schema.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** em_schema.php 29 Apr 2005 23:18:25 -0000 1.2 --- em_schema.php 1 May 2005 12:23:18 -0000 1.3 *************** *** 155,162 **** ! function parse_field_increment( $params, $parmpos, &$error) { // if the array pos isn't set, then get us out of here ! if (!isset( $params[$parmpos])) { return '' ; --- 155,162 ---- ! function parse_field_increment( $params, $parampos, &$error) { // if the array pos isn't set, then get us out of here ! if (!isset( $params[$parampos])) { return '' ; *************** *** 164,168 **** // see if its auto_increment ! else if ( strtolower($params[$parmpos]) == 'auto_increment') { return 'auto_increment' ; --- 164,168 ---- // see if its auto_increment ! else if ( strtolower($params[$parampos]) == 'auto_increment') { return 'auto_increment' ; *************** *** 249,259 **** // this will give us the first occurence of ) and the associated pos ! $parmpos = (strstr($p4, ')')) ? 3 : 0 ; ! $parmpos = (strstr($p3, ')')) ? 2 : $parmpos ; ! $parmpos = (strstr($p2, ')')) ? 1 : $parmpos ; ! $parmpos = (strstr($p1, ')')) ? 0 : $parmpos ; // add 2 to the pos for name and type + whatever we had for the length ! $parmpos += 2 ; --- 249,259 ---- // this will give us the first occurence of ) and the associated pos ! $parampos = (strstr($p4, ')')) ? 3 : 0 ; ! $parampos = (strstr($p3, ')')) ? 2 : $parampos ; ! $parampos = (strstr($p2, ')')) ? 1 : $parampos ; ! $parampos = (strstr($p1, ')')) ? 0 : $parampos ; // add 2 to the pos for name and type + whatever we had for the length ! $parampos += 2 ; *************** *** 311,316 **** // set unsigned if need be ! $signed = ( strtoupper($params[$parmpos]) == 'UNSIGNED') ? 'UNSIGNED' : '' ; ! $parmpos = ( $signed == 'UNSIGNED') ? ($parmpos+1) : $parmpos ; --- 311,316 ---- // set unsigned if need be ! $signed = ( strtoupper($params[$parampos]) == 'UNSIGNED') ? 'UNSIGNED' : '' ; ! $parampos = ( $signed == 'UNSIGNED') ? ($parampos+1) : $parampos ; *************** *** 319,324 **** /* // try "null" or "not null" first ! $null = parse_field_null( $params[$parmpos], $params[$parmpos+1], $error) ; ! $parmpos = ( $null == 'NULL') ? $parmpos+1 : ( ( $null == 'undefined') ? $parmpos : $parmpos+2 ) ; // mysql manual: If neither NULL nor NOT NULL is specified, the column is treated as though NULL had been specified. $null = ($null == 'undefined') ? 'NULL' : $null ; --- 319,324 ---- /* // try "null" or "not null" first ! $null = parse_field_null( $params[$parampos], $params[$parampos+1], $error) ; ! $parampos = ( $null == 'NULL') ? $parampos+1 : ( ( $null == 'undefined') ? $parampos : $parampos+2 ) ; // mysql manual: If neither NULL nor NOT NULL is specified, the column is treated as though NULL had been specified. $null = ($null == 'undefined') ? 'NULL' : $null ; *************** *** 326,330 **** // default value ! $default = parse_field_default( $params[$parmpos], $parmpos, $numparams, $error ) ; if ($default == 'undefined') { --- 326,330 ---- // default value ! $default = parse_field_default( $params[$parampos], $parampos, $numparams, $error ) ; if ($default == 'undefined') { *************** *** 335,344 **** else { ! $default_value = parse_field_default_value( $params[$parmpos+1], $error) ; ! $parmpos = $parmpos+2 ; } */ // try "null" or "not null" first ! $null = parse_field_null( $params[$parmpos], $params[$parmpos+1], $error) ; // if we didn't get a null declaration, then see if the default is coming first --- 335,344 ---- else { ! $default_value = parse_field_default_value( $params[$parampos+1], $error) ; ! $parampos = $parampos+2 ; } */ // try "null" or "not null" first ! $null = parse_field_null( $params[$parampos], $params[$parampos+1], $error) ; // if we didn't get a null declaration, then see if the default is coming first *************** *** 346,350 **** { // default value ! $default = parse_field_default( $params[$parmpos], $parmpos, $numparams, $error ) ; // if we don't get a default then both the default and null are definitely undefined --- 346,350 ---- { // default value ! $default = parse_field_default( $params[$parampos], $parampos, $numparams, $error ) ; // if we don't get a default then both the default and null are definitely undefined *************** *** 361,386 **** { // Make the default string (combine array, split by spaces) ! while($parmpos++) ! { ! if(!isset($default_string)) ! { ! $default_string = $params[$parmpos]; ! } ! elseif($params[$parmpos]{strlen($params[$parmpos])-1} == "'") { ! $default_string .= ' ' . $params[$parmpos]; break; } else { ! $default_string .= ' ' . $params[$parmpos]; } ! } $default_value = parse_field_default_value( $default_string, $error); ! $parmpos = $parmpos+2 ; // try "null" or "not null" first ! $null = parse_field_null( $params[$parmpos], $params[$parmpos+1], $error) ; ! $parmpos = ( $null == 'NULL') ? $parmpos+1 : ( ( $null == 'undefined') ? $parmpos : $parmpos+2 ) ; // mysql manual: If neither NULL nor NOT NULL is specified, the column is treated as though NULL had been specified. $null = ($null == 'undefined') ? 'NULL' : $null ; --- 361,383 ---- { // Make the default string (combine array, split by spaces) ! $default_string = ''; ! while($parampos++ < count( $params )) ! { ! if(substr( $params[$parampos], -1 ) == "'") { ! $default_string .= $params[$parampos]; break; } else { ! $default_string .= $params[$parampos] . ' '; } ! } $default_value = parse_field_default_value( $default_string, $error); ! $parampos = $parampos+2 ; // try "null" or "not null" first ! $null = parse_field_null( $params[$parampos], $params[$parampos+1], $error) ; ! $parampos = ( $null == 'NULL') ? $parampos+1 : ( ( $null == 'undefined') ? $parampos : $parampos+2 ) ; // mysql manual: If neither NULL nor NOT NULL is specified, the column is treated as though NULL had been specified. $null = ($null == 'undefined') ? 'NULL' : $null ; *************** *** 392,399 **** { // will either be NULL or NOT NULL so add either 1 or 2 to the parmpos ! $parmpos = ( $null == 'NULL') ? $parmpos+1 : $parmpos+2 ; // default value ! $default = parse_field_default( $params[$parmpos], $parmpos, $numparams, $error ) ; if ($default == 'undefined') { --- 389,396 ---- { // will either be NULL or NOT NULL so add either 1 or 2 to the parmpos ! $parampos = ( $null == 'NULL') ? $parampos+1 : $parampos+2 ; // default value ! $default = parse_field_default( $params[$parampos], $parampos, $numparams, $error ) ; if ($default == 'undefined') { *************** *** 405,426 **** { // Make the default string (combine array, split by spaces) ! while($parmpos++) ! { ! if(!isset($default_string)) ! { ! $default_string = $params[$parmpos]; ! } ! elseif($params[$parmpos]{strlen($params[$parmpos])-1} == "'") { ! $default_string .= ' ' . $params[$parmpos]; break; } else { ! $default_string .= ' ' . $params[$parmpos]; } ! } $default_value = parse_field_default_value( $default_string, $error); ! $parmpos = $parmpos+2 ; } } --- 402,420 ---- { // Make the default string (combine array, split by spaces) ! $default_string = ''; ! while($parampos++ < count( $params )) ! { ! if(substr( $params[$parampos], -1 ) == "'") { ! $default_string .= $params[$parampos]; break; } else { ! $default_string .= $params[$parampos] . ' '; } ! } $default_value = parse_field_default_value( $default_string, $error); ! $parampos = $parampos+2 ; } } *************** *** 428,432 **** // AUTO_INCREMENT; only do this is there is one more paramater ! $increment = parse_field_increment( $params, $parmpos, $error) ; // create the return array --- 422,426 ---- // AUTO_INCREMENT; only do this is there is one more paramater ! $increment = parse_field_increment( $params, $parampos, $error) ; // create the return array |