[TYPO3] Typo3 / DBAL / ADODB / MSSQL: Violation of primary Key

SassoNet - Stefan Gruendel info at sassonet.de
Fri Jun 9 11:20:19 CEST 2006


Tristan, Martin, Karsten, 

first of all thanks for all your remarks so far. I am trying to clarify some
things you asked for / mentioned:

> What does your connection string look like?

I am connecting to the MSSQL server using the pipe name (name of pipe is
"PIPE_SQL_INTRANET"). I am entering this pipe name as host within the
installation tool of typo3, and typo3 connects to this server and the
selected database fine (without any warning/error messages).

> did you set you database access to utf8?

I am not sure where to do this. I am not a real expert in MSSQL
administration. I have made some PHP applications working together with the
same MSSQL server but there was never the need to get deeper into the MSSQL
administration stuff. It would be nice if you could give me a hint what to
check or change here.

> Can you enable the DBAL (query) logging?
> Try to find the INSERT statement that produces the error.

I have enabled the debug mode in DBAL and have found the following SQL
statement in the table tx_dbal_debuglog (this is the last INSERT INTO
cache_hash statement that can be found in that table):

INSERT INTO "cache_hash"
				(
					"hash",
					"content",
					"ident",
					"tstamp"
				) VALUES (
					'1a72ae4ad2a532804d40be11df1e3fae',
					null,
					'SHORT TC',
					'1149841058'
				) WITH 1 BLOB FIELDS: "content"
				

The log table has captured 25 SQL statements thereafter (according to the
uid number) which are these:

				
SELECT  top 1 *
			FROM "sys_template"
			WHERE
				 "pid" = 2 AND "deleted" = 0 AND "hidden" =
0 AND ("starttime" <= 1149841056) AND ("endtime" = 0 OR "endtime" >
1149841056)
			ORDER BY "sorting"
			
SELECT "content"
			FROM "cache_pagesection"
			WHERE
				 "page_id" = 2 AND "mpvar_hash" = 222419149
				 
SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 54

SELECT  top 1 *
			FROM "sys_template"
			WHERE
				 "pid" = 2 AND "deleted" = 0 AND "hidden" =
0 AND ("starttime" <= 1149841057) AND ("endtime" = 0 OR "endtime" >
1149841057)
			ORDER BY "sorting"

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 23

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 54

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 23

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 43

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 43

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 45

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 46

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 45

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 44

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 46

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 68

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 44

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 57

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 68

SELECT "content"
			FROM "cache_hash"
			WHERE
				 "hash" = '3e7cec8583620e9c3476b59035a50550'

SELECT *
			FROM "static_template"
			WHERE
				 "uid" = 57

DELETE FROM "cache_pagesection"
				WHERE
					 "page_id" = 2 AND "mpvar_hash" =
222419149

SELECT "content"
			FROM "cache_hash"
			WHERE
				 "hash" = '3e7cec8583620e9c3476b59035a50550'

INSERT INTO "cache_pagesection"
				(
					"page_id",
					"mpvar_hash",
					"content",
					"tstamp"
				) VALUES (
					'2',
					'222419149',
					null,
					'1149841056'
				) WITH 1 BLOB FIELDS: "content"
				
DELETE FROM "cache_pagesection"
				WHERE
					 "page_id" = 2 AND "mpvar_hash" =
222419149

INSERT INTO "cache_pagesection"
				(
					"page_id",
					"mpvar_hash",
					"content",
					"tstamp"
				) VALUES (
					'2',
					'222419149',
					null,
					'1149841057'
				) WITH 1 BLOB FIELDS: "content"


> That would mean you cannot work at all (just try creating more than one
pages or content elements).

I can create more pages or more content elements without any problems. The
message appears only when I try to view the results as front end web site.

I hope this gives some more hints of what goes wrong here. Thanks,

Stefan






More information about the TYPO3-english mailing list