sqlite question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ButtonMaker
    Forum Member
    • Mar 2007
    • 172

    sqlite question

    i have a db file and i am using it in my project the problem is when there is no data in it it blocks loading "x" but if i add a data then it doesnt block loading "x" why is that ?
  • ButtonMaker
    Forum Member
    • Mar 2007
    • 172

    #2
    here is the example... i only add one word to it "test" and it works perfect like that, u dont get blocked message but if u delete the word "test" then u will get blocked message with "xxx" aswell... can someone help please ?
    Last edited by ButtonMaker; 03-06-2009, 10:45 AM.

    Comment

    • Dermot
      Indigo Rose Customer
      • Apr 2004
      • 1790

      #3
      Works fine for me. If there are no words on the list, I can type anything I want. If I add a word to the list and try typing it, it tells me it is blocked.
      Dermot

      I am so out of here :yes

      Comment

      • ButtonMaker
        Forum Member
        • Mar 2007
        • 172

        #4
        no delete the data and restart the app

        Comment

        • Dermot
          Indigo Rose Customer
          • Apr 2004
          • 1790

          #5
          Your CheckKeyWord function is badly written though. There is no need to return all entries and then search for a match. Let SQLite do the searching for you.

          Code:
          function CheckKeyWord(strSite)
          	--Select all entries found in the KeyWord table
          	local tSites = SQLite.QueryToTable(db,"SELECT * FROM KeyWord WHERE Title = '"..strSite.."'");
          	--Do the following if there are entries returned
          	if tSites and tSites.Rows > 0 then
          		return true
          	else
          		return false
          	end
          end
          Then chnage your Go button code to this.
          Code:
          local strText = Input.GetText("Input1");
          if strText ~= "" then
          	local fMatch = CheckKeyWord(strText)
          	if fMatch  then
          		Dialog.Message("Notice", "This word is blocked.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
          	else
          		Label.SetText("Label1", strText);
          	end
          end
          Dermot

          I am so out of here :yes

          Comment

          • ButtonMaker
            Forum Member
            • Mar 2007
            • 172

            #6
            hey DERMOT thanks alot :yes

            that works great :yes:yes

            Comment

            • ButtonMaker
              Forum Member
              • Mar 2007
              • 172

              #7
              there is a small problem with it;
              when i type "xxx" it blocks but if i type "xxx1" or "xxx" with anything it doesnt block it ???
              Attached Files

              Comment

              • ButtonMaker
                Forum Member
                • Mar 2007
                • 172

                #8
                this has only 1 problem;

                if u delete the last entry, it blocks every word but if u leave 1 entry it works... can someone help please ?
                Attached Files

                Comment

                • Dermot
                  Indigo Rose Customer
                  • Apr 2004
                  • 1790

                  #9
                  Code:
                  function CheckKeyWord(strSite)
                  	--Select all entries found in the KeyWord table
                  	tSites = SQLite.QueryToTable(db,"SELECT * FROM KeyWord");
                  	--Do the following if there are entries returned
                  	if tSites and tSites.Rows > 0 then
                  		for i,v in tSites.Data do
                  		---compare URL with database keywords
                  		nMatch = String.Find(strSite, tSites.Data[i]["Title"], 1, false);
                  			if nMatch ~= -1 then
                  				break;
                  			end
                  		end
                  	else
                  		[B][COLOR="Red"]nMatch = -1[/COLOR][/B]
                  	end
                  end
                  Dermot

                  I am so out of here :yes

                  Comment

                  • ButtonMaker
                    Forum Member
                    • Mar 2007
                    • 172

                    #10
                    thank u soooooo much Dermot :yes:yes:yes

                    Comment

                    Working...
                    X