Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-23 Thread michael . vancanneyt



On Fri, 23 Mar 2012, LacaK wrote:




Michael,
I updated patch for fcl-db test suite. See: 
http://bugs.freepascal.org/view.php?id=17303

Would you be so glad and will you apply them please ?


Done, rev. 20572.

As I wrote yesterday, I uploaded last patch for fcl-db test suite to 
http://bugs.freepascal.org/view.php?id=17303

From me side it is all for this moment.


Applied. Rev. 20585.


Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-22 Thread LacaK







And will you apply also diffs to fcl-db tests ? So we can run 
complete test suite ...


I will do so later today.

Michael,
I updated patch for fcl-db test suite. See: 
http://bugs.freepascal.org/view.php?id=17303

Would you be so glad and will you apply them please ?
TIA
-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-22 Thread michael . vancanneyt



On Thu, 22 Mar 2012, LacaK wrote:








And will you apply also diffs to fcl-db tests ? So we can run complete 
test suite ...


I will do so later today.

Michael,
I updated patch for fcl-db test suite. See: 
http://bugs.freepascal.org/view.php?id=17303

Would you be so glad and will you apply them please ?


Done, rev. 20572.

Sorry for the delay.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-22 Thread Marcos Douglas
On Thu, Mar 22, 2012 at 10:46 AM,  michael.vancann...@wisa.be wrote:


 On Thu, 22 Mar 2012, LacaK wrote:





 And will you apply also diffs to fcl-db tests ? So we can run complete
 test suite ...


 I will do so later today.

 Michael,
 I updated patch for fcl-db test suite. See:
 http://bugs.freepascal.org/view.php?id=17303
 Would you be so glad and will you apply them please ?


 Done, rev. 20572.

 Sorry for the delay.

 Michael.

There is one chance to these codes merge in fixes_2_6?  =)

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-22 Thread LacaK



Michael,
I updated patch for fcl-db test suite. See: 
http://bugs.freepascal.org/view.php?id=17303

Would you be so glad and will you apply them please ?


Done, rev. 20572.

Great!



Sorry for the delay.

It's Okay ;-)

Now I have only 2 things:
1. question about packages/fcl-db/fpmake.pp ... does is needed update 
also this file ? I attach patch, which is only my guess based on other 
connectors.
2. tomorow I will update tests for DATETIME values outside of supported 
range by MS SQL

Then we can close bug report #17303

Thanks
-Laco.

--- fpmake.pp.ori   Thu Mar 22 14:28:18 2012
+++ fpmake.pp   Thu Mar 22 14:53:16 2012
@@ -46,6 +46,7 @@ begin
 P.SourcePath.Add('src/sqldb/odbc', SqldbConnectionOSes);
 P.SourcePath.Add('src/sqldb/examples', SqldbConnectionOSes);
 P.SourcePath.Add('src/sqldb/oracle', 
SqldbConnectionOSes-SqldbWithoutPostgresOSes);
+P.SourcePath.Add('src/sqldb/mssql', SqldbConnectionOSes);
 P.SourcePath.Add('src/sdf');
 P.SourcePath.Add('src/json');
 P.SourcePath.Add('src/datadict', DatadictOSes);
@@ -659,6 +660,16 @@ begin
   AddUnit('sqldb');
   AddUnit('dbconst');
 end;
+
+T:=P.Targets.AddUnit('mssqlconn.pp', SqldbConnectionOSes);
+  with T.Dependencies do
+begin
+  AddUnit('db');
+  AddUnit('bufdataset');
+  AddUnit('sqldb');
+  AddUnit('dbconst');
+end;
+
 T:=P.Targets.AddUnit('sqlite3ds.pas', SqliteOSes);
   with T.Dependencies do
 begin
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread LacaK




No.
Anyway, I change the colum names (id,name to col1, col2)
The error is:
Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...
  

This error has nothing to do with FPC or SQLDB.

Your SQL statement is trying to insert NULL in a required field.



