acr_1984_i - SQL error

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

acr_1984_i - SQL error

Post by AcadiusLost »

We're getting occational SQL errors from the ACR_GetHasIllegalProperties() function. It's an SQL syntax error involving the "IsIllegal=1")" part.

Have an easy fix for this one, that we can slip in before release, Cipher?

Code: Select all

    // check if any of the item properties are illegal
    if (sProperties != "" )
	{
		ACR_SQLQuery("SELECT ID FROM item_properties WHERE ItemProperty in (" + sProperties + ") and IsIllegal=1");
	    return ACR_SQLFetch();
	}
Out of curiosity, the item_properties table is currently empty- should it be filled with properties that are marked as to their legality for this function to work properly?
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Looking at my SQL logs, here's the statement that's being generated:
  • * Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,11) and IsIllegal=1"
The problem is that the properties list isn't being generated properly. There's a comma before the first number in the list. That's not proper syntax. So, the root cause is something in the while loop above the actual SQL call that iterates through the properties of an item.

The question is, what property is returning a null value?
  • while (GetIsItemPropertyValid(ipProperty))
    {
    • // construct the property type list
      sProperties = comma + IntToString(GetItemPropertyType(ipProperty));

      // get the next property on the item
      ipProperty = GetNextItemProperty(oItem); comma = ",";
    }
Is it a custom item property that we've added through HAKs? I'll have to poke around and test it tonight.
Locked