Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


image into db.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Mon May 18, 2009 1:07 pm    Post subject: image into db. Reply with quote

Alot of ppl laught at me when I say I wanna insert image to db. I don't know why they so mean. It's nothing wrong with that, infact alot of large scales systems do it not to mention axapta.

So I want to insert an image to a db (blob, binary). What kind of datatype do I use? Most guides no intenet uses byte array but that seems strange becuase I doubt MySql would know what it is.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Mon May 18, 2009 3:03 pm    Post subject: Reply with quote

We use MsSQL and there you have the 'old' type called 'image' which basicly is a binary type.

I think for MySQL you can best use binary, there is nothing really wrong in using it to store images, I doubt you will be using it for hundreds of users simutanously.
Although if you are using static images that get requested alot it seems a waste to use DB connections (and overhead) if you can just reffer to a location on the hard drive.

And a byte array is simply and array of bytes which can be any value (e.g. not just text but also binary), you'll need that to hold the data you want to send to the DB.

Which language are you using to 'talk' to the database? I bet there are alot of examples for every language of how to get an image into a database.

We use the C# InputStream method to put the image in a byte array and then use a parametered SQL query to put the byte array in the database.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue May 19, 2009 4:00 am    Post subject: Reply with quote

blob is also binary. Also for me it's trying to send 'Byte[]' to db no good.

Code:
INSERT INTO Pictures (name, source) VALUES('salmon',System.Byte[]);

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Tue May 19, 2009 4:28 am    Post subject: Reply with quote

You could save the image file on the server (in folder say... ~/images) and then in the DB you can have a link to that image...
_________________
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue May 19, 2009 4:38 am    Post subject: Reply with quote

Localhost wrote:
You could save the image file on the server (in folder say... ~/images) and then in the DB you can have a link to that image...

Really? Is that what I asked for? I said I wanted to store the images binary in the db.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Tue May 19, 2009 5:01 am    Post subject: Reply with quote

wallantia wrote:
blob is also binary. Also for me it's trying to send 'Byte[]' to db no good.

Code:
INSERT INTO Pictures (name, source) VALUES('salmon',System.Byte[]);


What language is this?
VB.NET?
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue May 19, 2009 6:24 am    Post subject: Reply with quote

DanielG wrote:
wallantia wrote:
blob is also binary. Also for me it's trying to send 'Byte[]' to db no good.

Code:
INSERT INTO Pictures (name, source) VALUES('salmon',System.Byte[]);


What language is this?
VB.NET?

c#

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 26004
Location: The netherlands

PostPosted: Tue May 19, 2009 6:25 am    Post subject: Reply with quote

Can't really help with this as I only have experience with using database specific classes that handle the binary fields as objects so no sql syntax used at all (most likely internally used but not at my, programmers, side)

Also, I don't know what the original poster's language is in. But, if it's php I may have a nice example that uses blob fields to store files in: Mantis bugtracker.
It's opensource so if you're using php and can't find information anywhere else, you can always try to figure out how mantis works

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue May 19, 2009 6:27 am    Post subject: Reply with quote

Dark Byte wrote:
Can't really help with this as I only have experience with using database specific classes that handle the binary fields as objects so no sql syntax used at all (most likely internally used but not at my, programmers, side)

Also, I don't know what the original poster's language is in. But, if it's php I may have a nice example that uses blob fields to store files in: Mantis bugtracker.
It's opensource so if you're using php and can't find information anywhere else, you can always try to figure out how mantis works

Sorry that I didn't mention that it's c# Embarassed

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites