Warning: Table '.\dcgforum\cache_page' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache_page WHERE cid = 'http://forums.dataphor.org/index.php?q=node/5' in C:\Sites\DCGForum\includes\database.mysql.inc on line 172
Defaults and nil (again) | Dataphor Forums

Defaults and nil (again)

I have a String-like type with default "" (empty string). Is it possible to have a column of this type with default nil, or will the type default always override it?

Seems to work

Hi Jon,

Based on my testing, this works, both in D4 directly, and when the table is accessed via a derived form:

create type TestString like String { default "" };

create table TestStringTable
{
ID : Integer,
TestString : TestString nil { default nil },
key { ID }
};

insert row { 1 ID } into TestStringTable;

select TestStringTable;

Bryn Rhodes
Database Consulting Group LLC

Not on my system

I should have been more specific: Such an insert does work correctly, but when I browse the table in the Frontend, and Add a row, the TestString TextBox is empty/blank, not nil (while the ID field is correctly nil). And thus, of course, if the TestString field is not touched, an empty string will be inserted. Does this work differently on your system, since you say it works "when the table is accessed via a derived form"?

Reproduced

I'm sorry, I should have tried this out-of-process. In-process it works. Unfortunately, the problem is a client-side catalog serialization issue which will require a code-change to fix. I will continue to look into this to see if I can find an alternate work-around.

Bryn Rhodes
Database Consulting Group LLC


Warning: Table '.\dcgforum\watchdog' is marked as crashed and should be repaired query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;.\\dcgforum\\cache_page&amp;#039; is marked as crashed and should be repaired\nquery: LOCK TABLES cache_page WRITE</em> in <em>C:\\Sites\\DCGForum\\includes\\database.mysql.inc</em> on line <em>172</em>.', 2, '', 'http://forums.dataphor.org/index.php?q=node/5', '', '54.196.190.32', 1542385528) in C:\Sites\DCGForum\includes\database.mysql.inc on line 172

Warning: Table '.\dcgforum\watchdog' is marked as crashed and should be repaired query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;.\\dcgforum\\cache_page&amp;#039; is marked as crashed and should be repaired\nquery: UPDATE cache_page SET data = &amp;#039;\\0\\0\\0\\0\\0\\0Yn6 *.V+94.^ D\\&amp;quot;zC=N䆤ծwKs\\rK?f!=1ON!q?&amp;gt;&amp;lt;6I}VGIX,yr,rFneӌ_6F&amp;amp;U)n0w^XIG|\\Z1Aך9擂[ض\\n6;a5@$!9KN%U4&amp;lt;Q.$ +%(1{SiteˊEidٕMh!-6NkŇ$4 \\&amp;#039;8.,FI3IN4nȥ#|/IΒ8B^8c53\\01r2^VTvL?nI≠C,eeB\\&amp;quot;\\ra?nX|$&amp;lt;o\\\\ݧ}\\nI[rCħ .*tK4uSf. _Dqg ,&amp;gt;j?AGǀ in C:\Sites\DCGForum\includes\database.mysql.inc on line 172

Warning: Table '.\dcgforum\watchdog' is marked as crashed and should be repaired query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Incorrect string value: &amp;#039;\\x8B\\x08\\0\\0...&amp;#039; for column &amp;#039;session&amp;#039; at row 1\nquery: INSERT INTO sessions (sid, uid, cache, hostname, session, timestamp) VALUES (&amp;#039;1kq1vj3kfk3bsfvrnh7bmgd0m6&amp;#039;, 0, 0, &amp;#039;54.196.190.32&amp;#039;, &amp;#039;messages|a:1:{s:5:\\&amp;quot;error\\&amp;quot;;a:2:{i:0;s:195:\\&amp;quot;user warning: Table &amp;amp;#039;.\\\\dcgforum\\\\cache_page&amp;amp;#039; is marked as crashed and should be repaired\\nquery: LOCK TABLES cache_page WRITE in C:\\\\Sites\\\\DCGForum\\\\includes\\\\database.mysql.inc on line 172.\\&amp;quot;;i:1;s:2802:\\&amp;quot;user warning: Table &amp;amp;#039;.\\\\dcgforum\\\\cache_page&amp;amp;#039; is mark in C:\Sites\DCGForum\includes\database.mysql.inc on line 172