No Michael, see the example I wrote before.

Create table:
create table #t (col1 int, col2 varchar(60))

OBS: No column is required.

This INSERT works:
insert into #t values (1, 'bla bla bla')

This INSERT do NOT works:
insert into #t (col2) values ('bla bla')

  


Marcos, can you please test with explicitly allowed nulls:
create table #t (col1 int NULL, col2 varchar(60) NULL)

(MS SQL Server nullability is controled by database setting *ANSI null 
default* so you can check this setting on your temp database also)*

*L.*
*
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread michael . vancanneyt



On Tue, 20 Mar 2012, Marcos Douglas wrote:


On Tue, Mar 20, 2012 at 8:12 PM,  michael.vancann...@wisa.be wrote:



On Tue, 20 Mar 2012, Marcos Douglas wrote:


On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
mich...@freepascal.org wrote:




On Tue, 20 Mar 2012, Marcos Douglas wrote:



No.
Anyway, I change the colum names (id,name to col1, col2)
The error is:
Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...




This error has nothing to do with FPC or SQLDB.

Your SQL statement is trying to insert NULL in a required field.



No Michael, see the example I wrote before.



I saw the example :-)




Create table:
create table #t (col1 int, col2 varchar(60))

OBS: No column is required.

This INSERT works:
insert into #t values (1, 'bla bla bla')

This INSERT do NOT works:
insert into #t (col2) values ('bla bla')



This kind of SQL is passed as-is to MSSQL. To my knowledge, SQLDB does not
change it.

If you had been using parameters, it would have been a different story.


Does matter if I use or not parameters.


Yes, of course. In that case, SQLDB does some preprocessing of your SQL
statement.

This can easily be checked. Try setting ParamCheck to 'False' before
executing your statement.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread LacaK




Then I have minor comments:
- in packages/dblib/fpmake.pp at line 23: Author put please instead 
of Lacak2 Ladislav Karrach (as in dblib.pp header)
- in packages/fcl-db/src/sqldb/mssql/makefile.fpc at line 2: change 
IBConnection to MSSQLConnection ;-)


Done. Rev. 20540 and 20541.
Now I found also fpmake.pp in packages/fcl-db folder ... There are all 
sqlDB connectors, may be, that also new TMSSQLConnection should go there ?

(I do not understand how these make files works ;-) so I only guess)





And will you apply also diffs to fcl-db tests ? So we can run 
complete test suite ...


I will do so later today.

;-)

-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread Marcos Douglas
On Wed, Mar 21, 2012 at 3:34 AM, LacaK la...@zoznam.sk wrote:



 No.
 Anyway, I change the colum names (id,name to col1, col2)
 The error is:
 Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...


 This error has nothing to do with FPC or SQLDB.

 Your SQL statement is trying to insert NULL in a required field.


 No Michael, see the example I wrote before.

 Create table:
 create table #t (col1 int, col2 varchar(60))

 OBS: No column is required.

 This INSERT works:
 insert into #t values (1, 'bla bla bla')

 This INSERT do NOT works:
 insert into #t (col2) values ('bla bla')




 Marcos, can you please test with explicitly allowed nulls:
 create table #t (col1 int NULL, col2 varchar(60) NULL)

 (MS SQL Server nullability is controled by database setting ANSI null
 default so you can check this setting on your temp database also)
 L.

Yes, of course... you're right.
I have this code that worked before so, I thought something broked.
I had tested before in a different machine with other installation of
MSSQL. My mistake, sorry.

