Files changed (1) hide show
  1. index.html +7 -5
index.html CHANGED
@@ -246,12 +246,12 @@ function parseTeradata(ddl) {
246
  const head = src.slice(0, 512).toUpperCase();
247
 
248
  // Kind detection
249
- if (/CREATE\s+VIEW/i.test(src)) out.kind = 'view';
250
  else if (/CREATE\s+(MULTISET|SET)?\s*VOLATILE\s+TABLE/i.test(src)) out.kind = 'volatile';
251
  else if (/CREATE\s+(MULTISET|SET)?\s*TABLE/i.test(src)) out.kind = 'table';
252
 
253
  // Name
254
- const nameMatch = src.match(/CREATE\s+(?:MULTISET|SET)?\s*(?:VOLATILE\s+)?(?:TABLE|VIEW)\s+([A-Za-z0-9_$."]+)/i);
255
  if (nameMatch) {
256
  const fq = nameMatch[1].replace(/"/g,'');
257
  out.fqName = fq;
@@ -345,8 +345,10 @@ function toDatabricks(out, targetNs, targetName, choice, opts) {
345
  if (out.kind === 'view' || choice === 'view') {
346
  // Attempt to capture SELECT
347
  const selMatch = out.raw.match(/AS\s+([\s\S]+)$/i);
348
- const selectSql = selMatch ? selMatch[1].trim().replace(/;+\s*$/,'') : '-- TODO: Provide SELECT body';
349
- why.push(`- Object is a VIEW → emitting CREATE VIEW IF NOT EXISTS with original SELECT (light syntax normalization only).`);
 
 
350
  const sql = `CREATE VIEW IF NOT EXISTS ${fqTarget} AS
351
  ${selectSql};`;
352
  return { sql, why, detected:`VIEW (${out.fqName||out.name||''})`, recommendation:'VIEW' };
@@ -449,7 +451,7 @@ let detectedName = '';
449
 
450
  function autoDetectFromDDL() {
451
  const ddl = el('input').value;
452
- const m = ddl.match(/CREATE\s+(?:MULTISET|SET)?\s*(?:VOLATILE\s+)?(?:TABLE|VIEW)\s+([A-Za-z0-9_$."]+)/i);
453
  if (m) {
454
  const fq = m[1].replace(/"/g,'');
455
  const parts = fq.split('.');
 
246
  const head = src.slice(0, 512).toUpperCase();
247
 
248
  // Kind detection
249
+ if (/(?:CREATE|REPLACE)\s+VIEW/i.test(src)) out.kind = 'view';
250
  else if (/CREATE\s+(MULTISET|SET)?\s*VOLATILE\s+TABLE/i.test(src)) out.kind = 'volatile';
251
  else if (/CREATE\s+(MULTISET|SET)?\s*TABLE/i.test(src)) out.kind = 'table';
252
 
253
  // Name
254
+ const nameMatch = src.match(/(?:CREATE|REPLACE)\s+(?:MULTISET|SET)?\s*(?:VOLATILE\s+)?(?:TABLE|VIEW)\s+([A-Za-z0-9_$."]+)/i);
255
  if (nameMatch) {
256
  const fq = nameMatch[1].replace(/"/g,'');
257
  out.fqName = fq;
 
345
  if (out.kind === 'view' || choice === 'view') {
346
  // Attempt to capture SELECT
347
  const selMatch = out.raw.match(/AS\s+([\s\S]+)$/i);
348
+ let selectSql = selMatch ? selMatch[1].trim().replace(/;+\s*$/,'') : '-- TODO: Provide SELECT body';
349
+ selectSql = selectSql.replace(/LOCKING\s+ROW\s+FOR\s+ACCESS\s*/gi, '');
350
+ why.push(`- Object is a VIEW → emitting CREATE VIEW IF NOT EXISTS with original SELECT.`);
351
+ if (/LOCKING\s+ROW/i.test(out.raw)) why.push(`- Removed TD "LOCKING ROW FOR ACCESS" (not applicable in Databricks).`);
352
  const sql = `CREATE VIEW IF NOT EXISTS ${fqTarget} AS
353
  ${selectSql};`;
354
  return { sql, why, detected:`VIEW (${out.fqName||out.name||''})`, recommendation:'VIEW' };
 
451
 
452
  function autoDetectFromDDL() {
453
  const ddl = el('input').value;
454
+ const m = ddl.match(/(?:CREATE|REPLACE)\s+(?:MULTISET|SET)?\s*(?:VOLATILE\s+)?(?:TABLE|VIEW)\s+([A-Za-z0-9_$."]+)/i);
455
  if (m) {
456
  const fq = m[1].replace(/"/g,'');
457
  const parts = fq.split('.');