Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Quad), 773 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 19 of 24 1 2 17 18 19 20 21 23 24
Can't Count the results I get [Re: D3D] #41797
12/06/07 23:42
12/06/07 23:42
Joined: Nov 2000
Posts: 1,534
hamburg
Samb Offline
Serious User
Samb  Offline
Serious User

Joined: Nov 2000
Posts: 1,534
hamburg
ok, I got a problem.
I need to know how many characters the plugin found when I ask for a account ID.

lets say I want to get all characters for account "1"
there are 5 characters in the database:
Code:

account|name |size
1 |Hans | 2
1 |Franz | 3
1 |Lutz | 1
2 |Tim | 3
3 |John | 2



temp = mySQL_ExecQuery("Select * from Charaktere where Account = 1");
And... now?
the game doesnt know how much characters there are.
intval = mySQL_GetVal(1,x); = account
intval = mySQL_GetStr(temp_string,2,x); = Name
intval = mySQL_GetVal(3,x); = Size

if X is higher than 3, the whole plugin will crash.
so I can't just go trough all rows and if it won't return anything then it were the last row.
what should I do?
I even can't use "SELECT COUNT( * ) FROM " because the query function does only return a 1 for sucessful and 0 for error :/

Re: Destop's Litec MySQL DLL for A7 [Re: D3D] #41798
12/06/07 23:44
12/06/07 23:44
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:

The Litec dll doesn't work for C-Script btw




LOL!

Well that explains that!

Looking forward to your update... an A7 plugin for c-script would really help us as we are not ready to migrate several thousand lines of code to c-lite... yet.

Re: Destop's Litec MySQL DLL for A7 *DELETED* [Re: fastlane69] #41799
12/07/07 01:30
12/07/07 01:30
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Post deleted by D3D


smile
Re: Destop's Litec MySQL DLL for A7 [Re: D3D] #41800
12/07/07 02:39
12/07/07 02:39
Joined: Nov 2000
Posts: 1,534
hamburg
Samb Offline
Serious User
Samb  Offline
Serious User

Joined: Nov 2000
Posts: 1,534
hamburg
@D3D
well its hard for me to put a demo together, because I don't know HOW to do it
you can't test something if you just don't know how

but here are some more information:
this is the GSTsqlite version of the code:
Code:
		
str_cpy(temp_string3,"Select * from Charaktere where Account = ");
str_cat(temp_string3,str_bearb); // str_bearb contains the account-ID
query_handle = GSTsqlite_ExecuteQuery(data_handle,temp_string3);
while(!GSTsqlite_EOF(query_handle))
{
str_cat(str_info,"&");
GSTsqlite_GetString(query_handle,"CharName", str_bearb);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Charakter", temp);
str_for_num(str_bearb,temp);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Groesse", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Red", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Green", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Blue", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
GSTsqlite_NextRow(query_handle);
}


GSTNet_ServerSend(vSender, 12, str_info);


how it works: the server wants to send the character infos to the client. it opens the database and select the characters with the same account-ID.
now, the server is on the first row. it's reading all character infos and put them into a string, that will be send to the client.
that will look like that (the first number is the account ID) "1&Franz&2&1&100&200&100"
then, the server goes to the next row, reading the next character of the account. the string will look like that:
1&Franz&2&1&100&200&100&Hans&1&3&50&255&100"
and it goes on and on and on.
TILL it comes to the last row. if the server got to the last row, it will stop the while and send the information to the client.
ok, how to do that with mysql?
I heard that the query commands also returns information, like the "count(*)" command. but the plugin only returns "1" or "0".

also, the problem is easy to describe:
I want to read out of the database information that is more than in one row and I don't know how much rows it will have.

hope that explains it a little more

P.s.: I'm Using A6, so no lite-c

Re: Destop's Litec MySQL DLL for A7 *DELETED* *DELETED* *DELETED* [Re: Samb] #41801
12/07/07 04:15
12/07/07 04:15
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Post deleted by D3D


smile
Re: Destop's Litec MySQL DLL for A7 [Re: D3D] #41802
12/07/07 10:20
12/07/07 10:20
Joined: Nov 2000
Posts: 1,534
hamburg
Samb Offline
Serious User
Samb  Offline
Serious User

Joined: Nov 2000
Posts: 1,534
hamburg
yes, the A7 dll seems to work with A6. but the crash when you use an invalid x,y value, it also crashs. if it wouldnt crash and just returns something like "0" for error, it would be ok
but then getval need to be like this "var getval(varname,x,y)"

also, I can't use GSTsqlite anymore, cause something is wrong with it.. it crashes sometimes. thats why I try out mysql.

