Bill Wilkinson - "SQL Type number "mediumint" is n

Results 1 to 3 of 3

Thread: Bill Wilkinson - "SQL Type number "mediumint" is n

  1. #1
    Mark Guest

    Default Bill Wilkinson - "SQL Type number "mediumint" is n

    You kindly wrote....<BR>JUST AS A GUESS... I&#039;d bet that Ultradev thinks there ought to be three sizes of integer (whether 8, 16, and 32 bit or 16, 32, and 64, I dunno). And MySQL only supports two sizes (probably 16 and 32). Probably, some of the SQL being generated relies on using a type of "mediumint" (though I can&#039;t imagine why...maybe it tries to do a "cast" to that type?). So find where that is happening and just use "int" or "integer" (whichever MySQL supports) instead.<BR><BR>When you use a tool like Ultradev, you are losing a lot of control, so it&#039;s often hard to customize it for a particular configuration.<BR><BR>********<BR>The trouble is I&#039;m a complete newbie to this asp/sql & I have to use Ultradev as I&#039;m incapable of any hand coding :-) :-) :-) I&#039;ve posted the code below for you to take a look at if you could, as I simply havn&#039;t a clue what to look for here. Thanks in advance<BR><BR>%@LANGUAGE="VBSCRIPT"%&#062;<BR>&#0 60;!--#include file="Connections/conninkbase.asp" --&#062;<BR>&#060;%<BR>&#039; *** Edit Operations: declare variables<BR><BR>MM_editAction = CStr(Request("URL"))<BR>If (Request.QueryString &#060;&#062; "") Then<BR> MM_editAction = MM_editAction & "?" & Request.QueryString<BR>End If<BR><BR>&#039; boolean to abort record edit<BR>MM_abortEdit = false<BR><BR>&#039; query string to execute<BR>MM_editQuery = ""<BR>%&#062;<BR>&#060;%<BR>&#039; *** Update Record: set variables<BR><BR>If (CStr(Request("MM_update")) &#060;&#062; "" And CStr(Request("MM_recordId")) &#060;&#062; "") Then<BR><BR> MM_editConnection = MM_conninkbase_STRING<BR> MM_editTable = "orders"<BR> MM_editColumn = "OrderID"<BR> MM_recordId = "" + Request.Form("MM_recordId") + ""<BR> MM_editRedirectUrl = ""<BR> MM_fieldsStr = "ConfirmOrder&#124value&#124SalesTax&#124value&#12 4GrandTotal&#124value&#124shipping&#124value"<BR> MM_columnsStr = "Confirmed&#124none,none,NULL&#124SalesTax&#124non e,none,NULL&#124GrandTotal&#124none,none,NULL&#124 Shipping&#124none,none,NULL"<BR><BR> &#039; create the MM_fields and MM_columns arrays<BR> MM_fields = Split(MM_fieldsStr, "&#124")<BR> MM_columns = Split(MM_columnsStr, "&#124")<BR> <BR> &#039; set the form values<BR> For i = LBound(MM_fields) To UBound(MM_fields) Step 2<BR> MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))<BR> Next<BR><BR> &#039; append the query string to the redirect URL<BR> If (MM_editRedirectUrl &#060;&#062; "" And Request.QueryString &#060;&#062; "") Then<BR> If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString &#060;&#062; "") Then<BR> MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString<BR> Else<BR> MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString<BR> End If<BR> End If<BR><BR>End If<BR>%&#062;<BR>&#060;%<BR>&#039; *** Update Record: construct a sql update statement and execute it<BR><BR>If (CStr(Request("MM_update")) &#060;&#062; "" And CStr(Request("MM_recordId")) &#060;&#062; "") Then<BR><BR> &#039; create the sql update statement<BR> MM_editQuery = "update " & MM_editTable & " set "<BR> For i = LBound(MM_fields) To UBound(MM_fields) Step 2<BR> FormVal = MM_fields(i+1)<BR> MM_typeArray = Split(MM_columns(i+1),",")<BR> Delim = MM_typeArray(0)<BR> If (Delim = "none") Then Delim = ""<BR> AltVal = MM_typeArray(1)<BR> If (AltVal = "none") Then AltVal = ""<BR> EmptyVal = MM_typeArray(2)<BR> If (EmptyVal = "none") Then EmptyVal = ""<BR> If (FormVal = "") Then<BR> FormVal = EmptyVal<BR> Else<BR> If (AltVal &#060;&#062; "") Then<BR> FormVal = AltVal<BR> ElseIf (Delim = "&#039;") Then &#039; escape quotes<BR> FormVal = "&#039;" & Replace(FormVal,"&#039;","&#039;&#039;") & "&#039;"<BR> Else<BR> FormVal = Delim + FormVal + Delim<BR> End If<BR> End If<BR> If (i &#060;&#062; LBound(MM_fields)) Then<BR> MM_editQuery = MM_editQuery & ","<BR> End If<BR> MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal<BR> Next<BR> MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId<BR><BR> If (Not MM_abortEdit) Then<BR> &#039; execute the update<BR> Set MM_editCmd = Server.CreateObject("ADODB.Command")<BR> MM_editCmd.ActiveConnection = MM_editConnection<BR> MM_editCmd.CommandText = MM_editQuery<BR> MM_editCmd.Execute<BR> MM_editCmd.ActiveConnection.Close<BR><BR> If (MM_editRedirectUrl &#060;&#062; "") Then<BR> Response.Redirect(MM_editRedirectUrl)<BR> End If<BR> End If<BR><BR>End If<BR>%&#062;<BR>&#060;SCRIPT LANGUAGE=JavaScript RUNAT=Server NAME="UC_CART"&#062;<BR>//<BR>// UltraDev UCart include file Version 1.0<BR>//<BR>function UC_ShoppingCart(Name, cookieLifetime, colNames, colComputed) // Cart constructor<BR>{<BR> // Name is the name of this cart. This is not really used in this implementation.<BR> // cookieLifeTime is in days. A value of 0 means do not use cookies.<BR> // colNames is a list of column names (must contain: ProductID, Quantity, Price, Total)<BR> // colComputed is a list of computed columns (zero length string means don&#039;t compute col.)<BR><BR> // Public methods or UC_Cart API<BR> this.AddItem = UCaddItem; // Add an item to the cart<BR> this.GetColumnValue = GetColumnValue; // Get a value from the cart<BR> this.Destroy = UCDestroy; // remove all items, delete session, delete client cookie (if any)<BR> this.SaveToDatabase = SaveToDatabase; // persist cart to database.<BR> this.GetItemCount = GetItemCount; // the number of items in the cart.<BR> this.Update = Update; // Update the cart quantities.<BR> this.GetColumnTotal = GetColumnTotal; // Get the sum of a cart column for all items (e.g. price or shipping wt.).<BR> this.GetContentsSerial = UCGetContentsSerial// Get the contents of the cart as a single delimited string<BR> this.SetContentsSerial = UCSetContentsSerial// Set the contents of the cart from a serial string (obtained from GetContentsSerial)<BR> this.GetColNamesSerial = UCGetColNamesSerial// Get the list of column names as a delimited string.<BR> <BR> // PROPERTIES<BR> this.SC = null; // Cart data array<BR> this.numCols = colNames.length;<BR> this.colComputed = colComputed;<BR> this.colNames = colNames;<BR> this.Name = Name;<BR> this.cookieLifetime = cookieLifetime;<BR> this.bStoreCookie = (cookieLifetime != 0);<BR><BR> // *CONVENIENCE* PROPERTIES<BR> // (not used internally, but added to provide a place to store this data)<BR> this.CustomerID = null;<BR> this.OrderID = null;<BR> this.Tax = null;<BR> this.ShippingCost = null;<BR><BR> // CONSTANTS<BR> this.PRODUCTID = "ProductID"; // Required SKU cart column<BR> this.QUANTITY = "Quantity"; // Required Quantity cart column<BR> this.PRICE = "Price"; // Required Price cart column<BR> this.TOTAL = "Total"; // Required Total column<BR> this.cookieColDel = "#UC_C#"<BR> this.cookieRowDel = "#UC_R#"<BR><BR> // METHODS<BR> this.AssertCartValid = AssertCartValid<BR><BR> // Private methods - don&#039;t call these unless you understand the internals.<BR> this.GetIndexOfColName = UCgetIndexOfColName;<BR> this.GetDataFromBindings = UCgetDataFromBindings;<BR> this.FindItem = UCfindItem;<BR> this.ComputeItemTotals = ComputeItemTotals;<BR> this.persist = UCpersist;<BR> <BR> this.BuildInsertColumnList = BuildInsertColumnList;<BR> this.BuildInsertValueList = BuildInsertValueList;<BR> this.UpdateQuantities = UpdateQuantities;<BR> this.UpdateTotals = UpdateTotals;<BR> this.DeleteItemsWithNoQuantity = DeleteItemsWithNoQuantity;<BR> this.CheckAddItemConfig = CheckAddItemConfig;<BR> this.ColumnExistsInRS = ColumnExistsInRS;<BR> this.DeleteLineItem = DeleteLineItem;<BR> this.GetCookieName = GetCookieName;<BR> this.SetCookie = SetCookie;<BR> this.PopulateFromCookie = PopulateFromCookie;<BR> this.DestroyCookie = UCDestroyCookie;<BR><BR>// Cart "internals" documentation:<BR>// The this.SC datastructure is a single variable of type array.<BR>// Each array element corresponds to a cart column. For example: <BR>// Array element 1: ProductID<BR>// Array element 2: Quantity<BR>// Array element 3: Price<BR>// Array elemetn 4: Total<BR>//<BR>// Each of these is an array. Each array index corresponds to a line item.<BR>// As such, each array should always be exactly the same length.<BR> this.AssertCartValid(colNames, "Cart Initialization: ");<BR> if (Session(this.Name) != null) {<BR> this.SC = Session(this.Name).SC;<BR> } else {<BR> this.SC = new Array(this.numCols);<BR> for (var i = 0; i &#060; this.numCols; i++) this.SC[i] = new Array();<BR><BR> // Since the cart doesn&#039;t exist in session, check for cookie from previous session<BR> if (this.bStoreCookie){<BR> cookieName = this.GetCookieName();<BR> cookieStr = Request.Cookies(cookieName);<BR> if (cookieStr != null && String(cookieStr) != "undefined" && cookieStr != "")<BR> this.PopulateFromCookie(cookieStr);<BR> }<BR> // Create a reference in the Session, pass the whole object (methods are not copied)<BR> this.persist();<BR> } <BR>}<BR><BR>// convert vb style arrays to js style arrays.<BR>function UC_VbToJsArray(a) {<BR> if (a!=null && a.length==null) {<BR> a = new VBArray(a);<BR> a = a.toArray();<BR> }<BR> return a;<BR>}<BR><BR>function UCpersist() {<BR> Session(this.Name) = this;<BR> if (this.bStoreCookie) this.SetCookie();<BR>}<BR><BR>function UCDestroy(){<BR> this.SC = new Array(this.numCols); // empty the "in-memory" cart.<BR> for (var i = 0; i &#060; this.numCols; i++) this.SC[i] = new Array();<BR> this.persist();<BR> if (this.bStoreCookie) this.DestroyCookie() // remove the cookie<BR>}<BR><BR>function UCgetDataFromBindings(adoRS, bindingTypes, bindingValues) {<BR> var values = new Array(bindingTypes.length)<BR> for (i=0; i&#060;bindingTypes.length; i++) {<BR> var bindVal = bindingValues[i];<BR> if (bindingTypes[i] == "RS"){<BR> values[i] = String(adoRS(bindVal).Value)<BR> if (values[i] == "undefined") values[i] = "";<BR> }<BR> else if (bindingTypes[i] == "FORM"){<BR> values[i] = String(Request(bindVal))<BR> if (values[i] == "undefined") values[i] = "";<BR> } <BR> else if (bindingTypes[i] == "LITERAL") values[i] = bindVal;<BR> else if (bindingTypes[i] == "NONE") values[i] = ""; // no binding<BR> else assert(false,"Unrecognized binding type: " + bindingTypes[i]); // Unrecognized binding type<BR> }<BR> return values;<BR>}<BR><BR>function UCfindItem(bindingTypes, values){<BR> // A product is a duplicate if it has the same unique ID<BR> // AND all values from form bindings (except quantity) are the same<BR> var indexProductID = this.GetIndexOfColName(this.PRODUCTID);<BR> var indexQuantity = this.GetIndexOfColName(this.QUANTITY);<BR> assert(indexProductID &#062;=0, "UC_Cart.js: Internal error 143");<BR> assert(indexQuantity &#062;=0, "UC_Cart.js: Internal error 144");<BR> var newRow = -1<BR> for (var iRow=0; iRow&#060;this.GetItemCount(); iRow++) {<BR> found = true; // assume found<BR> for (var iCol=0; iCol&#060;this.numCols; iCol++) {<BR> if (iCol != indexQuantity) {<BR> if ((iCol==indexProductID) &#124&#124 (bindingTypes[iCol]=="FORM")) {<BR> if (this.SC[iCol][iRow] != values[iCol]) {<BR> found = false;<BR> break;<BR> } }<BR> } }<BR> if (found) {<BR> newRow = iRow;<BR> break;<BR> }<BR> }<BR> return newRow<BR>}<BR><BR>function UCaddItem(adoRS, bindingTypes, bindingValues, alreadyInCart){<BR> // alreadyInCart can be "increment" or "replace" to handle duplicate items in cart.<BR> bindingTypes = UC_VbToJsArray(bindingTypes);<BR> bindingValues = UC_VbToJsArray(bindingValues);<BR><BR> // Check that length of binding types/values arrays is consistent with cart configuration<BR> assert(bindingTypes.length == this.numCols, "UCaddItem: Array length mismatch (internal error 403)");<BR> assert(bindingValues.length == this.numCols, "UCaddItem: Array length mismatch (internal error 404)");<BR><BR> // debug call<BR> //this.CheckAddItemConfig(adoRS, bindingTypes, bindingValues);<BR><BR> var values = this.GetDataFromBindings(adoRS, bindingTypes, bindingValues) // get the actual values based on bindings<BR> var newRow = this.FindItem(bindingTypes, values); // Check if this item is already in cart<BR> if (newRow == -1) { // append a new item<BR> newRow = this.GetItemCount(); <BR> for (var iCol=0; iCol&#060;this.numCols; iCol++) { // add data<BR> this.SC[iCol][newRow] = values[iCol];<BR> }<BR> this.ComputeItemTotals(newRow); // add computed columns (defined in colsComputed) <BR> this.persist();<BR> } else if (alreadyInCart == "increment") {<BR> var indexQuantity = this.GetIndexOfColName(this.QUANTITY);<BR> this.SC[indexQuantity][newRow] = parseInt(this.SC[indexQuantity][newRow]) + parseInt(values[indexQuantity])<BR> if (isNaN(this.SC[indexQuantity][newRow])) this.SC[indexQuantity][newRow] = 1;<BR> this.ComputeItemTotals(newRow);<BR> this.persist();<BR> }<BR>}<BR><BR>function UCgetIndexOfColName(colName) {<BR> var retIndex = -1;<BR> for (var i=0; i&#060;this.numCols; i++) {<BR> if (this.colNames[i] == colName) {<BR> retIndex = i;<BR> break;<BR> } <BR> }<BR> return retIndex;<BR>}<BR><BR>function ComputeItemTotals(row){<BR> var indexQuantity = this.GetIndexOfColName(this.QUANTITY);<BR> var qty = parseInt(this.SC[indexQuantity][row])<BR> for (var iCol=0; iCol&#060;this.numCols; iCol++) {<BR> var colToCompute = this.colComputed[iCol];<BR> if (colToCompute != "") {<BR> indexColToCompute = this.GetIndexOfColName(colToCompute);<BR> this.SC[iCol][row] = parseFloat(this.SC[indexColToCompute][row]) * qty;<BR> }<BR> }<BR>}<BR><BR>function CheckAddItemConfig(adoRS, bindingTypes, bindingValues) {<BR> var ERR_SOURCE = "CheckAddItemConfig: "<BR> var ERR_RS_BINDING_VALUE = "Column for Recordset binding does not exist in recordset";<BR> // Check that all rs column names exist for rs binding types<BR> for (var i = 0; i &#060; bindingTypes.length; i++) {<BR> if (bindingTypes[i] == "RS"){<BR> assert(this.ColumnExistsInRS(adoRS, bindingValues[i]), ERR_SOURCE + bindingValues[i] + ": " + ERR_RS_BINDING_VALUE); <BR> }<BR> } <BR>}<BR><BR>function ColumnExistsInRS(adoRS, colName) {<BR> var bColExists = false;<BR> var items = new Enumerator(adoRS.Fields);<BR> while (!items.atEnd()) {<BR> if (items.item().Name == colName){<BR> bColExists = true;<BR> break;<BR> }<BR> items.moveNext();<BR> }<BR> return bColExists;<BR>}<BR><BR>function GetColumnValue(colName, row){<BR> var retValue = "&nbsp;";<BR> var indexCol = this.GetIndexOfColName(colName);<BR> assert(!isNaN(row), "cart.GetColumnValue: row is not a number - row = " + row);<BR> assert(indexCol &#062;=0, "cart.GetColumnValue: Could not find column \"" + colName + "\" in the cart");<BR> assert(row&#062;=0, "cart.GetColumnValue: Bad row number input to cart - row = " + row);<BR> assert(this.GetItemCount()&#062;0, "cart.GetColumnValue: The cart is empty - the requested data is unavailable");<BR> assert(row&#060;this.GetItemCount(), "cart.GetColumnValue: The line item number is greater than the number of items in the cart - row = " + row + "; GetItemCount = " + this.GetItemCount());<BR> if (this.GetItemCount()&#062;0) {<BR> retValue = this.SC[indexCol][row];<BR> }<BR> return retValue;<BR>}<BR><BR>function UpdateQuantities(formElementName) {<BR> var items = new Enumerator(Request.Form(formElementName))<BR> var j = 0;<BR> indexQuantity = this.GetIndexOfColName(this.QUANTITY);<BR> while(!items.atEnd()){<BR> var qty = parseInt(items.item());<BR> if (isNaN(qty) &#124&#124 qty &#060; 0) {<BR> this.SC[indexQuantity][j++] = 0<BR> } else {<BR> this.SC[indexQuantity][j++] = qty;<BR> }<BR> items.moveNext();<BR> }<BR>}<BR><BR>function UpdateTotals() {<BR> // this would be a little more efficient by making the outer loop over cols rather than rows.<BR> for (var iRow=0; iRow&#060;this.GetItemCount(); iRow++) {<BR> this.ComputeItemTotals(iRow);<BR> }<BR>}<BR><BR>function DeleteItemsWithNoQuantity() {<BR> var tmpSC= new Array(this.numCols);<BR> for (var iCol=0; iCol&#060;this.numCols; iCol++) tmpSC[iCol] = new Array();<BR><BR> var indexQuantity = this.GetIndexOfColName(this.QUAN

  2. #2
    Join Date
    Dec 1969

    Default Stay with original thread...

    There was no need to start a new thread. If you&#039;d replied in the original thread, it would have been moved to "today" and I would have seen it. Don&#039;t litter the msg board(s) with extra threads.<BR><BR>Anyway....<BR><BR>That is *WAY* too much code for ANYBODY to try to wade through looking for the needle in the haystack. Especially when you don&#039;t show *WHICH* line is causing the problem and don&#039;t post the *exact* error message that you are getting.<BR><BR>

  3. #3
    Mark Guest

    Default RE: Stay with original thread...

    Sorry about starting a new thread, I&#039;m new to this forum. Re my problem, I dont get an error on this when it&#039;s live on the web, the server just hangs at the previous page & it has even crashed the asp server.<BR>I see the warning/error when I double click the "add cart to table" behaviour in Ultra dev its a dialouge box warning me that "SQL Type number "mediumint" is not in map". I posted all the code just in case you might know exactly what it was that would cause this sort of thing. But I do realise it&#039;s like looking for the needle in a haystack. Anyway thanks for taking the time to reply. & I&#039;ll stick to the same thread in future. All the best Mark<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts