Schema tutorial
adodbsyntax
Not sure if the people at AdoDB would find it useful - but anyone converting a database schema by hand will definitely find it valuable.
Stephan aka wolff_borg
// iterate through source tables foreach($tables_src as $table) { ... $schema = $gDb_src->MetaColumns( $table, false, true ); $t = ""; $first = true; foreach(array_keys($schema) as $col) { $t .= (!$first) ? ",\n" : ""; $x = $schema[$col]; $t .= $x->name . " "; switch($x->type) { case "int": $i = abs(( ( (int)$x->max_length ^ 2) - 1 )); $i = ($i == 5) ? 4 : $i; $i = ($i == 0) ? 1 : $i; $t .= "I" . $i; break; case "varchar": case "char": $t .= "C(" . $x->max_length . ")"; break; case "datetime": $t .= "T"; break; case "longblob": case "text": $t .= "X"; break; default: die($x->type); } $default = (!$x->binary) ? $x->has_default : false; $t .= " " . ( ($x->unsigned) ? "UNSIGNED" : "" ) . " " . ( ($x->not_null) ? "NOTNULL" : "" ) . " " . ( ($x->auto_increment) ? "AUTO" : "" ) . " " . ( ($x->primary_key) ? "PRIMARY" : "" ) . " " . ( ($default) ? "DEFAULT ". $x->default_value : "" ); $table_schema[$table] = $t; $first = false; } $indices[$table] = $gDb_src->MetaIndexes( $table, false, false ); }
Related Items
Documentation » Tutorials
Tutorials to help you work out how something in bitweaver is done
Archived Picture Upload with Fisheye under Windows • Configuring multisites • Creating Screencasts • DatabaseTestsAndFixes-Firebird • GalaxiaTutorial • Groups and Permissions • Home Page Tutorial • Install pspell on Windows • IntegrationTutorial • JavaScript Module Tutorial • Migrating Users Between Bitweaver Sites • phpBB to Boards Upgrade • phpbbTutorial • Sandbox • Schema tutorial • SearchPackageDevNotes • Speed optimisation • Squirrel Mail Integration Tutorial • theme compliance with MSIE • ThemeTutorial • TopBarTutorial • TranslationTutorial • Tutorial_Custom_Module • Tutorial - Liberty Plugins • Tutorial - Liberty Plugins II • Tutorials • Use bitweaver to build a web site that is very nice • Wiki Plugin Tutorial • Screencasts • InstallShots • Video: Installation of Bitweaver
Comments