If I find some problems I can post in bugtracker or still early to do this?
--
Michael, sorry for your time.

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread Marcos Douglas
On Wed, Mar 21, 2012 at 5:01 AM,  michael.vancann...@wisa.be wrote:


 On Tue, 20 Mar 2012, Marcos Douglas wrote:

 On Tue, Mar 20, 2012 at 8:12 PM,  michael.vancann...@wisa.be wrote:



 On Tue, 20 Mar 2012, Marcos Douglas wrote:

 On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
 mich...@freepascal.org wrote:




 On Tue, 20 Mar 2012, Marcos Douglas wrote:


 No.
 Anyway, I change the colum names (id,name to col1, col2)
 The error is:
 Cannot insert the value NULL into column 'col', table
 tempdb.dbo.#t...




 This error has nothing to do with FPC or SQLDB.

 Your SQL statement is trying to insert NULL in a required field.



 No Michael, see the example I wrote before.



 I saw the example :-)



 Create table:
 create table #t (col1 int, col2 varchar(60))

 OBS: No column is required.

 This INSERT works:
 insert into #t values (1, 'bla bla bla')

 This INSERT do NOT works:
 insert into #t (col2) values ('bla bla')



 This kind of SQL is passed as-is to MSSQL. To my knowledge, SQLDB does
 not
 change it.

 If you had been using parameters, it would have been a different story.


 Does matter if I use or not parameters.


 Yes, of course. In that case, SQLDB does some preprocessing of your SQL
 statement.

 This can easily be checked. Try setting ParamCheck to 'False' before
 executing your statement.

I don't have such problem because I have my own SQLdb wrapper and
params works a bit different.
Anyway, thanks (and sorry) for your time for help me.

Best regards,
Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread michael . vancanneyt



On Wed, 21 Mar 2012, Marcos Douglas wrote:


On Wed, Mar 21, 2012 at 3:34 AM, LacaK la...@zoznam.sk wrote:


create table #t (col1 int NULL, col2 varchar(60) NULL)

(MS SQL Server nullability is controled by database setting ANSI null
default so you can check this setting on your temp database also)
L.


Yes, of course... you're right.
I have this code that worked before so, I thought something broked.
I had tested before in a different machine with other installation of
MSSQL. My mistake, sorry.

If I find some problems I can post in bugtracker or still early to do this?
--
Michael, sorry for your time.


No problem.

I'm glad the problem turned out not to be in FPC, and that it is now solved
anyway. It means there is lots of useful expertise on these mailinglists :)

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-21 Thread LacaK




Yes, of course... you're right.
  

;-))


If I find some problems I can post in bugtracker or still early to do this?
  

IMO, You can post them also here.
Once Michael commits changes to fcl-db test suite I will run complete 
test suite and if any problems appears I will resolve them ASAP.

(Although I do not expect any bugs, because I already ran these tests)
L.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Marcos Douglas
On Fri, Mar 16, 2012 at 9:55 AM, Marcos Douglas m...@delfire.net wrote:
 On Fri, Mar 16, 2012 at 5:40 AM,  michael.vancann...@wisa.be wrote:


 On Thu, 15 Mar 2012, Marcos Douglas wrote:

 On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:

 On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:



 On Mon, 27 Feb 2012, LacaK wrote:

 Hi,
 let me share same basic info/ideas about TMSSQLConnection :
 1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
 provides native connector for MS SQL Servers and Sybase servers
 2. is depends/requires on FreeTDS open-source cross platform DB-Library
 (alternatively can be used also Microsoft db-library ntwdblib.dll)
 3. all what is needed are 2-3 files:
 - mssqlconn.pp (implementation of TMSSQLConnection and
 TSybaseConnection)
 - dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
 libsybdb.so on *NIX)
 - readme.txt (some info for users/developers)
 4. according to market share of MS SQL Server and Sybase there may be
 many
 users, which will welcome alternative to TODBCConnection
 5. there is on http://www.freepascal.org/future.var in Improve the
 database support  Drivers (descendants) for more database types so
 I
 understand it as FPC is open for new stuff ;-)
 6. if there is any problem please let us know. If you decide to include
 it
 into fcl-db then you can place files for example into src/sqldb/mssql
 folder
 ;-)



 I will have a look and include both units.


 And the dream will become true... Thanks Michael.
 Any chance to merge in fixes_2_6 in short time?

 Marcos Douglas


 Hi Michael,
 Do you have some prediction to include the sources?



 My apologies, I had totally forgotten; I am buried in work currently.

 Committed in revision 20522. I didn't commit any examples or tests. Please
 test if everything works OK. I compiled on Linux 64-bit, I don't have
 a working FPC/Lazarus 32-bit windows development environment currently.

 I will do tests.
 Thanks!