Re: Destop's Litec MySQL DLL for A7 [Re: Samb] #41803
12/07/07 10:49
12/07/07 10:49
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Could not edit/delete previous posts. Maybe moderator can remove them to avoid confusion..

@ Samb:
All functions for the Lite-C version seem to be working correctly. Guess the CSMySQL engine extension for A7 could also run with A6.60 C-Script. Although I haven't tried yet and therefore i'm not really certain. Furthermore i've created a new demo that shows most features.



Here are the current A7 MySQL beta engine extensions for A7 C-Script and Lite-C. Tonight i'll update the downloads with clean examples.

C-Script

Lite-C


smile
Re: Destop's Litec MySQL DLL for A7 [Re: D3D] #41804
12/08/07 12:00
12/08/07 12:00
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Samb i'm trying to understand what you want to do. About the invalid x,y value. This can be solved by programming while keeping that in mind. Anyways i'm going to try today.

Code:
#include <acknex.h>

//----------------------------------------------------------------------------
// DLL FUNCTIONS
//----------------------------------------------------------------------------
function mySQL_Connectdb(char* w,char* x,char* y,char* z);
function mySQL_Closedb();
function mySQL_ExecQuery(string);
function mySQL_GetVal(x, y);
function mySQL_GetStr(string,x,y);
function mySQL_RowNumber();
function mySQL_IsConnected();

//----------------------------------------------------------------------------
// VARIABLES
//----------------------------------------------------------------------------

var mysql_handle_n;
var rxrownr;

//----------------------------------------------------------------------------
// STRINGS
//----------------------------------------------------------------------------

STRING* MyAppTitle;
STRING* MyConnection = "#80";
STRING* MyQuery = "#255";

//----------------------------------------------------------------------------
// FONTS
//----------------------------------------------------------------------------

FONT* standard_font = "ackfont.pcx";
FONT* digit_font = "digfont.pcx";

//----------------------------------------------------------------------------
// PANELS
//----------------------------------------------------------------------------

PANEL* demo_logo =
{
layer = 1;
bmap = "logo.tga";
flags = VISIBLE;
}

PANEL* rxrownr_panel =
{
layer = 2;
digits(15,75,"Row in dataset:",standard_font,0,0);
digits(0,85,4,digit_font,1,rxrownr);
flags = VISIBLE;
}

//----------------------------------------------------------------------------
// TEXT
//----------------------------------------------------------------------------

TEXT* connection_txt =
{
layer = 3;
string = ("MySQL Server Status:", MyConnection);
pos_x = 15;
pos_y = 15;
font = standard_font;
flags = VISIBLE;
}

TEXT* query_txt =
{
layer = 4;
string = ("MySQL Query:", MyQuery);
pos_x = 15;
pos_y = 40;
font = standard_font;
flags = VISIBLE;
}

//----------------------------------------------------------------------------
// HEART OF THE GAME
//----------------------------------------------------------------------------

function main()
{
fps_max = 60;

MyAppTitle = str_create("Lite-C MySQL A7.06.1");
video_window(vector(0,0,0),NULL,112,MyAppTitle);
video_set(640,480,32,2);

mySQL_Connectdb(&"dbname",&"dbhost",&"dbadmin",&"dbpass");
if(!mySQL_IsConnected())
{
str_cpy(MyConnection, "Connection closed");
str_cpy(MyQuery, "unknown");
}
else
{
str_cpy(MyConnection, "Connection established");
str_cpy(MyQuery, "SELECT * FROM players");
}

// Show the number of rows in players table
if(mySQL_ExecQuery(MyQuery) && mySQL_RowNumber() >0)
{
rxrownr = mySQL_RowNumber(); // Return the number of rows
wait(1);
}

while(1)
{
wait(1);
}
//mySQL_Closedb();
}




smile
Re: Destop's Litec MySQL DLL for A7 [Re: D3D] #41805
12/08/07 12:57
12/08/07 12:57
Joined: Nov 2000
Posts: 1,534
hamburg
Samb Offline
Serious User
Samb  Offline
Serious User

Joined: Nov 2000
Posts: 1,534
hamburg
oh god, somehow mysql_rownumber does now that what I want.. it returns the value of rows.
ok, so my problem will be solved
but anyway, the function shouldn't crash when you type in an non existing row

Re: Destop's Litec MySQL DLL for A7 [Re: Samb] #41806
12/08/07 13:01
12/08/07 13:01
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Can you post the function that crash? Currently i'm testing the DLL with MySQL server 5.0 that comes with WAMP server software.


smile
Page 19 of 24 1 2 17 18 19 20 21 23 24

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1