%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Check Physical structure of database ' Product : CandyPress Store Frontend ' Version : 2.5 ' Modified : February 2004 ' Copyright: Copyright (C) 2004 CandyPress.Com ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at webmaster@candypress.com '************************************************************************* Option explicit Response.Buffer = true const adminLevel = 0 %> <% 'Declare variables dim mySQL, cn, rs dim i, result, field dim fixSQL 'DataTypes Const adInteger = "|3|" Const adDouble = "|5|" Const adDBTimeStamp = "|7|135|" Const adVarChar = "|202|200|" Const adLongVarChar = "|203|201|" 'Error Counter dim errorCount errorCount = 0 'Cater for SQL & Access dim genAUTOINCREMENT dim genMEMO dim genTEXT dim genTIMESTAMP dim genDOUBLE '************************************************************************* if dbType = 1 then 'SQL Server genAUTOINCREMENT = "INTEGER IDENTITY(1,1) PRIMARY KEY" genMEMO = "TEXT" genTEXT = "VARCHAR" genTIMESTAMP = "DATETIME" genDOUBLE = "FLOAT" else 'Microsoft.Jet.OLEDB.3.51 tweak for AutoIncrement values if instr(lCase(connString),lCase("Jet.OLEDB.3.51")) > 0 then genAUTOINCREMENT= "AUTOINCREMENT" else genAUTOINCREMENT= "AUTOINCREMENT(1,1) PRIMARY KEY" end if genMEMO = "MEMO" genTEXT = "TEXT" genTIMESTAMP = "TIMESTAMP" genDOUBLE = "DOUBLE" end if %>
Database Verification
| <% 'Open DB call openDb() '************************************************************************* 'START : Table Validations '(*,0) = Field Name '(*,1) = Field Data Type '(*,2) = Field Length (-1=Not specified, -2=Auto Increment) '(*,3) = Field Default (-1=Not specified) '************************************************************************* 'Check storeAdmin dim storeAdmin(100,3) i = 0 addField storeAdmin,"idConfig", adInteger, -2, -1 addField storeAdmin,"adminType", adVarChar, 1, -1 addField storeAdmin,"configVar", adVarChar, 50, -1 addField storeAdmin,"configVal", adVarChar, 255,-1 addField storeAdmin,"configValLong", adLongVarChar, -1, -1 checkTable storeAdmin, "storeAdmin" 'Check reviews dim reviews(100,3) i = 0 addField reviews,"idReview", adInteger, -2, -1 addField reviews,"idProduct", adInteger, -1, -1 addField reviews,"revDate", adDBTimeStamp, -1, -1 addField reviews,"revDateInt", adVarChar, 25, -1 addField reviews,"revAuditInfo", adVarChar, 255,-1 addField reviews,"revStatus", adVarChar, 1, -1 addField reviews,"revRating", adInteger, -1, -1 addField reviews,"revName", adVarChar, 255,-1 addField reviews,"revLocation", adVarChar, 255,-1 addField reviews,"revEmail", adVarChar, 100,-1 addField reviews,"revSubj", adVarChar, 100,-1 addField reviews,"revDetail", adLongVarChar, -1, -1 checkTable reviews, "reviews" 'Check newsletters dim newsletters(100,3) i = 0 addField newsletters,"idNews", adInteger, -2, -1 addField newsletters,"newsDate", adDBTimeStamp, -1, -1 addField newsletters,"newsDateInt", adVarChar, 25, -1 addField newsletters,"newsBookmark", adVarChar, 255,-1 addField newsletters,"newsSubj", adVarChar, 255,-1 addField newsletters,"newsBody", adLongVarChar, -1, -1 checkTable newsletters, "newsletters" 'Check customer dim customer(100,3) i = 0 addField customer,"idCust", adInteger, -2, -1 addField customer,"status", adVarChar, 1, -1 addField customer,"dateCreated", adDBTimeStamp, -1, -1 addField customer,"dateCreatedInt", adVarChar, 25, -1 addField customer,"name", adVarChar, 100,-1 addField customer,"lastName", adVarChar, 100,-1 addField customer,"customerCompany", adVarChar, 100,-1 addField customer,"phone", adVarChar, 30, -1 addField customer,"email", adVarChar, 100,-1 addField customer,"password", adVarChar, 80, -1 addField customer,"address", adVarChar, 100,-1 addField customer,"city", adVarChar, 100,-1 addField customer,"locState", adVarChar, 2, -1 addField customer,"locState2", adVarChar, 100,-1 addField customer,"locCountry", adVarChar, 2, -1 addField customer,"zip", adVarChar, 20, -1 addField customer,"paymentType", adVarChar, 50, -1 addField customer,"shippingName", adVarChar, 100,-1 addField customer,"shippingLastName", adVarChar, 100,-1 addField customer,"shippingAddress", adVarChar, 100,-1 addField customer,"shippingCity", adVarChar, 100,-1 addField customer,"shippingLocState", adVarChar, 2, -1 addField customer,"shippingLocState2", adVarChar, 100,-1 addField customer,"shippingLocCountry", adVarChar, 2, -1 addField customer,"shippingZip", adVarChar, 20, -1 addField customer,"futureMail", adVarChar, 1, -1 addField customer,"generalComments", adLongVarChar, -1, -1 addField customer,"taxExempt", adVarChar, 1, "N" addField customer,"shippingPhone", adVarChar, 30, -1 addField customer,"affiliate", adVarChar, 1, "N" addField customer,"commPerc", adDouble, -1, -1 checkTable customer, "customer" 'Check Products dim products(100,3) i = 0 addField products,"idProduct", adInteger, -2, -1 addField products,"description", adVarChar, 250,-1 addField products,"descriptionLong", adVarChar, 250,-1 addField products,"details", adLongVarChar, -1, -1 addField products,"relatedKeys", adVarChar, 250,-1 addField products,"price", adDouble, -1, -1 addField products,"listPrice", adDouble, -1, -1 addField products,"imageUrl", adVarChar, 50, -1 addField products,"smallImageUrl", adVarChar, 50, -1 addField products,"sku", adVarChar, 30, -1 addField products,"stock", adInteger, -1, -1 addField products,"weight", adDouble, -1, -1 addField products,"active", adInteger, -1, -1 addField products,"hotDeal", adInteger, -1, -1 addField products,"homepage", adInteger, -1, -1 addField products,"fileName", adVarChar, 250,-1 addField products,"noShipCharge", adVarChar, 1, -1 addField products,"taxExempt", adVarChar, 1, "N" addField products,"reviewAllow", adVarChar, 1, "N" addField products,"reviewAutoActive", adVarChar, 1, "N" addField products,"sortOrder", adInteger, -1, -1 checkTable products, "products" 'Check productGroups dim productGroups(100,3) i = 0 addField productGroups,"idProdGroup", adInteger, -2, -1 addField productGroups,"prodGroupP", adInteger, -1, -1 addField productGroups,"prodGroupC", adInteger, -1, -1 checkTable productGroups, "productGroups" 'Check CartHead dim carthead(100,3) i = 0 addField carthead,"idOrder", adInteger, -2, -1 addField carthead,"idCust", adInteger, -1, -1 addField carthead,"orderDate", adDBTimeStamp, -1, -1 addField carthead,"orderDateInt", adVarChar, 25, -1 addField carthead,"randomKey", adVarChar, 50, -1 addField carthead,"subTotal", adDouble, -1, -1 addField carthead,"taxTotal", adDouble, -1, -1 addField carthead,"shipmentTotal", adDouble, -1, -1 addField carthead,"Total", adDouble, -1, -1 addField carthead,"shipmentMethod", adVarChar, 100,-1 addField carthead,"name", adVarChar, 100,-1 addField carthead,"lastName", adVarChar, 100,-1 addField carthead,"customerCompany", adVarChar, 100,-1 addField carthead,"phone", adVarChar, 30, -1 addField carthead,"email", adVarChar, 100,-1 addField carthead,"address", adVarChar, 100,-1 addField carthead,"city", adVarChar, 100,-1 addField carthead,"locState", adVarChar, 100,-1 addField carthead,"locCountry", adVarChar, 100,-1 addField carthead,"zip", adVarChar, 20, -1 addField carthead,"shippingName", adVarChar, 100,-1 addField carthead,"shippingLastName", adVarChar, 100,-1 addField carthead,"shippingAddress", adVarChar, 100,-1 addField carthead,"shippingCity", adVarChar, 100,-1 addField carthead,"shippingLocState", adVarChar, 100,-1 addField carthead,"shippingLocCountry", adVarChar, 100,-1 addField carthead,"shippingZip", adVarChar, 20, -1 addField carthead,"paymentType", adVarChar, 50, -1 addField carthead,"cardType", adVarChar, 50, -1 addField carthead,"cardNumber", adVarChar, 50, -1 addField carthead,"cardExpMonth", adVarChar, 2, -1 addField carthead,"cardExpYear", adVarChar, 4, -1 addField carthead,"cardVerify", adVarChar, 4, -1 addField carthead,"cardName", adVarChar, 100,-1 addField carthead,"generalComments", adVarChar, 255,-1 addField carthead,"orderStatus", adVarChar, 1, -1 addField carthead,"auditInfo", adVarChar, 255,-1 addField carthead,"storeComments", adLongVarChar, -1, -1 addField carthead,"storeCommentsPriv", adLongVarChar, -1, -1 addField carthead,"adjustAmount", adDouble, -1, -1 addField carthead,"adjustReason", adVarChar, 255,-1 addField carthead,"taxExempt", adVarChar, 1, "N" addField carthead,"discCode", adVarChar, 20, -1 addField carthead,"discPerc", adDouble, -1, -1 addField carthead,"discTotal", adDouble, -1, -1 addField carthead,"shippingPhone", adVarChar, 30, -1 addField carthead,"handlingFeeTotal", adDouble, -1, 0 addField carthead,"idAffiliate", adInteger, -1, -1 addField carthead,"commPerc", adDouble, -1, -1 addField carthead,"otherFeeTotal", adDouble, -1, 0 checkTable carthead, "carthead" 'Check CartRows dim cartrows(100,3) i = 0 addField cartrows,"idCartRow", adInteger, -2, -1 addField cartrows,"idOrder", adInteger, -1, -1 addField cartrows,"idProduct", adInteger, -1, -1 addField cartrows,"sku", adVarChar, 30, -1 addField cartrows,"quantity", adInteger, -1, -1 addField cartrows,"unitPrice", adDouble, -1, -1 addField cartrows,"unitWeight", adDouble, -1, -1 addField cartrows,"description", adVarChar, 250,-1 addField cartrows,"downloadCount", adInteger, -1, -1 addField cartrows,"downloadDate", adVarChar, 25, -1 addField cartrows,"taxExempt", adVarChar, 1, "N" addField cartrows,"idDiscProd", adInteger, -1, -1 addField cartrows,"discAmt", adDouble, -1, -1 checkTable cartrows, "cartrows" 'Check CartRowsOptions dim CartRowsOptions(100,3) i = 0 addField CartRowsOptions,"idCartRowOption", adInteger, -2, -1 addField CartRowsOptions,"idOrder", adInteger, -1, -1 addField CartRowsOptions,"idCartRow", adInteger, -1, -1 addField CartRowsOptions,"idOption", adInteger, -1, -1 addField CartRowsOptions,"optionPrice", adDouble, -1, -1 addField CartRowsOptions,"optionWeight", adDouble, -1, -1 addField CartRowsOptions,"optionDescrip", adVarChar, 255,-1 addField CartRowsOptions,"taxExempt", adVarChar, 1, "N" checkTable CartRowsOptions, "CartRowsOptions" 'Check Categories dim Categories(100,3) i = 0 addField Categories,"idCategory", adInteger, -2, -1 addField Categories,"categoryDesc", adVarChar, 50, -1 addField Categories,"idParentCategory", adInteger, -1, -1 addField Categories,"categoryFeatured", adVarChar, 1, "N" addField Categories,"categoryHTML", adVarChar, 255,-1 addField Categories,"sortOrder", adInteger, -1, -1 addField Categories,"categoryHTMLLong", adLongVarChar, -1, -1 checkTable Categories, "Categories" 'Check Categories_Products dim Categories_Products(100,3) i = 0 addField Categories_Products,"idCatProd", adInteger, -2, -1 addField Categories_Products,"idProduct", adInteger, -1, -1 addField Categories_Products,"idCategory", adInteger, -1, -1 checkTable Categories_Products, "Categories_Products" 'Check Locations dim Locations(100,3) i = 0 addField Locations,"idLocation", adInteger, -2, -1 addField Locations,"locName", adVarChar, 100,-1 addField Locations,"locCountry", adVarChar, 2, -1 addField Locations,"locState", adVarChar, 2, -1 addField Locations,"locTax", adDouble, -1, -1 addField Locations,"locShipZone", adInteger, -1, -1 addField Locations,"locStatus", adVarChar, 1, "A" checkTable Locations, "Locations" 'Check OptionsProdEx dim OptionsProdEx(100,3) i = 0 addField OptionsProdEx,"idOptionsProdEx", adInteger, -2, -1 addField OptionsProdEx,"idOption", adInteger, -1, -1 addField OptionsProdEx,"idProduct", adInteger, -1, -1 checkTable OptionsProdEx, "OptionsProdEx" 'Check Options dim Options(100,3) i = 0 addField Options,"idOption", adInteger, -2, -1 addField Options,"optionDescrip", adVarChar, 50, -1 addField Options,"priceToAdd", adDouble, -1, -1 addField Options,"weightToAdd", adDouble, -1, -1 addField Options,"taxExempt", adVarChar, 1, "N" addField Options,"percToAdd", adDouble, -1, 0 addField Options,"sortOrder", adInteger, -1, -1 checkTable Options, "Options" 'Check optionsXref dim optionsXref(100,3) i = 0 addField optionsXref,"idOptOptGroup", adInteger, -2, -1 addField optionsXref,"idOptionGroup", adInteger, -1, -1 addField optionsXref,"idOption", adInteger, -1, -1 checkTable optionsXref, "optionsXref" 'Check OptionsGroups dim OptionsGroups(100,3) i = 0 addField OptionsGroups,"idOptionGroup", adInteger, -2, -1 addField OptionsGroups,"optionGroupDesc", adVarChar, 50, -1 addField OptionsGroups,"optionReq", adVarChar, 1, -1 addField OptionsGroups,"optionType", adVarChar, 1, "S" addField OptionsGroups,"sortOrder", adInteger, -1, -1 addField OptionsGroups,"optionLength", adInteger, -1, 200 checkTable OptionsGroups, "OptionsGroups" 'Check optionsGroupsXref dim optionsGroupsXref(100,3) i = 0 addField optionsGroupsXref,"idOptGrpProd", adInteger, -2, -1 addField optionsGroupsXref,"idProduct", adInteger, -1, -1 addField optionsGroupsXref,"idOptionGroup", adInteger, -1, -1 checkTable optionsGroupsXref, "optionsGroupsXref" 'Check ShipMethod dim ShipMethod(100,3) i = 0 addField ShipMethod,"idShipMethod", adInteger, -2, -1 addField ShipMethod,"shipDesc", adVarChar, 100,-1 addField ShipMethod,"status", adVarChar, 1, -1 checkTable ShipMethod, "ShipMethod" 'Check ShipRates dim ShipRates(100,3) i = 0 addField ShipRates,"idShip", adInteger, -2, -1 addField ShipRates,"locShipZone", adInteger, -1, -1 addField ShipRates,"idShipMethod", adInteger, -1, -1 addField ShipRates,"unitType", adVarChar, 1, -1 addField ShipRates,"unitsFrom", adDouble, -1, -1 addField ShipRates,"unitsTo", adDouble, -1, -1 addField ShipRates,"addAmt", adDouble, -1, -1 addField ShipRates,"addPerc", adDouble, -1, -1 checkTable ShipRates, "ShipRates" 'Check DiscOrder dim DiscOrder(100,3) i = 0 addField DiscOrder,"idDiscOrder", adInteger, -2, -1 addField DiscOrder,"discCode", adVarChar, 20, -1 addField DiscOrder,"discPerc", adDouble, -1, -1 addField DiscOrder,"discFromAmt", adDouble, -1, -1 addField DiscOrder,"discToAmt", adDouble, -1, -1 addField DiscOrder,"discStatus", adVarChar, 1, -1 addField DiscOrder,"discOnceOnly", adVarChar, 1, -1 addField DiscOrder,"discValidFrom", adVarChar, 25, -1 addField DiscOrder,"discValidTo", adVarChar, 25, -1 addField DiscOrder,"discAmt", adDouble, -1, -1 checkTable DiscOrder, "DiscOrder" 'Check DiscProd dim DiscProd(100,3) i = 0 addField DiscProd,"idDiscProd", adInteger, -2, -1 addField DiscProd,"discAmt", adDouble, -1, -1 addField DiscProd,"discFromQty", adDouble, -1, -1 addField DiscProd,"discToQty", adDouble, -1, -1 addField DiscProd,"idProduct", adInteger, -1, -1 addField DiscProd,"discPerc", adDouble, -1, -1 checkTable DiscProd, "DiscProd" '************************************************************************* 'END : Table Validations '************************************************************************* %> |
|
<%
if errorCount > 0 then
%>
<%=errorCount%> error(s) were found! <% if len(trim(fixSQL)) > 0 then %> NOTE : To fix your database, you will need to run the repair script below by clicking on the "Run Fix Now" button. The database will automatically be re-tested after all the fixes have been applied. If errors persist, then fixes will have to be applied manually.
<% else %> NOTE : Please correct the indicated errors manually. If you are unsure what the field definitions should be (ie. length, type, etc.), refer to the example MS Access database that came with this package. ALWAYS re-run this test after you have made your changes to make sure that the changes were applied correctly. <% end if else %> Congratulations! No errors were found. <% end if 'Close Database call closedb() %> |
" & tableArray(i,0) & ""
case 1
errorCount = errorCount + 1
Response.Write "
" & tableArray(i,0) & "" & " - "
Response.Write "Field not found."
result = createFieldSQL(tableArray(i,0),tableArray(i,1),tableArray(i,2),tableArray(i,3),tableName)
case 2
errorCount = errorCount + 1
Response.Write "
" & tableArray(i,0) & "" & " - "
Response.Write "Field Type Invalid."
result = modifyFieldSQL(tableArray(i,0),tableArray(i,1),tableArray(i,2),tableArray(i,3),tableName)
case 3
errorCount = errorCount + 1
Response.Write "
" & tableArray(i,0) & "" & " - "
Response.Write "Field Length Invalid."
result = modifyFieldSQL(tableArray(i,0),tableArray(i,1),tableArray(i,2),tableArray(i,3),tableName)
case 4
errorCount = errorCount + 1
Response.Write "
" & tableArray(i,0) & "" & " - "
Response.Write "Field should be AutoNumber/Increment."
case else
response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Unknown Field Match Type returned. Script could not continue.")
end select
Response.Write "
" & field.name & "" & " - "
Response.Write "Field is not Required."
Response.Write "