I found a bug
Consider the script:
create table #t (id int, name varchar(60))

If I execute:
insert table #t values (1, 'john')   OK

If I execute:
insert table #t (name) values ('john')   ERROR

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Michael Van Canneyt



On Tue, 20 Mar 2012, Marcos Douglas wrote:



Hi Michael,
Do you have some prediction to include the sources?




My apologies, I had totally forgotten; I am buried in work currently.

Committed in revision 20522. I didn't commit any examples or tests. Please
test if everything works OK. I compiled on Linux 64-bit, I don't have
a working FPC/Lazarus 32-bit windows development environment currently.


I will do tests.
Thanks!


I found a bug
Consider the script:
create table #t (id int, name varchar(60))

If I execute:
insert table #t values (1, 'john')   OK

If I execute:
insert table #t (name) values ('john')   ERROR


What is the error you get ?

Probably you need to quote name, as I imagine 'name' is a reserved word.

Michael.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Marcos Douglas
On Tue, Mar 20, 2012 at 4:00 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Tue, 20 Mar 2012, Marcos Douglas wrote:


 Hi Michael,
 Do you have some prediction to include the sources?




 My apologies, I had totally forgotten; I am buried in work currently.

 Committed in revision 20522. I didn't commit any examples or tests.
 Please
 test if everything works OK. I compiled on Linux 64-bit, I don't have
 a working FPC/Lazarus 32-bit windows development environment currently.


 I will do tests.
 Thanks!


 I found a bug
 Consider the script:
 create table #t (id int, name varchar(60))

 If I execute:
 insert table #t values (1, 'john')   OK

 If I execute:
 insert table #t (name) values ('john')   ERROR


 What is the error you get ?

 Probably you need to quote name, as I imagine 'name' is a reserved word.

No.
Anyway, I change the colum names (id,name to col1, col2)
The error is:
Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...

See the code (Insert2 procedure):

program t001;

{$mode objfpc}{$H+}

uses
  heaptrc, classes, sysutils, sqldb, fileutil, mssqlconn;

var
  tran: TSQLTransaction;
  conn: TMSSQLConnection;
  q: TSQLQuery;

procedure CreateTable;
begin
  q.Close;
  q.SQL.Text := 'create table #t (col1 int, col2 varchar(60))';
  q.ExecSQL;
end;

procedure Insert1;
begin
  q.Close;
  q.SQL.Text := 'insert into #t values (1, ''áéíç'')';
  q.ExecSQL;
end;

procedure Insert2;
begin
  q.Close;
  q.SQL.Text := 'insert into #t (col2) values (''áéíç'')';
  q.ExecSQL;
end;

procedure SelectAndShow;
var
  s: string;
begin
  q.Close;
  q.SQL.Text := 'select * from #t';
  q.Open;
  while not q.EOF do
  begin
s := q.FieldByName('col2').AsString;
writeln(UTF8ToConsole(s));
q.Next;
  end;
end;

procedure Update;
begin
  q.Close;
  q.SQL.Text := 'update #t set col2 = ''foo''';
  q.ExecSQL;
end;

{$R *.res}

begin
  tran := TSQLTransaction.Create(nil);
  conn := TMSSQLConnection.Create(nil);
  q := TSQLQuery.Create(nil);
  try
conn.Transaction := tran;
q.DataBase := conn;

conn.HostName := 'localhost';
conn.DatabaseName := 'DbTest';
conn.UserName := 'test';
conn.Password := '123';
conn.CharSet := 'UTF-8';
conn.Connected := True;

CreateTable;

Insert1;
SelectAndShow;

Insert2; //  ERROR here
SelectAndShow;

tran.Commit;
tran.StartTransaction;
try
  Update;
  tran.Commit;
except
  tran.Rollback;
  raise;
end;

SelectAndShow;

writeln('Done');
  finally
q.Free;
conn.Free;
tran.Free;
  end;

end.


Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Marcos Douglas
On Tue, Mar 20, 2012 at 5:57 PM, silvioprog silviop...@gmail.com wrote:
 This error occurs to me too. Please see this video:

 http://silvioprog.com.br/video/bug/sqldb

 Lazarus 0.9.30.4 r35940 FPC 2.6.0 i386-win32-win32/win64 + openSUSE 12
 / Windows 7 + PQConnection + PostgreSQL 8.4.

Silvio,
Thanks for the video... but I think did you wanted to post in this thread:
http://lists.freepascal.org/lists/fpc-pascal/2012-March/032845.html

Am I right?  ;-)

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread silvioprog
2012/3/20 Marcos Douglas m...@delfire.net:
 On Tue, Mar 20, 2012 at 5:57 PM, silvioprog silviop...@gmail.com wrote:
 This error occurs to me too. Please see this video:

 http://silvioprog.com.br/video/bug/sqldb

 Lazarus 0.9.30.4 r35940 FPC 2.6.0 i386-win32-win32/win64 + openSUSE 12
 / Windows 7 + PQConnection + PostgreSQL 8.4.

 Silvio,
 Thanks for the video... but I think did you wanted to post in this thread:
 http://lists.freepascal.org/lists/fpc-pascal/2012-March/032845.html

 Am I right?  ;-)

 Marcos Douglas

Oops, I confused the link, sorry. ^^'

-- 
Silvio Clécio

Site - silvioprog.com.br
LazSolutions - code.google.com/p/lazsolutions
LazWebSolutions - github.com/silvioprog/lazwebsolutions

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Michael Van Canneyt



On Tue, 20 Mar 2012, Marcos Douglas wrote:



No.
Anyway, I change the colum names (id,name to col1, col2)
The error is:
Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...


This error has nothing to do with FPC or SQLDB.

Your SQL statement is trying to insert NULL in a required field.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Marcos Douglas
On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Tue, 20 Mar 2012, Marcos Douglas wrote:


 No.
 Anyway, I change the colum names (id,name to col1, col2)
 The error is:
 Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...


 This error has nothing to do with FPC or SQLDB.

 Your SQL statement is trying to insert NULL in a required field.

No Michael, see the example I wrote before.

Create table:
create table #t (col1 int, col2 varchar(60))

OBS: No column is required.

This INSERT works:
insert into #t values (1, 'bla bla bla')

This INSERT do NOT works:
insert into #t (col2) values ('bla bla')

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread michael . vancanneyt



On Tue, 20 Mar 2012, Marcos Douglas wrote:


On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
mich...@freepascal.org wrote:



On Tue, 20 Mar 2012, Marcos Douglas wrote:



No.
Anyway, I change the colum names (id,name to col1, col2)
The error is:
Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...



This error has nothing to do with FPC or SQLDB.

Your SQL statement is trying to insert NULL in a required field.


No Michael, see the example I wrote before.


I saw the example :-)



Create table:
create table #t (col1 int, col2 varchar(60))

OBS: No column is required.

This INSERT works:
insert into #t values (1, 'bla bla bla')

This INSERT do NOT works:
insert into #t (col2) values ('bla bla')


This kind of SQL is passed as-is to MSSQL. To my knowledge, SQLDB does not 
change it.

If you had been using parameters, it would have been a different story.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-20 Thread Marcos Douglas
On Tue, Mar 20, 2012 at 8:12 PM,  michael.vancann...@wisa.be wrote:


 On Tue, 20 Mar 2012, Marcos Douglas wrote:

 On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
 mich...@freepascal.org wrote:



 On Tue, 20 Mar 2012, Marcos Douglas wrote:


 No.
 Anyway, I change the colum names (id,name to col1, col2)
 The error is:
 Cannot insert the value NULL into column 'col', table tempdb.dbo.#t...



 This error has nothing to do with FPC or SQLDB.

 Your SQL statement is trying to insert NULL in a required field.


 No Michael, see the example I wrote before.


 I saw the example :-)



 Create table:
 create table #t (col1 int, col2 varchar(60))

 OBS: No column is required.

 This INSERT works:
 insert into #t values (1, 'bla bla bla')

 This INSERT do NOT works:
 insert into #t (col2) values ('bla bla')


 This kind of SQL is passed as-is to MSSQL. To my knowledge, SQLDB does not
 change it.

 If you had been using parameters, it would have been a different story.

Does matter if I use or not parameters.

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-19 Thread LacaK

michael.vancann...@wisa.be  wrote / napísal(a):



On Thu, 15 Mar 2012, Marcos Douglas wrote:


On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:

On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:



On Mon, 27 Feb 2012, LacaK wrote:


Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class 
and

provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform 
DB-Library

(alternatively can be used also Microsoft db-library ntwdblib.dll)
3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and 
TSybaseConnection)

- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
libsybdb.so on *NIX)
- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may 
be many

users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in Improve the
database support  Drivers (descendants) for more database 
types so I

understand it as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to 
include it
into fcl-db then you can place files for example into 
src/sqldb/mssql folder

;-)



I will have a look and include both units.


And the dream will become true... Thanks Michael.
Any chance to merge in fixes_2_6 in short time?

Marcos Douglas


Hi Michael,
Do you have some prediction to include the sources?



My apologies, I had totally forgotten; I am buried in work currently.

Committed in revision 20522. I didn't commit any examples or tests. 
Please test if everything works OK. I compiled on Linux 64-bit, I 
don't have

a working FPC/Lazarus 32-bit windows development environment currently.

Hi Michael,
splitting files into two packages was unavoidable?
I would prefer If all 3 files will be in one folder (sqldb/mssql) 
together (it seems to me simpler and more convenient).

(because they are strongly related each to other)
Thanks
-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-19 Thread michael . vancanneyt



On Mon, 19 Mar 2012, LacaK wrote:


michael.vancann...@wisa.be  wrote / napísal(a):



On Thu, 15 Mar 2012, Marcos Douglas wrote:


On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:

On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:



On Mon, 27 Feb 2012, LacaK wrote:


Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library
(alternatively can be used also Microsoft db-library ntwdblib.dll)
3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and 
TSybaseConnection)

- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
libsybdb.so on *NIX)
- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be 
many

users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in Improve the
database support  Drivers (descendants) for more database types so 
I

understand it as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include 
it
into fcl-db then you can place files for example into src/sqldb/mssql 
folder

;-)



I will have a look and include both units.


And the dream will become true... Thanks Michael.
Any chance to merge in fixes_2_6 in short time?

Marcos Douglas


Hi Michael,
Do you have some prediction to include the sources?



My apologies, I had totally forgotten; I am buried in work currently.

Committed in revision 20522. I didn't commit any examples or tests. Please 
test if everything works OK. I compiled on Linux 64-bit, I don't have

a working FPC/Lazarus 32-bit windows development environment currently.

Hi Michael,
splitting files into two packages was unavoidable?


Yes.

As you can see for the other databases, we always keep the header imports 
separate from the components. Standard time-tested practice.


Michael.___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-19 Thread LacaK



Hi Michael,
splitting files into two packages was unavoidable?


Yes.

As you can see for the other databases, we always keep the header 
imports separate from the components. Standard time-tested practice.



