Jump to content

Jeff Overcash

  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Jeff Overcash

    Database in Delphi

    InterBase does not return a record count on a select statement (it always returns 42) because this is expensive to do. So RecordCount reflects the number of records fetched to the client. Just call FetchAll after open if you want an accurate RecordCount. If you are going to loop through the records just loop till Eof. RecordCount is not needed to work through the result set. FindFirst and FindNext are when you are filtering a Dataset on the client side.
  2. Jeff Overcash

    Interbase Get Days count of a month

    To get the count of days in a month just subtract (as dates) the first day of the next month from the first day of this month. Actually, as long as the day is the same from both months that works too so don't have to start with day 1 of the month. select cast('2/1/2021' as date) - cast('1/1/2021' as date) from rdb$database returns 31. select cast('3/15/2020' as date) - cast('2/15/2020' as date) from rdb$database returns 29 for Feb in 20202 etc. Stano's only gives you the dates of the first and last days of the passed in month, you still need to subtract them and add 1 to get the number of days.
  3. Jeff Overcash

    Problem with clearing ADO Tables

    your problem is in your empty Table procedure TfrmEntry.EmptyTable(tbl: TADOTable; tablename: string); var MyCmd: TADOCommand; begin tbl.Active := true; MyCmd.CommandText := 'Delete * from '+tablename; MyCmd.Execute; tbl.Active := false; end; You have a local variable named MyCmd, but you never initialize it. Nor do you hook it up to the connection. try this instead procedure TfrmEntry.EmptyTable(tbl: TADOTable); var MyCmd: TADOCommand; begin MyCmd := TADOCommand.Create(nil); try MyCmd.Connection := tbl.Connection; MyCmd.CommandText := 'Delete * from ' + tbl.TableName; MyCmd.Execute; finally MyCmd.Free; end; end; Note you have 2 MyCmd variables. One is local to your EmptyTable procedure and one public to your form, but neither is shown to ever be created. You need to both instantiate a TADOCommand object (the .Create ) and you need to tell it what connection to use (setting the connection property). Don't forget to clean up the variable when done.
  4. Jeff Overcash

    Sql Update

    Actually, the message is accurate. You do not have a table alias visible in the set part named I. Assuming Currate is in the invoice table (what you aliased as I "I" the where clause tryt UPDATE INVDETAIL ID SET ID.UPRICELOCAL=(ID.UPRICE-(ID.UPRICE * ID.DISCPERC /100)) * (select I.CURRRATE from invoice i where i.rno = id.rno) WHERE EXISTS (SELECT 1 FROM INVOICE I2 where I2.RNO = ID.RNO) This part (select I.CURRRATE from invoice i where i.rno = id.rno) should reflect wherever currrate is.
  5. Jeff Overcash

    ibtogo64.dll not found in the path

    IBDatabase works just fine. You set the Server type to IBEmbedded instead of IBServer to work with the embedded version of IB (Either IBToGo or IBLiite, license determines which mode the embedded works as).
  6. Jeff Overcash

    Attempted Update During Read Only Transaction

    Because Precommitted transactions do not get a transaction ID and can basically run forever without causing growth in the TIP page, the wisql window in IBConsole defaults to read-only transactions (not to be confused with a read-only database). To change this click Transactions | Options and just switch the radio button from read to write. If you always want it to be a writeable transaction check the Set as Default at the bottom.
  7. Jeff Overcash

    Interbase 2007 ->2020

    Log in to the server node itself, then on the backups node right-click it and select restore. From there should be rather self explanatory. It is hidden and only available with the server node logged in even though that isn't necessary to do the restore itself.
  8. Jeff Overcash

    Interbase Metadata View User Privileges

    Well, technically you can never hide your table structures cause clients can/have to get at that and have to get at that when SQL is prepared (and plans will tell someone really interested in the relationships). What you can do though is null out your trigger and SP source in rdb$triggers and rdb$procedures leaving behind the binary version of it as that is what IB uses not your source. So the real "brains" of your DB can not be extracted. They can get at input and output variables (once again the server has to tell clients about that information so even hiding the metadata it can be extracted by someone knowing how), but how those variables are used internally can be hidden by removing the source after it is compiled. BLR is not recompiled on backup/restore so the no source is nor harmful to any operations.
  9. Jeff Overcash

    [Firedac] Truncation error on Firebird select query

    This looks like a difference between IB and Fb. InterBase does not actually check the character length, but instead only checks that the # of bytes sent fit into the max # of bytes of the column declaration. Normally that is 1:1@charset size bytes, but with variable byte character sets (like SJIS or UTF8) you could actually store more characters than defined. So for instance anything in ANSI <= 127 all map to a 1-byte code point in UTF8. So if you have a VarChar(5) UTF8, InterBase (and therefore early versions of Fb) would allow you to store '1234567890' into that column. Reading the FireDac code section in this thread that is the type of check FD is doing. Seems Fb at some point started enforcing strict character counting verification and is now throwing the exception seen here. I had complaints from people (ab)using this for SJIS when IBX went to Unicode because I enforced strict character counting on the client-side. I tested this against IB and no exception is thrown (as expected) so at some point (I could not find in the FB documentation this change in behavior) strict character counting for multi-byte character sets must have been implemented in Fb. I am also able to insert 35 characters into a UTF8 VarCahr(32) in IB. you can try this fix. Untested but reads right to me - {code} if not lIsNull then begin pUTF8 := nil; if (lib.FBrand = ibFirebird) then begin if ALen > DataSize div 4 then if FVars.Statement.StrsTrim2Len then ALen := DataSize div 4 else ErrorDataTooLarge(DataSize div 4, ALen); iByteLen := FVars.Statement.Database.Encoder.Encode(ApData, ALen, pUTF8, ecUTF16); end else begin iByteLen := FVars.Statement.Database.Encoder.Encode(ApData, ALen, pUTF8, ecUTF16); if iByteLen > DataSize then if FVars.Statement.StrsTrim2Len then iByteLen := DataSize else ErrorDataTooLarge(DataSize, iByteLen); end; if SQLDataType = SQL_VARYING then begin PVary(pData)^.vary_length := Smallint(iByteLen); pData := @PVary(pData)^.vary_string[0]; end else pLen^ := Smallint(iByteLen); Move(PFDAnsiString(pUTF8)^, PFDAnsiString(pData)^, iByteLen * SizeOf(TFDAnsiChar)); end; {code}
  10. Jeff Overcash

    IBX components - licence

    The license is the same as for FireDAC the VCL or any other component of Delphi. Free to use in your apps, but you can not redistribute the source to people who do not already have access (they are licensed) to the source.