ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 AppendImage truncates FileName

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Dec 09 2023 : 17:24:04
In the demo:
\Demos\Database\DBMultiBitmap_AllRecords

This method AppendImage truncates the filename in the database to 20 chracters:

procedure TMainForm.btnAppendClick(Sender: TObject);
begin
  if dlgOpenImage.Execute then
    fDBMultiBitmap.AppendImage( dlgOpenImage.Filename );
end;


It seems the filename field in the IEDemoDB.sqlite database is restricted to 20 characters.

How can I enlarge it?
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 10 2023 : 17:26:07
Hi Peter

TIEDBMultiBitmap does not know the names of the field in your database (only the one you specify as containing the image). If you want an AppendImage() method that appends an image and then sets one of your fields, you should create a helper method.



Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Dec 10 2023 : 03:23:58
The database provided by the ImageEn DBMultiBitmap_AllRecords demo (IEDemoDB.sqlite) also contains a DESCRIPTION (Memo) field:





I assume this field was intentionally created for ImageEn. Therefore, please provide an AppendImage method with an optional Description parameter for database purposes. Thank you!

Example: fDBMultiBitmap.AppendImage( dlgOpenImage.Filename, Description );
PeterPanino Posted - Dec 09 2023 : 18:05:54
A friend helped me to modify the database with a Python script:

# Step 1: Create a new table with the modified column length for Filename
cursor.execute("""
    CREATE TABLE IF NOT EXISTS NewImages (
        ID INTEGER,
        Filename varchar(255),
        Description memo,
        Image image,
        PRIMARY KEY(ID)
    );
""")

# Step 2: Copy data from the old table to the new table
cursor.execute("""
    INSERT INTO NewImages (ID, Filename, Description, Image)
    SELECT ID, Filename, Description, Image FROM Images;
""")

# Step 3: Drop the old table
cursor.execute("DROP TABLE Images;")

# Step 4: Rename the new table to the old table's name
cursor.execute("ALTER TABLE NewImages RENAME TO Images;")

# Commit the changes and close the connection
conn.commit()
conn.close()


Now, the file name field can hold up to 255 characters.