Hm, although I am not happy with this, I can do nothing with it ;-)
Then I have minor comments:
- in packages/dblib/fpmake.pp at line 23: Author put please instead of 
Lacak2 Ladislav Karrach (as in dblib.pp header)
- in packages/fcl-db/src/sqldb/mssql/makefile.fpc at line 2: change 
IBConnection to MSSQLConnection ;-)


And will you apply also diffs to fcl-db tests ? So we can run complete 
test suite ...

Thanks
-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-19 Thread michael . vancanneyt



On Mon, 19 Mar 2012, LacaK wrote:




Hi Michael,
splitting files into two packages was unavoidable?


Yes.

As you can see for the other databases, we always keep the header imports 
separate from the components. Standard time-tested practice.



Hm, although I am not happy with this, I can do nothing with it ;-)
Then I have minor comments:
- in packages/dblib/fpmake.pp at line 23: Author put please instead of 
Lacak2 Ladislav Karrach (as in dblib.pp header)
- in packages/fcl-db/src/sqldb/mssql/makefile.fpc at line 2: change 
IBConnection to MSSQLConnection ;-)


Done. Rev. 20540 and 20541.



And will you apply also diffs to fcl-db tests ? So we can run complete test 
suite ...


I will do so later today.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-16 Thread michael . vancanneyt



On Thu, 15 Mar 2012, Marcos Douglas wrote:


On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:

On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:



On Mon, 27 Feb 2012, LacaK wrote:


Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library
(alternatively can be used also Microsoft db-library ntwdblib.dll)
3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
libsybdb.so on *NIX)
- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be many
users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in Improve the
database support  Drivers (descendants) for more database types so I
understand it as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include it
into fcl-db then you can place files for example into src/sqldb/mssql folder
;-)



I will have a look and include both units.


And the dream will become true... Thanks Michael.
Any chance to merge in fixes_2_6 in short time?

Marcos Douglas


Hi Michael,
Do you have some prediction to include the sources?



My apologies, I had totally forgotten; I am buried in work currently.

Committed in revision 20522. I didn't commit any examples or tests. 
Please test if everything works OK. I compiled on Linux 64-bit, I don't have

a working FPC/Lazarus 32-bit windows development environment currently.

Michael.___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-16 Thread Marcos Douglas
On Fri, Mar 16, 2012 at 5:40 AM,  michael.vancann...@wisa.be wrote:


 On Thu, 15 Mar 2012, Marcos Douglas wrote:

 On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:

 On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:



 On Mon, 27 Feb 2012, LacaK wrote:

 Hi,
 let me share same basic info/ideas about TMSSQLConnection :
 1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
 provides native connector for MS SQL Servers and Sybase servers
 2. is depends/requires on FreeTDS open-source cross platform DB-Library
 (alternatively can be used also Microsoft db-library ntwdblib.dll)
 3. all what is needed are 2-3 files:
 - mssqlconn.pp (implementation of TMSSQLConnection and
 TSybaseConnection)
 - dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
 libsybdb.so on *NIX)
 - readme.txt (some info for users/developers)
 4. according to market share of MS SQL Server and Sybase there may be
 many
 users, which will welcome alternative to TODBCConnection
 5. there is on http://www.freepascal.org/future.var in Improve the
 database support  Drivers (descendants) for more database types so
 I
 understand it as FPC is open for new stuff ;-)
 6. if there is any problem please let us know. If you decide to include
 it
 into fcl-db then you can place files for example into src/sqldb/mssql
 folder
 ;-)



 I will have a look and include both units.


 And the dream will become true... Thanks Michael.
 Any chance to merge in fixes_2_6 in short time?

 Marcos Douglas


 Hi Michael,
 Do you have some prediction to include the sources?



 My apologies, I had totally forgotten; I am buried in work currently.

 Committed in revision 20522. I didn't commit any examples or tests. Please
 test if everything works OK. I compiled on Linux 64-bit, I don't have
 a working FPC/Lazarus 32-bit windows development environment currently.

