Delphi 7-How to save pictures in a database - database

I have been trying to create a select-your-picture-and-upload function of a normal user's profile in Delphi 7, but I am running in some problems.
Basically what I want is the following:
User uploads a picture from a folder (which I have achieved through a normal
OpenPictureDialog component)
Said picture gets stored in a database, which is where I'm stuck.
The database is a normal access database.
The table has a unique ID to identify the members and next to that is the picture of each member on the "Picture field" (which is set as a BLOB object).
So in other words my question is the following:
What components do I need to use in order to save a picture to a specified place in my database?
I have found some random code in the net but I'm running into troubles understanding what it does.

ADOQuery.SQL.Text := 'SELECT PictureField FROM YourTable';
ADOQuery.Open();
ADOQuery.Edit();
TBlobField(ADOQuery.FieldByName('PictureField')).LoadFromFile('PathToPictureFile');
ADOQuery.Post();

You can use imageEn component.
Web Site url to get information and download trial

Related

Changing username in firebase

i'm making a chat app using firebase. For each document that contains any name, i'm creating it as auth.currentUser.displayName. So for example, each message in the chat is a document created as:
sender: currentUser?.displayName!,
avatar: currentUser?.photoURL!,
content: message,
time,
About changing the username, i know how to do it, but if i change my username, i would have to access all the documents of every user that contains my name and change it too. Is there a better way to do it? Like, instead of auth.currentUser.displayName, i use something like user XYZ.displayName, and if user XYZ changes its name, it will also change in every other document.
Thanks in advance
But if i change my username, i would have to access all the documents
of every user that contains my name and change it too.
This is indeed a consequence of the data modelling in a NoSQL database, where you duplicate data instead of normalizing it as you would do in a SQL database.
Is there a better way to do it?
Apart from mimicking an SQL database (having the user name in a unique user document and fetching this doc each time you want to display this user name - i.e. you mimic an SQL join) there is no other way than updating each doc containing the value of the user name.
Mimicking an SQL database means that each time you want to display a message in the chat you need to fetch the document containing the user name value (not good for cost and performance). Keeping the denormalized approach means that you need to update all the corresponding message documents only when a user name change. So, depending on the frequency of the user names updates, you can decide which one is the best.
Like, instead of auth.currentUser.displayName, i use something like
user XYZ.displayName, and if user XYZ changes its name, it will also
change in every other document.
Basically this will not make any difference since you'll have to update all the docs containing the (previous) user name.

Logic app expression for path to File not working

