Tuesday, November 13, 2007

Build 165

This build contains all samples I've shown in the past weeks at Southwest Fox 2007 and the German DevCon 2007 in Frankfurt. Here's a brief overview on what has changed:

Guineu.sql.dll is a new runtime for Microsoft SQL Server 2005. It can be used to create stored procedures and functions for SQL Server with Guineu. The runtime supports only a subset of the other Guineu runtimes. In particular, it doesn't support any user interface controls such as forms, and the like. The classes work mostly, but you won't see anything. Because this still requires some manual work on the sources, the SQL runtime is not as far as the other two runtimes, yet. I'll work on making the required changes to generate the SQL runtime from the latest version automatically.

The new SQL runtime is used by the SQL 2005 Stored Procedure target that creates an assembly for SQL server and a SQL script to load the assembly into the database. If SQL Management Studio 2005 is installed on your computer, it's automatically launched when you build the project to let you deploy the new version of your library. Currently support for SQL has some limitations. Stored Procedures and Functions cannot receive any parameters and return only numeric or string values. Let me know if you need anything different.

To install stored procedures on SQL 2005 servers you need to perform some configuration. Please note that Guineu requires opening up SQL server 2005 quite a bit in order to run assemblies. You DBA might not like this, so make sure you check before writing too much code. Also, do not install Guineu on any production server. These steps are required to enable Guineu on a SQL server using Northwind as the sample database:

  1. Activate the CLR:

    sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO
    sp_configure 'clr enabled', 1;
    GO
    RECONFIGURE;
    GO

  2. Change the compatibility level:

    use master
    go
    exec sp_dbcmptlevel 'northwind', 90
    go

  3. Enable full trust:

    ALTER DATABASE northwind SET TRUSTWORTHY ON

StoredProcedures is a sample project that demonstrates how you can use the context database engine to retrieve data from the database. Even though this code looks like it's going through ODBC it's actually accessing SQL server locally.

Deployment of mobile applications requires one more new DLL: OpenNETCF.dll. You must copy this DLL along with your mobile application and Guineu.compact.dll.

ActiveX Control is a new target in GuineuIDE. It compiles all visual classes stored in VCXes into ActiveX controls and creates a sample HTML page that loads this ActiveX control in Internet Explorer (or your preferred browser if it supports ActiveX controls). You can use these controls in other applications, as well. Right now, ActiveX support has some limitations, though:

  • You can only load one ActiveX control per process. If you have multiple controls currently you must use multiple projects and create multiple DLLs.
  • No methods are made available publically. You can add controls, but you can't access them from the outside.
  • There is a problem in hosting Guineu ActiveX controls inside Visual FoxPro forms.

ActiveX is a sample project that demonstrates a simple ActiveX control with a DBF file. Please note that all tables must be on the local machine that executes the ActiveX control.

Managed Library is similar to the ActiveX Control build target. However, it doesn't generate any COM InterOp code which makes the component only available to managed applications. You can use this library to add controls to a WinForm application, for instance. In the current release, Guineu Managed Libraries do not have designer support. That means, you need to create the control in code and add it to the Controls collection of the form. You can use the ActiveX sample project to create managed libraries, as well.

CompactDatabase is a new sample that demonstrates how you can access Microsoft SQL Server 2005 Compact Edition. This version of SQL server can be deployed by just copying some DLL files and the database file. You don't have to install any server or attach any database. The compact database file can be up to 4 GB in size. The engine runs on mobile devices and Windows desktops.


 

No comments: