Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-02

TMSSQLConnection - sqlDB component for accessing MS SQL Server

34 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

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?

Reply by email

LacaK
to Marcos Douglas

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.

Show quoted text 27 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Unknown author
to LacaK
LacaK wrote 19 lines
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.

Reply by email

Marcos Douglas
to Unknown author
Show quoted text 26 lines
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

Reply by email

Marcos Douglas
to Marcos Douglas
Marcos Douglas wrote 32 lines
On Mon, Feb 27, 2012 at 5:08 AM,   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

Reply by email

Unknown author
to Marcos Douglas
Marcos Douglas wrote 36 lines
On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas wrote: > On Mon, Feb 27, 2012 at 5:08 AM,   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.

Reply by email

Marcos Douglas
to Unknown author
Show quoted text 58 lines
On Thu, 15 Mar 2012, Marcos Douglas wrote: > On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas wrote: >> >> On Mon, Feb 27, 2012 at 5:08 AM,   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

Reply by email

LacaK
to Unknown author: My apologies, I had totally forgotten; I am buried in work currently. Committed in…

wrote / napísal(a):

Show quoted text 55 lines
On Thu, 15 Mar 2012, Marcos Douglas wrote: > On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas wrote: >> On Mon, Feb 27, 2012 at 5:08 AM, 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.

Reply by email

Unknown author
to LacaK
LacaK wrote 55 lines
wrote / napísal(a): > > > On Thu, 15 Mar 2012, Marcos Douglas wrote: > >> On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas wrote: >>> On Mon, Feb 27, 2012 at 5:08 AM, 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.

Reply by email

LacaK
to Unknown author
Show quoted text 8 lines
> 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.

Reply by email

Unknown author
to LacaK
LacaK wrote 15 lines
>> 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.

Reply by email

Marcos Douglas
to Marcos Douglas: I will do tests. Thanks! Marcos Douglas
Marcos Douglas wrote 62 lines
On Fri, Mar 16, 2012 at 5:40 AM,   wrote: > > > On Thu, 15 Mar 2012, Marcos Douglas wrote: > >> On Mon, Feb 27, 2012 at 9:33 AM, Marcos Douglas wrote: >>> >>> On Mon, Feb 27, 2012 at 5:08 AM,   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

Reply by email

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 24 lines
>>> >>> 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.

Reply by email

Marcos Douglas
to Michael Van Canneyt
Michael Van Canneyt wrote 37 lines
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

Reply by email

silvioprog
to Marcos Douglas

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 Clécio ============================================ Site - <silvioprog.com.br> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <github.com/silvioprog/lazwebsolutions> ============================================

Reply by email

silvioprog
to Marcos Douglas

2012/3/20 Marcos Douglas :

Show quoted text 15 lines
On Tue, Mar 20, 2012 at 5:57 PM, silvioprog 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> ============================================

Reply by email

Marcos Douglas
to Michael Van Canneyt
Michael Van Canneyt wrote 14 lines
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

Reply by email

Unknown author
to Marcos Douglas
Marcos Douglas wrote 18 lines
On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt 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 :-)

Show quoted text 11 lines
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.

Reply by email

Marcos Douglas
to Unknown author
Show quoted text 47 lines
On Tue, 20 Mar 2012, Marcos Douglas wrote: > On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt > 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

Reply by email

LacaK
to Marcos Douglas: On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt No Michael, see the example I wrote…
Show quoted text 25 lines
> >> 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.*
*

Reply by email

Unknown author
to Marcos Douglas: Does matter if I use or not parameters. Marcos Douglas
Marcos Douglas wrote 50 lines
On Tue, Mar 20, 2012 at 8:12 PM, wrote: > > > On Tue, 20 Mar 2012, Marcos Douglas wrote: > >> On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt >> 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.

Reply by email

LacaK
to Unknown author: Done. Rev. 20540 and 20541. I will do so later today. Michael.
Show quoted text 8 lines
> > 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)

Show quoted text 6 lines
> > And will you apply also diffs to fcl-db tests ? So we can run > complete test suite ... I will do so later today.

;-)

-Laco.

Reply by email

Marcos Douglas
to LacaK: Marcos, can you please test with explicitly allowed nulls: create table #t (col1 int…
LacaK wrote 36 lines
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

Reply by email

Marcos Douglas
to Unknown author: Yes, of course. In that case, SQLDB does some preprocessing of your SQL statement. This…
Show quoted text 70 lines
On Tue, 20 Mar 2012, Marcos Douglas wrote: > On Tue, Mar 20, 2012 at 8:12 PM,   wrote: >> >> >> >> On Tue, 20 Mar 2012, Marcos Douglas wrote: >> >>> On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt >>> 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

Reply by email

Unknown author
to Marcos Douglas: Yes, of course... you're right. I have this code that worked before so, I thought…
Marcos Douglas wrote 16 lines
On Wed, Mar 21, 2012 at 3:34 AM, LacaK 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.

Reply by email

Marcos Douglas
to Unknown author
Show quoted text 25 lines
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

Reply by email

LacaK
to Unknown author: Done, rev. 20572. Sorry for the delay. Michael.
Show quoted text 6 lines
> 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.

Reply by email

LacaK
to Unknown author: Done, rev. 20572. Sorry for the delay. Michael.
Show quoted text 7 lines
> 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.
Last IMHO unresolved thing is fcl-db/fpmake.pp as I wrote yesterday. Thanks
-Laco.

Reply by email