I tried to find documentation in the subject but fell short until now.
I am trying to use Logic Apps in order to update a table when a trigger occurs.
Adding some context:
In many separate excel online file that are located in different area of Sharepoint, I have one Table in each of those files. Anytime the SQL table is updated, I get the following elements:
Name
Age
path_to_doc
doc_id
Name and Age are element I wish to add in those Excel file.
path_to_doc is the path to the Excel file that needs to be updated.
doc_id is the id of the Excel file that needs to be updated.
In the "Add row to a table" action, those are the elements that need to be filled:
Site (Manual no problem, this doesn't change) Document Library
(Manual no problem, this doesn't change)
File (this is where I have a first problem: when I do not click
manually, and try to put either the "path_to_doc" or the "doc_id"
instead, it doesn't work.
Table (It seems that I can force it to be Table1), which is fine
because all my Excel files have the table called Table1
Arguments (that is Azure understands the Table and is componnents and
asks you to fill the ones you need to fill, those elements disappear
when you change from a manual input to an input "path_to_doc" or
"doc_id").
It throws me an error:
ERROR 400
NOTE: When I do it manually, it works.
Anyone has experienced this and found a solution?
Thank you
You don't need to use Expression.
For example, if we want to get tables of the modified Excel, we can do like this:
A similar flow in SharePoint:
Finally found the answer.
I needed to go to the code view and add my dynamic details there for the body.
Thank you for your help.
Here is the solution. I hope it helps others :)
In the designer view, create an action "Add a row into a table" and use the dynamic path that brings you to the excel file that you need to update. It will show an error and you will not be able to add the body arguments.
In the code view, now you can manually add the body of the request to include the element you wish to update in the Table of the excel file.
That's it!

DB2 row level access control: how to pass a user Id

In our web application we want to use DB2 row level access control to control who can view what. Each table would contain a column named userId which contain the user id. We want log-in users be able to see only row's usereId column with theirs id. I have seen db2 permission examples using DB2 session_id or user, for example taking DB2 given Banking example :
CREATE PERMISSION EXAMPLEBANKING.IN_TELLER_ROW_ACCESS
ON EXAMPLEBANKING.CUSTOMER FOR ROWS WHERE BRANCH in (
SELECT HOME_BRANCH FROM EXAMPLEBANKING.INTERNAL_INFO WHERE EMP_ID = SESSION_USER
)
ENFORCED FOR ALL ACCESS
ENABLE;
Our table gets updated dynamically hence we don't know what row get added or deleted hence we don't know what are all the user Id in the table.
At any given time, different user would log-on to the web to view information retrieve from the tables, the permission declaration above only take SESSION_USER as the input, can I change it to something like Java function parameter where one can pass arbitrary id to the permission? If not then how do I handle different log-in users at arbitrary time? Or do I just keep changing SESSION_USER dynamically as new user login (using "db2 set" ??)? If so then is this the best practice for this kind use case?
Thanks in advance.
Since the user ID in question is application-provided, not originating from the database, using SESSION_USER, which equals to the DB2 authorization ID, would not be appropriate. Instead you might use the CLIENT_USERID variable, as described here.
This might become a little tricky if you use connection pooling in your application, as the variable must be set each time after obtaining a connection from the pool and reset before returning it to the pool.
Check out Trusted Contexts, this is exactly why they exist. The linked article is fairly old (you can use trusted contexts with PHP, ruby, etc. now).

User Interface to analaze date of a conventional rdbms

Currently we create Jasper PDF Reports from a single simple database table for our customers. This has been achieved programmatically. It's static. If the user wishes to change the query, he/she creates a change request, which we cannot deliver before the end of the next sprint (SCRUM).
The tool/library should be straight forward (e.g. convention over configuration) and employable from within a JavaEE container. And, open source.
Is there a dynamic tool that allows or customers to create the simple queries/reports themselves without knowing SQL? Means, they should be able to see the table and then create a query from it, execute and print (we could use Jasper Reports for the last one).
E.g. Select only data from year 2014, aggregate them by customer group and select columns x,y and z.
All of these criterias and query structure may change though, thus not just the value like year 2014.
Questions:
1) Is there a tool that presents the data in some kind of SAP-cube or something similar where the user could select the structure and attributes?
2) Can that tool save template queries (queries that the user has invoked before)?
thanks
With BIRT you could use parameters in the report... for example have one report that shows the whole data set or data cube (or at least a bit of all of the fields). Then you could add JavaScript to the report (or do all of the presentation in JavaScript for that matter), that shows the parameters a user can select from. These parameter values can then either be sent to a new report or could update the existing report. Parameters can be put into database queries too.
If that was exposed in JavaScript on a web page you could save the parameter values to an array and store them in the browser or server.

How to get the correct DB2/400 library(database) using Squeryl Client

I've installed Squeryl Client and can easily access my iSeries DB2/400 and select and see the data within the tables. However, it seems I have to modify the URL in the alias every time I want to change from one library(database) to another. If I want to query a file(table) from library(database) "LibraryA", I use URL "jdbc:as400://www.system.com/LibraryA". If I want to query a file(table) from library(database) "LibraryB", I use URL "jdbc:as400://www.system.com/LibraryB". Even when I try to use a URL with a library list like "jdbc:as400://www.system.com/;libraries=LibraryA LibraryB", it only looks at the first library when trying to access a table in "LibraryB".
When I drag a table to the graph and select some fields, I would expect the sql to qualify the table with the library(database) name. After all, it knows which library the table is being dragged from. The generated sql looks like this:
SELECT
tableB.field1,tableB.field2
FROM tableB
What I would expect is for it to look something like this (iSeries sql syntax):
SELECT
tableB.field1,tableB.field2
FROM LibraryB/tableB
When I try to key over the generated SQL command, it still tries to access the table from
LibraryA.
If I use the URL ""jdbc:as400://www.system.com/", it will try to find a libary(database) named the same as my user ID.
When Squeryl Client can build the objects list showing the library and table I'm selecting, I should think it would be able to build a query to access the correct library as well.
What am I missing?
Thanks
Bob
I seem to have figured this out. I changed the URL to the following:
jdbc:as400://www.system.com/;naming=system; libraries=LibraryA LibraryB

Resources