Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » I need an education in SQL
I need an education in SQL [message #444430] Mon, 28 February 2011 03:26 Go to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I have a very limited understanding of databases and how to interact with them. At my place of work the Database Admins have servers running Microsoft SQL server 2005/2008.
I manage software that interacts with some of the databases on these servers which does so through an OBDC connection which I had to set up on the Application server.
However, I also sometimes view the tables on the databases using Microsoft sql server management studio 2005.

I'll log in using SQL server authentification rather than my windows credentials (as worryingly they actually let me have SA rights (well, the applications server needed SA to create the database, so I use that)).

Screenshot is a random google image
http://game-maps.net/staff/reborn/fig1.png

Then I'll browse to databases->the database I want->tables then I view the table...

http://game-maps.net/staff/reborn/fig2.gif

I set up an ODBC connection on my client PC and sometimes view the databases in Microsoft Access instead, as I find setting up views easier that way.

This is the entire extent of my database knowledge. I do know how to run SQL queries, but I do not actually know any SQL queries.

What the fuck has any of this rambling got to do with renegade modding?

I want to know how to create a plugin that will interact with a database. I need to know how to install the database server, which database server software most people use, and I need to know how to create my tables, access data, modify data, write data, compare "cells", close the connection properly, pretty much everything.

Is there anyone willing to help?

What would be really fucking awesome would be a tutorial using the SSGM plugin.
The tutorial would ideally include how to install the DB software, then proceed to demonstrate in the plugn how to connect to the database and handle errors (like the db doesnt exist), how to create the table and set up the headings (if they do not exist) via the plugin itself. Then how to write some data and read some data, and modify some data too.



[Updated on: Mon, 28 February 2011 03:26]

Report message to a moderator

Re: I need an education in SQL [message #444431 is a reply to message #444430] Mon, 28 February 2011 05:31 Go to previous messageGo to next message
Spyder
Messages: 1070
Registered: March 2006
Karma: 0
General (1 Star)
What? You mean like:

SELECT/INSERT/UPDATE/DELETE etc.
Re: I need an education in SQL [message #444432 is a reply to message #444430] Mon, 28 February 2011 05:37 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
The queries you need will also depend on the flavour of SQL used, for instance Oracle differs from the ANSI standard... although I doubt any Renegade server owners are running Oracle databases.

Most likely your going to want to support MySQL, since that's used by a lot of websites for their backend.


http://steamsignature.com/card/1/76561197975867233.png
Re: I need an education in SQL [message #444433 is a reply to message #444432] Mon, 28 February 2011 05:45 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Spyder wrote on Mon, 28 February 2011 07:31

What? You mean like:

SELECT/INSERT/UPDATE/DELETE etc.


Yes, but I want to learn how to do this programatically.

danpaul88 wrote on Mon, 28 February 2011 07:37

The queries you need will also depend on the flavour of SQL used, for instance Oracle differs from the ANSI standard... although I doubt any Renegade server owners are running Oracle databases.

Most likely your going to want to support MySQL, since that's used by a lot of websites for their backend.


Yes, that would be likely. Now be awesome and write that tutorial and example plugin! Very Happy



Re: I need an education in SQL [message #444443 is a reply to message #444430] Mon, 28 February 2011 10:39 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
I have a ODBC class somewhere.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: I need an education in SQL [message #444472 is a reply to message #444430] Mon, 28 February 2011 23:54 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
SQL 2k8.

I would use sql server authentication so that you can supply a DB username/password.

Btw I work for a software company that uses databases heavily with C#.

there has to be a C++ wrapper for this.


http://img339.imageshack.us/img339/1991/nefobbygenyunoreleasere.jpg
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
Re: I need an education in SQL [message #444479 is a reply to message #444472] Tue, 01 March 2011 02:03 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Sir Kane wrote on Mon, 28 February 2011 12:39

I have a ODBC class somewhere.


That would be pretty nice if you wouldn't mind posting it? Smile

halo2pac wrote on Tue, 01 March 2011 01:54

SQL 2k8.

I would use sql server authentication so that you can supply a DB username/password.

Btw I work for a software company that uses databases heavily with C#.

there has to be a C++ wrapper for this.


A totally awesome person would add that wrapper to a plugin and show a few slick moves using it! Very Happy

By the way, totally sorry for not sending that stuff out yet, no excuse for it really, just been at the back of my mind.



Re: I need an education in SQL [message #444487 is a reply to message #444430] Tue, 01 March 2011 05:24 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
I am not really sure what the point of making an SSGM plugin to connect to a database is... other plugins are still going to have to make their own connections and run their own queries based on what data they want to store / retrieve from their own tables, so why have another plugin which just creates a random connection for no apparent purpose?

http://steamsignature.com/card/1/76561197975867233.png
Re: I need an education in SQL [message #444500 is a reply to message #444430] Tue, 01 March 2011 10:55 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
sqlite is the easiest thing to use in my opinion. (http://www.sqlite.org/sqlite-amalgamation-3070500.zip)

http://www.sqlite.org/docs.html
Re: I need an education in SQL [message #444501 is a reply to message #444500] Tue, 01 March 2011 11:03 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
danpaul88 wrote on Tue, 01 March 2011 07:24

I am not really sure what the point of making an SSGM plugin to connect to a database is... other plugins are still going to have to make their own connections and run their own queries based on what data they want to store / retrieve from their own tables, so why have another plugin which just creates a random connection for no apparent purpose?


An example... It would show me what to do in simple terms, so that I could make my own and expand on it.

jnz wrote on Tue, 01 March 2011 12:55

sqlite is the easiest thing to use in my opinion. (http://www.sqlite.org/sqlite-amalgamation-3070500.zip)

http://www.sqlite.org/docs.html


Thank you, I will start googling, I guess. Smile



Re: I need an education in SQL [message #444502 is a reply to message #444501] Tue, 01 March 2011 11:07 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
reborn wrote on Tue, 01 March 2011 18:03



Thank you, I will start googling, I guess. Smile



Google will turn up some good results but there are some good pointers in the link above Wink
Re: I need an education in SQL [message #444503 is a reply to message #444430] Tue, 01 March 2011 11:11 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
If your interested in using SQLite you might want to look at the BRenBot source code, since that uses SQLite for it's database.

Of course, that's written in Perl... but you will be able to get pointers on the SQL side of things.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Tue, 01 March 2011 11:11]

Report message to a moderator

Re: I need an education in SQL [message #444505 is a reply to message #444503] Tue, 01 March 2011 11:55 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
jnz wrote on Tue, 01 March 2011 13:07

reborn wrote on Tue, 01 March 2011 18:03



Thank you, I will start googling, I guess. Smile



Google will turn up some good results but there are some good pointers in the link above Wink


SQLite definately seems like the way to go, it's built into the application and you get the source code, no database server needed, it's just part of the app. Feeling it.
I just compiled a dummy plugin with the sqlite header file and .c file. Doesn't actually do anything yet, but it's nice to have it compile without errors and start diving in.
Looking through the site now.

danpaul88 wrote on Tue, 01 March 2011 13:11

If your interested in using SQLite you might want to look at the BRenBot source code, since that uses SQLite for it's database.

Of course, that's written in Perl... but you will be able to get pointers on the SQL side of things.


Thank you, I will take a look. Smile



Re: I need an education in SQL [message #444513 is a reply to message #444430] Tue, 01 March 2011 15:27 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I tried using the easysqlite wrapper for sqlite, it's got me up and running very quickly, and I have now successfully created a database, a table, and some records of different types. I was also able to read these records, modify them and print them to the console screen.

I'm extremely happy! Very Happy



Re: I need an education in SQL [message #444530 is a reply to message #444430] Wed, 02 March 2011 04:22 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
This was only a small test, but you can see it clearly working in the screeny below. Modified scripts.dll using a database is nothing new, I know of at least Two people that have already done this and there are probably plenty more people that could if they wanted to.
For me though, this is new and exciting. It opens up the door to more possibilities.

http://game-maps.net/staff/reborn/ssgmpluginusingsqltest.jpg



Re: I need an education in SQL [message #444533 is a reply to message #444430] Wed, 02 March 2011 04:47 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Don't forget that SQlite can block your server.
Work with threads if you don't want horrible lags.


Bückstabü!
Re: I need an education in SQL [message #444536 is a reply to message #444533] Wed, 02 March 2011 05:59 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
cAmpa wrote on Wed, 02 March 2011 06:47

Don't forget that SQlite can block your server.
Work with threads if you don't want horrible lags.


Indeed, I had considered that. I will make sure I use a thread for the database. Smile



Re: I need an education in SQL [message #446574 is a reply to message #444430] Thu, 05 May 2011 14:06 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Did you make any progress with this, Reborn? I'm gonna play around with SQLite soon and I wonder if you found any interesting/resourceful links or software libraries. WxSQLite3 is a wrapper that uses WxWidgets' data types, and YaRR also contains a wrapper for SQLite. I found a tutorial on the SQLite written in 2007. Haven't really searched for stuff though.

Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Thu, 05 May 2011 14:07]

Report message to a moderator

Re: I need an education in SQL [message #446580 is a reply to message #444430] Thu, 05 May 2011 15:03 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I found the easysqlite wrapper most easy to use. I never went anywhere with it though as the project I had in mind soon became boring to me. I actually didn't go much further than what I posted in this thread.


Re: I need an education in SQL [message #446777 is a reply to message #446580] Mon, 09 May 2011 03:26 Go to previous messageGo to next message
bmruze is currently offline  bmruze
Messages: 62
Registered: March 2006
Location: South Carolina
Karma: 1
Recruit

I am pretty sure that somewhere in these forums some source code was posted, by someone who used SQL in their build of SSGM, I'll do some looking and see what I can find. If I remember correctly they used it for their commander based system but looking at what they did could help you out a little.

Once again I'll do some looking around to see if I can find it.


https://content.screencast.com/users/bmruze/folders/Jing/media/b3acb17d-6b52-4e10-8183-eae956a12446/2017-09-02_0843.png
Re: I need an education in SQL [message #446880 is a reply to message #446777] Mon, 09 May 2011 16:49 Go to previous message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
bmruze wrote on Mon, 09 May 2011 03:26

I am pretty sure that somewhere in these forums some source code was posted, by someone who used SQL in their build of SSGM, I'll do some looking and see what I can find. If I remember correctly they used it for their commander based system but looking at what they did could help you out a little.

Once again I'll do some looking around to see if I can find it.

I'd appreciate that.

btw, how's your identical twin brother?


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Previous Topic: level load
Next Topic: C&C_Mars & LevelRedit
Goto Forum:
  


Current Time: Tue Dec 17 19:07:33 MST 2024

Total time taken to generate the page: 0.01093 seconds