You are not logged in.
Pages: 1
I followed ab's reply above and added some test code that I explored .
FHttpServer := TRestHttpServer.Create(APort, [FRestServer], '+', HTTP_DEFAULT_MODE, 32, secNone, '/' {aAdditionalUrl});
FHttpServer.Route.Rewrite(urmGet, '/', urmGet, '/myApi/myService/getTime');
TOrmModel.Create([TPerson], 'API'); // API/SampleService
SQL statement in case of failure to run in the IDE
declare @p1 int
set @p1=1
exec sp_prepexec @p1 output,NULL,N'select COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, 0 INDEX_COUNT from INFORMATION_SCHEMA.COLUMNS where UPPER(TABLE_SCHEMA) = ''DBO'' and UPPER(TABLE_NAME) = ''PERSON'''
select @p1
go
exec sp_unprepare 1
go
exec [sys].sp_columns_100 N'PERSON',N'DBO',NULL,NULL,@ODBCVer=3,@fUsePattern=1
go
exec [sys].sp_columns_100 N'PERSON',N'%',NULL,NULL,@ODBCVer=3,@fUsePattern=1
go
I'm sorry that I can't provide pictures, so I have to paste SQL log statements.
declare @p1 int
declare @p1 int
set @p1=1
exec sp_prepexec @p1 output,NULL,N'select COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, 0 INDEX_COUNT from INFORMATION_SCHEMA.COLUMNS where UPPER(TABLE_SCHEMA) = ''DBO'' and UPPER(TABLE_NAME) = ''PERSON'''
select @p1
go
exec sp_unprepare 1
go
exec [sys].sp_columns_100 N'PERSON',N'DBO',NULL,NULL,@ODBCVer=3,@fUsePattern=1
go
exec [sys].sp_columns_100 N'PERSON',N'%',NULL,NULL,@ODBCVer=3,@fUsePattern=1
go
declare @p1 int
set @p1=2
exec sp_prepexec @p1 output,NULL,N'CREATE TABLE dbo.Person (ID bigint NOT NULL PRIMARY KEY,Name nvarchar(max),Age bigint)'
select @p1
go
declare @p1 int
set @p1=3
exec sp_prepexec @p1 output,NULL,N'select COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, 0 INDEX_COUNT from INFORMATION_SCHEMA.COLUMNS where UPPER(TABLE_SCHEMA) = ''DBO'' and UPPER(TABLE_NAME) = ''PERSON'''
select @p1
go
exec sp_unprepare 3
go
exec sp_unprepare 2
go
declare @p1 int
set @p1=4
exec sp_prepexec @p1 output,NULL,N'select top(1) ID from dbo.Person'
select @p1
go
declare @p1 int
set @p1=5
exec sp_prepexec @p1 output,N'@P1 varchar(max)',N'select ID from dbo.Person where ID=@P1','1'
select @p1
go
exec sp_unprepare 4
go
exec sp_unprepare 5
go
Hi ab, thanks for your reply. The situation is as follows.
//-------------------------------------------------
Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) Express Edition (64-bit) on Windows 10 <X64>
ODBC Driver 18.3 for SQL Server
//-------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
begin
var dbcon := TSqlDBOdbcConnectionProperties.Create('123', '', '', '');
var model := TOrmModel.Create([TPerson]);
OrmMapExternal(model, model.Tables, dbcon);
var server := TRestServerDB.Create(model, ':memory:');
server.CreateMissingTables();
dbcon.Free;
model.Free;
server.Free;
end;
I get the same error message, but only in debug mode. Execution out of the IDE is no problem.
Pages: 1