I will do tests.
Thanks!

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-03-15 Thread Marcos Douglas
On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas m...@delfire.net wrote:
 On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:


 On Mon, 27 Feb 2012, LacaK wrote:

 Hi,
 let me share same basic info/ideas about TMSSQLConnection :
 1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
 provides native connector for MS SQL Servers and Sybase servers
 2. is depends/requires on FreeTDS open-source cross platform DB-Library
 (alternatively can be used also Microsoft db-library ntwdblib.dll)
 3. all what is needed are 2-3 files:
 - mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
 - dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
 libsybdb.so on *NIX)
 - readme.txt (some info for users/developers)
 4. according to market share of MS SQL Server and Sybase there may be many
 users, which will welcome alternative to TODBCConnection
 5. there is on http://www.freepascal.org/future.var in Improve the
 database support  Drivers (descendants) for more database types so I
 understand it as FPC is open for new stuff ;-)
 6. if there is any problem please let us know. If you decide to include it
 into fcl-db then you can place files for example into src/sqldb/mssql folder
 ;-)


 I will have a look and include both units.

 And the dream will become true... Thanks Michael.
 Any chance to merge in fixes_2_6 in short time?

 Marcos Douglas

Hi Michael,
Do you have some prediction to include the sources?

Thanks,
Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread LacaK

Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and 
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library 
(alternatively can be used also Microsoft db-library ntwdblib.dll)

3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows, 
libsybdb.so on *NIX)

- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be 
many users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in Improve the 
database support  Drivers (descendants) for more database types so I 
understand it as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include 
it into fcl-db then you can place files for example into src/sqldb/mssql 
folder ;-)

TIA
-Laco.

Hi,

As you can see here http://bugs.freepascal.org/view.php?id=17303 the
developer known to LacaK developed a new connector for MSSQLServer,
descendant of TSQLConnection class, and sent the beta code in
2010-08-30.

Some developers discussed the new code here:
http://lazarus.freepascal.org/index.php/topic,15135.msg80922.html#msg80922

I'm already using this connector in production without problems.

To FPC core team:
Could you take a look in that component and think about included this
code in SVN to new developers use too, please?

Thanks,
Marcos Douglas

PS: this message was posted in lazarus-list and fpc-pascal, but I was
wrong because nobody answer me about YES or NOT. So, I think this is
the right list, don't?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

  


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread michael . vancanneyt



On Mon, 27 Feb 2012, LacaK wrote:


Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and 
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library 
(alternatively can be used also Microsoft db-library ntwdblib.dll)

3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows, 
libsybdb.so on *NIX)

- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be many 
users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in Improve the database 
support  Drivers (descendants) for more database types so I understand it 
as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include it 
into fcl-db then you can place files for example into src/sqldb/mssql folder 
;-)


I will have a look and include both units.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread Marcos Douglas
On Mon, Feb 27, 2012 at 5:08 AM,  michael.vancann...@wisa.be wrote:


 On Mon, 27 Feb 2012, LacaK wrote:

 Hi,
 let me share same basic info/ideas about TMSSQLConnection :
 1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
 provides native connector for MS SQL Servers and Sybase servers
 2. is depends/requires on FreeTDS open-source cross platform DB-Library
 (alternatively can be used also Microsoft db-library ntwdblib.dll)
 3. all what is needed are 2-3 files:
 - mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
 - dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
 libsybdb.so on *NIX)
 - readme.txt (some info for users/developers)
 4. according to market share of MS SQL Server and Sybase there may be many
 users, which will welcome alternative to TODBCConnection
 5. there is on http://www.freepascal.org/future.var in Improve the
 database support  Drivers (descendants) for more database types so I
 understand it as FPC is open for new stuff ;-)
 6. if there is any problem please let us know. If you decide to include it
 into fcl-db then you can place files for example into src/sqldb/mssql folder
 ;-)


 I will have a look and include both units.

And the dream will become true... Thanks Michael.
Any chance to merge in fixes_2_6 in short time?

Marcos Douglas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel