How to access the database from MQL4 , ORACL , MSSQL, MySQL - page 7

 
toxa.forex писал(а) >>

Hello Gentlemen, already asked a question in a parallel thread, but I'll probably repeat it...

MySQL restricts the maximum number of purely columns in a table, to be more precise, the maximum possible number of columns is 1000, does anyone know how this restriction can be removed and is it even possible? If not, what database allows you to create tables with more than 3000 columns?

A lot of columns? So the database is poorly planned - it needs normalisation.

 
Itso >> :

A lot of columns? It means the database is poorly planned - you need to normalise it.

Itso, I'm not sure if you have read the previous post, so I'll repeat - normalization of the database will lead to nothing... Normalization is needed to eliminate redundancy, this database is not redundant, respectively, there is no need to bring it to NF, in any case, the solution is found ... Not the prettiest one in my opinion, but there are no other options yet - using a bitmask... As the columns could take values 1|0 it was decided to use one column with a bitmask of 0 and 1...

Anyway, thanks

 
TheVilkas >>:


string CommandText="INSERT INTO Rates (TimeCurrent,AccountCompany,Symb,DateTimeRate,Ask,Bid) "+
"VALUES("+TimeCurrent()+",'"+Company+"','"+Symb+"','"+DateTimeRate+"',"+Ask+","+Bid+")";
Execute(CommandText,adAsyncFetch);
Sleep(15);


How do I read from the database?
 
Twilight писал(а) >>

How do I read from the database?

Select

 
Itso >>:

Select


I am familiar with SQL itself

string Company=AccountCompany();
string Symb=Symbol();

Inserting into the database works
//string CommandText="INSERT INTO Rates (TimeCurrent,AccountCompany,Symb,DateTimeRate,Ask,Bid) "+
//"VALUES("+TimeCurrent()+",'"+Company+"','"+Symb+"','"+DateTimeRate+"',"+Ask+","+Bid+")";
//string CommandText="INSERT INTO [test].[dbo].[test] ([test]) VALUES (22)";

But I'm not familiar with sampling.


string CommandText="SELECT [test] FROM [test].[dbo].[test] where test=5";
string test3;
test3=Execute(CommandText,adAsyncFetch);

Comment(test3);
Sleep(15);



Returns 1


I tried to change the Execute(CommandText,adAsyncFetch); the second parameter to these

adCmdText(1) - text definition of the command or stored procedure.
adCmdTable(2) - create an SQL query that returns all rows of the specified table.
adCmdStoredProc(4) - Stored procedure.
adCmdUnknown(8) - command type unknown (default).
adAsyncExecute(16) - asynchronous execution of the command.
adExecuteNoRecords(128) - do not return strings.

It still outputs the damn thing.

I suspect Execute returns an array of data and it should be processed somehow

 

there's an example on page 5 and another one on page 6

 
sergeev >>:

тут же на 5 странице пример и на 6 ещё один



on pages 5 and 6 an example with My SQL and another library

And I discuss for MS SQL with ADOLIB library.

The example with ADolib contains only loading in a DB and unloading as I don't know

 

So does anyone know how to implement reading from MS SQL?

Please help me to solve this problem.

 
Twilight >>:


You can of course use the MySQL option, but when reading data from the database, Hieroglyphics are displayed in front of the value
 

What exactly do you have to say about MS SQL?

Give me the code and show me where it doesn't work, and we'll look into it.