dreamweaver

dreamweaver - Logiciels - Windows & Software

Marsh Posté le 13-02-2006 à 23:20:15    

Bonsoir, j'ai un petit soucis en installant dreamweaver, (je n'ai jamais eu cela avant)
 
Lorsque je veux insérer un enregistrement voici une erreur qui s'affiche "Le script Recorset ne définit pas la fonction applyServerBeharior"
 
Avez vous déja eu cela?
 
ps: j'ai installer et désinstaller le logiciel plusieurs foispour tester
 
Merci pour votre coup de main
 
 

Reply

Marsh Posté le 13-02-2006 à 23:20:15   

Reply

Marsh Posté le 14-02-2006 à 17:15:06    

personne ne peux m'aider ? svp

Reply

Marsh Posté le 14-02-2006 à 19:21:17    

Quelle version de Dreamweaver ? quel OS ? quel service pack ?

Reply

Marsh Posté le 15-02-2006 à 19:14:54    

Wolfman a écrit :

Quelle version de Dreamweaver ? quel OS ? quel service pack ?


 
version 8 , internet explorer, et service pack 2, mais il allait bien avant avec ces configurations

Reply

Marsh Posté le 15-02-2006 à 22:28:09    

quel OS ?

Reply

Marsh Posté le 16-02-2006 à 23:04:28    

Windows xp pro

Reply

Marsh Posté le 20-02-2006 à 23:02:25    

personne n'a jamais vu se problème?

Reply

Marsh Posté le 20-02-2006 à 23:07:49    

contacte le service apres vente macromedia pour exposer ton probleme vu que j'imagine que tu l'as acheté n'est ce pas ;)
 

Reply

Marsh Posté le 21-02-2006 à 11:01:32    

+1 pour l'assistance de Macromedia. Parce que là, je vois pas :??:

Reply

Marsh Posté le 27-02-2006 à 17:30:35    

Bonsoir, je n'ai toujours pu résoudre mon problème et je n'ai pas encore la license Macromedia mais pour bientôt quand même
 
Voici un nouveau message d'erreur  
Erreur Javascript lors du chargement de Recordset.htm:
A la ligne 1111 du fichier "C:/........Dremaweaver/Configuration/ServerBehariors/PHP_Mysql/Recorset.js": theStr = theStr.replace(/(?> )*gi,"" ); //remove close tags
 
SyntaxError: invalid quantifier ?
 
Merci d'avance pour votre coup de main

Reply

Marsh Posté le 27-02-2006 à 17:30:35   

Reply

Marsh Posté le 27-02-2006 à 17:33:39    

voici le fichier Recordset.js
 
Mais je ne vois pas d'erreur

Code :
  1. // Copyright 2001, 2002, 2003, 2004, 2005 Macromedia, Inc. All rights reserved.
  2. //******************* API **********************
  3. //--------------------------------------------------------------------
  4. // FUNCTION:
  5. //   initializeUI
  6. //
  7. // DESCRIPTION:
  8. //   Prepare the dialog and controls for user input
  9. //
  10. // ARGUMENTS:
  11. //   none
  12. //
  13. // RETURNS:
  14. //   nothing
  15. //--------------------------------------------------------------------
  16. function initializeUI()
  17. {
  18. }
  19. //--------------------------------------------------------------------
  20. // FUNCTION:
  21. //   findServerBehaviors
  22. //
  23. // DESCRIPTION:
  24. //   Returns an array of ServerBehavior objects, each one representing
  25. //   an instance of this Server Behavior on the page
  26. //
  27. // ARGUMENTS:
  28. //   none
  29. //
  30. // RETURNS:
  31. //   JavaScript Array of ServerBehavior objects
  32. //--------------------------------------------------------------------
  33. function findServerBehaviors()
  34. {
  35.   var sbObj;
  36.   var sbList = dwscripts.findSBs(MM.LABEL_TitleRecordset + " (@@RecordsetName@@)", SBRecordsetPHP);
  37.   for (var i=0; i < sbList.length; i++) {
  38.     var rsName = sbList[i].getParameter("RecordsetName" );
  39.  if (rsName)  
  40.  {
  41.   var baseTitle = dw.loadString("serverBehavior/title/" + sbList[i].name);
  42.   if( !baseTitle )
  43.    baseTitle = sbList[i].name;
  44.    
  45.   sbList[i].setTitle(baseTitle + " (" + rsName + " )" );
  46.   if(!sbList[i].getParameter('MM_subType') && sbList[i].subType) {
  47.    sbList[i].setParameter('MM_subType', sbList[i].subType);
  48.   }
  49.  }
  50.  //fill specific parameters for every rsType
  51.  for (var j = 0;j < MM.rsTypes.length;j++) {
  52.   if (MM.rsTypes[j].serverModel == dw.getDocumentDOM().serverModel.getServerName()) {
  53.    domCommand = dw.getDocumentDOM(dw.getConfigurationPath() + "/Commands/" + MM.rsTypes[j].command);  
  54.    if (domCommand) {
  55.     windowCommand = domCommand.parentWindow;
  56.     if (windowCommand.fillAditionalParameters) {
  57.      sbList[i] = windowCommand.fillAditionalParameters(sbList[i]);
  58.     }
  59.    }
  60.   }
  61.  }
  62.   }
  63.   return sbList;
  64. }
  65. //--------------------------------------------------------------------
  66. // FUNCTION:
  67. //   canApplyServerBehavior
  68. //
  69. // DESCRIPTION:
  70. //   Returns true if a Server Behavior can be applied to the current
  71. //   document
  72. //
  73. // ARGUMENTS:
  74. //   sbObj - ServerBehavior object - one of the objects returned
  75. //           from findServerBehaviors
  76. //
  77. // RETURNS:
  78. //   boolean - true if the behavior can be applied, false otherwise
  79. //--------------------------------------------------------------------
  80. function canApplyServerBehavior(sbObj)
  81. {
  82.   var success = true;
  83.   if (success)
  84.   {
  85.     dwscripts.canApplySB(sbObj, false); // preventNesting is false
  86.   }
  87.   return success;
  88. }
  89. //--------------------------------------------------------------------
  90. // FUNCTION:
  91. //   applyServerBehavior
  92. //
  93. // DESCRIPTION:
  94. //   Collects values from the form elements in the dialog box and
  95. //   adds the Server Behavior to the user's document
  96. //
  97. // ARGUMENTS:
  98. //   priorSBRecordset - SBRecordsetPHP object - one of the objects returned
  99. //     from findServerBehaviors
  100. //
  101. // RETURNS:
  102. //   string - empty upon success, or an error message
  103. //--------------------------------------------------------------------
  104. function applyServerBehavior(priorSBRecordset)
  105. {
  106.   var paramObj = new Object();
  107.   var errStr = "";
  108.    
  109.   var sbObj = priorSBRecordset;
  110.   if (!sbObj)
  111.   {
  112.     sbObj = new SBRecordsetPHP();
  113.      
  114.     // Check if any default values are set for us (i.e., drag and drop  
  115.     //   operations from the database panel set the default connection
  116.     //   and table name values and invoke the recordset sb).   
  117.     if (MM.recordsetSBDefaults)
  118.     {
  119.       // RST: added to enable the posibility of creating fake SBs to  
  120.       // behave like Recordsets
  121.       sbObj.name = MM.RecordsetPriorRec;
  122.      
  123.       sbObj.setConnectionName(MM.recordsetSBDefaults.connectionName);
  124.       sbObj.setDatabaseCall(MM.recordsetSBDefaults.sql, new Array());
  125.        
  126.       // Clear out the default values.
  127.       MM.recordsetSBDefaults = null;
  128.     }
  129.   }
  130.   var newSBRecordset = recordsetDialog.display(sbObj);
  131.    
  132.   if (newSBRecordset)
  133.   {
  134.     dwscripts.fixUpSelection(dw.getDocumentDOM(), true, true);
  135.     dwscripts.applySB(newSBRecordset.getParameters(), priorSBRecordset);
  136.     // Refresh the cache for recordset.
  137.     MMDB.refreshCache(true);
  138.      
  139.     // Update references to the recordset on name change.
  140.     newSBRecordset.updateRecordsetRefs();
  141.      
  142.     MM.RecordsetApplied = true;
  143.   }
  144.    
  145.   return errStr;
  146. }
  147. //--------------------------------------------------------------------
  148. // FUNCTION:
  149. //   inspectServerBehavior
  150. //
  151. // DESCRIPTION:
  152. //   Sets the values of the form elements in the dialog box based
  153. //   on the given ServerBehavior object
  154. //
  155. // ARGUMENTS:
  156. //   sbObj - ServerBehavior object - one of the objects returned
  157. //           from findServerBehaviors
  158. //
  159. // RETURNS:
  160. //   nothing
  161. //--------------------------------------------------------------------
  162. function inspectServerBehavior(sbObj)
  163. {
  164. }
  165. //--------------------------------------------------------------------
  166. // FUNCTION:
  167. //   deleteServerBehavior
  168. //
  169. // DESCRIPTION:
  170. //   Remove the specified Server Behavior from the user's document
  171. //
  172. // ARGUMENTS:
  173. //   sbObj - ServerBehavior object - one of the objects returned
  174. //           from findServerBehaviors
  175. //
  176. // RETURNS:
  177. //   nothing
  178. //--------------------------------------------------------------------
  179. function deleteServerBehavior(sbObj)
  180. {
  181. var smName = dw.getDocumentDOM().serverModel.getServerName();
  182. var domCommand;
  183. var shouldDelete = true;
  184. for (var j=0; j<MM.rsTypes.length; j++) {
  185.  if (MM.rsTypes[j].serverModel == smName) {
  186.   domCommand = dw.getDocumentDOM(dw.getConfigurationPath() + "/Commands/" + MM.rsTypes[j].command);  
  187.   if (domCommand) {
  188.    windowCommand = domCommand.parentWindow;
  189.    if (windowCommand.onDelete) {
  190.     shouldDelete = shouldDelete & windowCommand.onDelete(sbObj);
  191.    }
  192.   }
  193.  }
  194. }
  195.  
  196. if (shouldDelete) {
  197.  dwscripts.deleteSB(sbObj);
  198. }
  199. }
  200. //--------------------------------------------------------------------
  201. // FUNCTION:
  202. //   analyzeServerBehavior
  203. //
  204. // DESCRIPTION:
  205. //   Performs extra checks needed to determine if the Server Behavior
  206. //   is complete
  207. //
  208. // ARGUMENTS:
  209. //   sbObj - ServerBehavior object - one of the objects returned
  210. //           from findServerBehaviors
  211. //   allRecs - JavaScripts Array of ServerBehavior objects - all of the
  212. //             ServerBehavior objects known to Dreamweaver
  213. //
  214. // RETURNS:
  215. //   nothing
  216. //--------------------------------------------------------------------
  217. function analyzeServerBehavior(sbObj, allRecs)
  218. {
  219.    
  220.    sbObj.analyze()
  221. }
  222. //--------------------------------------------------------------------
  223. // FUNCTION:
  224. //   updateUI
  225. //
  226. // DESCRIPTION:
  227. //   Called from controls to update the dialog based on user input
  228. //
  229. // ARGUMENTS:
  230. //   controlName - string - the name of the control which called us
  231. //   event - string - the name of the event which triggered this call
  232. //           or null
  233. //
  234. // RETURNS:
  235. //   nothing
  236. //--------------------------------------------------------------------
  237. function updateUI(controlName, event)
  238. {
  239. }
  240. //-------------------------------------------------------------------
  241. // FUNCTION:
  242. //   copyServerBehavior
  243. //
  244. // DESCRIPTION:
  245. //
  246. // ARGUMENTS:  
  247. //
  248. // RETURNS:
  249. //--------------------------------------------------------------------
  250. function copyServerBehavior(sbObj)  
  251. {
  252. var smName = dw.getDocumentDOM().serverModel.getServerName();
  253. var domCommand;
  254. var isCopyAllowed = true;
  255. for (var j=0; j<MM.rsTypes.length; j++) {
  256.  if (MM.rsTypes[j].serverModel == smName) {
  257.   domCommand = dw.getDocumentDOM(dw.getConfigurationPath() + "/Commands/" + MM.rsTypes[j].command);  
  258.   if (domCommand) {
  259.    windowCommand = domCommand.parentWindow;
  260.    if (windowCommand.onCopy) {
  261.     isCopyAllowed = isCopyAllowed & windowCommand.onCopy(sbObj);
  262.    }
  263.   }
  264.  }
  265. }
  266.  
  267. if (isCopyAllowed) {
  268.     sbObj.preprocessForSerialize();
  269. }
  270.  
  271. return isCopyAllowed;
  272. }
  273. //-------------------------------------------------------------------
  274. // FUNCTION:
  275. //   pasteServerBehavior
  276. //
  277. // DESCRIPTION:
  278. //
  279. // ARGUMENTS:  
  280. //
  281. // RETURNS:
  282. //--------------------------------------------------------------------
  283. function pasteServerBehavior(sbObj)  
  284. {
  285. var smName = dw.getDocumentDOM().serverModel.getServerName();
  286. var domCommand;
  287. var isPasteAllowed = true;
  288. for (var j=0; j<MM.rsTypes.length; j++) {
  289.  if (MM.rsTypes[j].serverModel == smName) {
  290.   domCommand = dw.getDocumentDOM(dw.getConfigurationPath() + "/Commands/" + MM.rsTypes[j].command);  
  291.   if (domCommand) {
  292.    windowCommand = domCommand.parentWindow;
  293.    if (windowCommand.onPaste) {
  294.     isPasteAllowed = isPasteAllowed & windowCommand.onPaste(sbObj);
  295.    }
  296.   }
  297.  }
  298. }
  299.  
  300. if (isPasteAllowed && sbObj && sbObj.parameterNames) {
  301.     sbObj.postprocessForDeserialize();
  302.     sbObj.setPageSize("0" ); // do not paste any paging code
  303.     var rsName = sbObj.getRecordsetName();
  304.  if (!sbObj.isUniqueRecordsetName(rsName, "" ))
  305.  {
  306.   var oldRsName = rsName;
  307.   rsName = sbObj.getUniqueRecordsetName();  
  308.   //replace the old recordset name with the new recordset name
  309.   var varRefList = sbObj.getParameter(sbObj.EXT_DATA_SQL_VAR_REF_LIST);
  310.   if (varRefList)
  311.   {
  312.    var oldRegEx = new RegExp(oldRsName,"g" );
  313.    varRefList = varRefList.replace(oldRegEx,rsName);
  314.    sbObj.setParameter(sbObj.EXT_DATA_SQL_VAR_REF_LIST, varRefList);
  315.   }
  316.   sbObj.setRecordsetName(rsName);
  317.  }
  318.     // Apply the edits.
  319.     sbObj.queueDocEdits(false);
  320.     dwscripts.applyDocEdits();
  321. }
  322. }
  323. //--------------------------------------------------------------------
  324. // FUNCTION:
  325. //   createServerBehaviorObj
  326. //
  327. // DESCRIPTION:
  328. //   This function is called from UltraDev when pasting a ServerBehavior.
  329. //   If you plan to implement copyServerBehavior and pasteServerBehavior for  
  330. //   your SB, you must implement this function to return an empty instance of   
  331. //   the ServerBehavior object or of your subclass of ServerBehavior.  
  332. //
  333. // ARGUMENTS:
  334. //   none
  335. //
  336. // RETURNS:
  337. //   empty ServerBehavior instance
  338. //--------------------------------------------------------------------
  339. function createServerBehaviorObj()
  340. {
  341.   return new SBRecordsetPHP();
  342. }
  343. //--------------------------------------------------------------------
  344. // CLASS:
  345. //   SBRecordsetPHP
  346. //
  347. // DESCRIPTION:
  348. //   Subclass of SBDatabaseCall which includes PHP recordset specific functionality.
  349. //
  350. // PUBLIC PROPERTIES:
  351. //   
  352. // Available parameter types. These are the localized strings describing  
  353. //   the parameter types as found in the MM.LABEL_PHP_Param_Types array.
  354. //   SBRecordsetPHP.PARAM_TYPE_URL_PARAM
  355. //   SBRecordsetPHP.PARAM_TYPE_FORM_VAR
  356. //   SBRecordsetPHP.PARAM_TYPE_COOKIE
  357. //   SBRecordsetPHP.PARAM_TYPE_SESSION_VAR
  358. //   SBRecordsetPHP.PARAM_TYPE_APP_VAR
  359. //   SBRecordsetPHP.PARAM_TYPE_ENTERED_VAL
  360. //
  361. // PUBLIC FUNCTIONS:
  362. //   INSPECTORS:
  363. //
  364. //   Overriden functions inherited from SBDatabaseCall:
  365. //   getVariableTypeArray() - Get list of available parameter types.
  366. //   isLiteralVariableType(varType) - Determine if the variable type
  367. //       is a literal value.
  368. //   getVariableCodeFromType(varType, varNameOrValue) - Get the runtime   
  369. //       code and default value for the variable type.  
  370. //   getVariableTypeFromCode(runtimeValue, defaultValue) - Get variable  
  371. //       type and name from its runtime and default values.
  372. //
  373. //
  374. //   CONSTRUCTION:
  375. //
  376. //   initSBRecordsetPHP() - base class constructor for subclasses.
  377. //
  378. //   TODO: add a method for adding the LIMIT keyword to the SQL.
  379. //         this is needed for Repeat Region
  380. //   TODO: add a method for getting the record count SQL.
  381. //         this is needed for the Move To's and RS stats
  382. //
  383. // INCLUDE:
  384. //   ServerBehaviorClass.js
  385. //   SBDatabaseCallClass.js
  386. //--------------------------------------------------------------------
  387. function SBRecordsetPHP(name, title, selectedNode)
  388. {
  389.   // array for storing value prompts for sql parameters
  390.   this.paramValuePromptArray = null;
  391.    
  392.   this.initSBRecordsetPHP(name, title, selectedNode);
  393. }
  394. //--------------------------------------------------------------------
  395. // FUNCTION:
  396. //   SBRecordsetPHP.initSBRecordsetPHP
  397. //
  398. // DESCRIPTION:
  399. //   SBRecordsetPHP 'constructor' for subclasses. In JS, subclasses cannot call
  400. //   the base class constructor to initialize it's properties for the subclass
  401. //   instance. Calls directly to the contructor set the base class properties for
  402. //   all instances of the subclass! We provide this init function for subclasses  
  403. //   to call instead of the constructor. Calls to this 'constructor' initialize
  404. //   the base class properties only for the subclass instance. The SBRecordsetPHP  
  405. //   constructor calls into this function as well.
  406. //
  407. // ARGUMENTS:
  408. //   name - string. recordset name
  409. //   title - string.  
  410. //   selectedNode - document node ptr. node to select when SB selected in SBPanel.
  411. //
  412. // RETURNS:
  413. //   none
  414. //--------------------------------------------------------------------
  415. function SBRecordsetPHP_initSBRecordsetPHP(name, title, selectedNode)
  416. {
  417.   // First, initialize base class.
  418.   this.initSBDatabaseCall(name, title, selectedNode);   
  419. }
  420. // Inherit from the SBDatabaseCall class.
  421. SBRecordsetPHP.prototype.__proto__ = SBDatabaseCall.prototype;
  422. // PUBLIC METHODS
  423. // Inspectors:
  424. SBRecordsetPHP.prototype.getDatabaseCall = SBRecordsetPHP_getDatabaseCall;
  425. // Updaters:
  426. SBRecordsetPHP.prototype.setDatabaseCall = SBRecordsetPHP_setDatabaseCall;
  427. SBRecordsetPHP.prototype.checkData = SBRecordsetPHP_checkData ;
  428. SBRecordsetPHP.prototype.checkDatabaseCall = SBRecordsetPHP_checkDatabaseCall;
  429. SBRecordsetPHP.prototype.checkPlatformSpecific = SBRecordsetPHP_checkPlatformSpecific;
  430. // SQL Utilities
  431. SBRecordsetPHP.prototype.isSimpleColumnName = SBRecordsetPHP_isSimpleColumnName;
  432. SBRecordsetPHP.prototype.getSimpleWhereInfo = SBRecordsetPHP_getSimpleWhereInfo;
  433. SBRecordsetPHP.prototype.getSimpleOrderByInfo = SBRecordsetPHP_getSimpleOrderByInfo;
  434. SBRecordsetPHP.prototype.addSimpleWhere = SBRecordsetPHP_addSimpleWhere;
  435. // Construction
  436. SBRecordsetPHP.prototype.initSBRecordsetPHP = SBRecordsetPHP_initSBRecordsetPHP;
  437. SBRecordsetPHP.prototype.analyzeDatabaseCall = SBRecordsetPHP_analyzeDatabaseCall;
  438. SBRecordsetPHP.prototype.analyzePlatformSpecific = SBRecordsetPHP_analyzePlatformSpecific;
  439. SBRecordsetPHP.prototype.getPageSize = SBRecordsetPHP_getPageSize;
  440. SBRecordsetPHP.prototype.setPageSize = SBRecordsetPHP_setPageSize;
  441. SBRecordsetPHP.prototype.setDefaultPageSize = SBRecordsetPHP_setDefaultPageSize;
  442. SBRecordsetPHP.prototype.updatePageSize = SBRecordsetPHP_updatePageSize;
  443. // PRIVATE METHODS
  444. SBRecordsetPHP.prototype.encodeVarRefs = SBRecordsetPHP_encodeVarRefs;
  445. SBRecordsetPHP.prototype.decodeVarRefs = SBRecordsetPHP_decodeVarRefs;
  446. SBRecordsetPHP.prototype.stripPHPTags = SBRecordsetPHP_stripPHPTags;
  447. SBRecordsetPHP.prototype.replaceParamsWithVals = SBRecordsetPHP_replaceParamsWithVals;
  448. SBRecordsetPHP.prototype.getSQLForRecordsetBindings = SBRecordsetPHP_getSQLForRecordsetBindings;
  449. SBRecordsetPHP.prototype.getSQLForTest = SBRecordsetPHP_getSQLForTest;
  450. // PUBLIC PROPERTIES
  451. // CLASS CONSTANTS
  452. // Override of SBDatabaseCall.prototype.EXT_DATA_* constants. Stores names of
  453. // common extension data elements. See SBDatabaseCall.prototype.EXT_DATA_* for  
  454. // details.  
  455. SBRecordsetPHP.prototype.EXT_DATA_RS_NAME         = "RecordsetName";
  456. SBRecordsetPHP.prototype.EXT_DATA_CONN_NAME       = "ConnectionName";
  457. SBRecordsetPHP.prototype.EXT_DATA_CONN_PATH       = "ConnectionPath";
  458. SBRecordsetPHP.prototype.EXT_DATA_DB_CALL_TEXT    = "SQLStatement";
  459. SBRecordsetPHP.prototype.EXT_DATA_CONN_URLFORMAT       = "UrlFormat";
  460. SBRecordsetPHP.prototype.EXT_DATA_SQL_VAR_REF_LIST = "SQLVariableList";
  461. SBRecordsetPHP.prototype.EXT_DATA_SQL_VAR_NAMES   = "Variable";
  462. SBRecordsetPHP.prototype.EXT_DATA_SQL_VAR_RUNTIME = "RuntimeValue";
  463. SBRecordsetPHP.prototype.EXT_DATA_SQL_VAR_DEFAULT = "DefaultValue";
  464. SBRecordsetPHP.prototype.EXT_DATA_RR_PAGE_SIZE     = "PageSize"
  465. SBRecordsetPHP.prototype.EXT_DATA_RR_START_RECORD  = "StartRecord"
  466. // Available parameter types. These are the localized strings describing the  
  467. //   parameter types as found in the MM.LABEL_PHP_Param_Types array.
  468. SBRecordsetPHP.VAR_TYPE_URL_PARAM   = MM.LABEL_PHP_Param_Types[0];
  469. SBRecordsetPHP.VAR_TYPE_FORM_VAR    = MM.LABEL_PHP_Param_Types[1];
  470. SBRecordsetPHP.VAR_TYPE_COOKIE      = MM.LABEL_PHP_Param_Types[2];
  471. SBRecordsetPHP.VAR_TYPE_SESSION_VAR = MM.LABEL_PHP_Param_Types[3];
  472. SBRecordsetPHP.VAR_TYPE_APP_VAR     = MM.LABEL_PHP_Param_Types[4];
  473. SBRecordsetPHP.VAR_TYPE_ENTERED_VAL = MM.LABEL_PHP_Param_Types[5];
  474. //--------------------------------------------------------------------
  475. // FUNCTION:
  476. //   SBRecordsetPHP.getDatabaseCall
  477. //
  478. // DESCRIPTION:
  479. //   Get the recordset sql for display to the user. That is, all variable  
  480. //   references are removed. Also get the variable references used.
  481. //
  482. // ARGUMENTS:
  483. //   returnedSQLParams - array. pass in an empty array.  
  484. //
  485. // RETURNS:
  486. //   string - decoded sql. null if not set.
  487. //   returnedSQLParams - array of objects. contains var references from the SQL.
  488. //     elements have the following properties: varName, defaultValue, runtimeValue.
  489. //--------------------------------------------------------------------
  490. function SBRecordsetPHP_getDatabaseCall(returnedSQLParams)
  491. {
  492.   var varRefNames = new Array();
  493.   var decodedSQL = this.decodeVarRefs(this.getParameter(this.EXT_DATA_DB_CALL_TEXT), varRefNames);
  494.    
  495.   if (returnedSQLParams != null)
  496.   {
  497.     // Populate the sql parameters array with the variable values
  498.     var varNames = this.getParameter(this.EXT_DATA_SQL_VAR_NAMES);
  499.     var defaultValues = this.getParameter(this.EXT_DATA_SQL_VAR_DEFAULT);
  500.     var runtimeValues = this.getParameter(this.EXT_DATA_SQL_VAR_RUNTIME);
  501.     
  502.     for (var j=0; varNames && j < varNames.length; j++)  
  503.     {
  504.       var paramObj = new Object();
  505.       paramObj.varName = varNames[j];
  506.    
  507.       if (defaultValues[j] != null)  
  508.       {
  509.         paramObj.defaultValue = defaultValues[j];
  510.       }  
  511.       else  
  512.       {
  513.         paramObj.defaultValue = "";
  514.       }
  515.       paramObj.runtimeValue = runtimeValues[j];
  516.       returnedSQLParams.push(paramObj);
  517.     }
  518.   }
  519.   return decodedSQL;
  520. }
  521. //--------------------------------------------------------------------
  522. // FUNCTION:
  523. //   SBRecordsetPHP.decodeVarRefs
  524. //
  525. // DESCRIPTION:
  526. //   Takes an SQL string and decodes the
  527. //   variable references into a form presentable to the user.  These
  528. //   references are returned in the varNameArray parameter.
  529. //
  530. // ARGUMENTS:
  531. //   theSQL - string. the SQL extracted from the code
  532. //   varNameArray - an array to populate with the referenced variables
  533. //
  534. // RETURNS:
  535. //   string - the SQL with variable references removed
  536. //   varNameArray - output parameter set with all variables found
  537. //--------------------------------------------------------------------
  538. function SBRecordsetPHP_decodeVarRefs(theSQL, varNameArray)  
  539. {
  540.   var retVal = (theSQL != null) ? theSQL : "";
  541.    
  542.   // if we escaped the percent signs for use in the sprintf statement,
  543.   //  then unescape them
  544.   if (retVal.indexOf("%%" ) != -1)
  545.   {
  546.     retVal = retVal.replace(/%%/g, "%" );
  547.   }
  548.   var varRefList = this.getParameter(this.EXT_DATA_SQL_VAR_REF_LIST);
  549.   var varRefNames = new Array();
  550.   if (varRefList)
  551.   {
  552.     var searchString = "_" + this.getRecordsetName();
  553.      
  554.     var varRefArray = varRefList.split("," );
  555.     for (var i=0; i < varRefArray.length; i++)
  556.     {
  557.       var start = varRefArray[i].indexOf("$" );
  558.       var end = varRefArray[i].indexOf(searchString);
  559.        
  560.       if (start != -1 && end != -1)
  561.       {
  562.         varRefNames.push(varRefArray[i].substring(start+1,end));
  563.       }
  564.       else
  565.       {
  566.         varRefNames.push(varRefArray[i]);
  567.       }
  568.     }
  569.   }
  570.   if (varRefNames.length)
  571.   {
  572.     // replace %s with the values in the varRefNames array
  573.     for (var i=0; i < varRefNames.length; i++)
  574.     {
  575.       retVal = retVal.replace(/%s/, varRefNames[i]);
  576.       varNameArray.push(varRefNames[i]);
  577.     }
  578.   }
  579.    
  580.  
  581.   return retVal;
  582. }
  583. //--------------------------------------------------------------------
  584. // FUNCTION:
  585. //   SBRecordsetPHP.setDatabaseCall
  586. //
  587. // DESCRIPTION:
  588. //   set sql property. also set the parameters referenced in the SQL.
  589. //   if in editable copy, set in preparation for updating the SB instance.
  590. //
  591. // ARGUMENTS:
  592. //   decodedSQL - SQL string without variable references encoded
  593. //   sqlParameters - SQLParameter object
  594. //
  595. // RETURNS:
  596. //   none
  597. //--------------------------------------------------------------------
  598. function SBRecordsetPHP_setDatabaseCall(decodedSQL, sqlParameters)
  599. {
  600.   var varNames = new Array();
  601.   var defaultValues = new Array();
  602.   var runtimeValues = new Array();
  603.   this.paramValuePromptArray = new Array();
  604.   if (sqlParameters != null)
  605.   {
  606.     var paramCount = sqlParameters.length;
  607.     for (var i = 0; i < paramCount; ++i)
  608.     {
  609.       var param = sqlParameters[i];     
  610.       varNames.push(param.varName);
  611.    
  612.       defaultValues.push(param.defaultValue);
  613.       runtimeValues.push(param.runtimeValue);
  614.       this.paramValuePromptArray.push(param.valuePrompt ? param.valuePrompt : "" );
  615.     }
  616.   }
  617.   var varRefs = new Array();
  618.   var encodedSQL = this.encodeVarRefs(decodedSQL, varNames, varRefs);
  619.    
  620.   this.setParameter(this.EXT_DATA_DB_CALL_TEXT, encodedSQL);
  621.   this.setParameter(this.EXT_DATA_SQL_VAR_NAMES, varNames);
  622.   this.setParameter(this.EXT_DATA_SQL_VAR_DEFAULT, defaultValues);
  623.   this.setParameter(this.EXT_DATA_SQL_VAR_RUNTIME, runtimeValues);
  624.   // we need default parametsr for all the new variables needed for repeat region
  625.   // without these values we get Javascript syntax errors
  626.   if (!this.getParameter(this.EXT_DATA_RR_START_RECORD))
  627.   {
  628.     this.setParameter(this.EXT_DATA_RR_START_RECORD, "0" ) ;
  629.   }
  630.   if (!this.getParameter(this.EXT_DATA_RR_PAGE_SIZE))
  631.   {
  632.     this.setParameter(this.EXT_DATA_RR_PAGE_SIZE, "" ) ;
  633.   }
  634.  
  635.   var rsName = this.getRecordsetName();
  636.      
  637.   var varRefArray = new Array();
  638.   for (var i=0; i < varRefs.length; i++)
  639.   {
  640.     varRefArray.push("$" + varRefs[i] + "_" + rsName);
  641.   }
  642.   this.setParameter(this.EXT_DATA_SQL_VAR_REF_LIST, varRefArray.join("," ));
  643. }
  644. //--------------------------------------------------------------------
  645. // FUNCTION:
  646. //   SBRecordsetPHP.encodeVarRefs
  647. //
  648. // DESCRIPTION:
  649. //   Replaces the variable references in the SQL string with the correct code.
  650. //
  651. // ARGUMENTS:  
  652. //   theSQL - the SQL string
  653. //   rsName - the name of the recordset
  654. //   varNameArray - the array of variable names to encode
  655. //
  656. // RETURNS:
  657. //   string - the SQL string with variable references encoded
  658. //--------------------------------------------------------------------
  659. function SBRecordsetPHP_encodeVarRefs(theSQL, varNameArray, varRefsArray)
  660. {
  661.   var retVal = theSQL;
  662.   //strip out all new lines and CRs.
  663.   retVal = retVal.replace(/[\r\n]+/g," " );
  664.    
  665.   //convert any variables
  666.   if (varNameArray.length != 0)  
  667.   {
  668.     // if we have variables, escape the percent signs in the SQL statement,
  669.     //  for use within the sprintf function
  670.     retVal = retVal.replace(/%/g, "%%" );
  671.    
  672.     //convert each variable reference
  673.     var varExpr = new RegExp("\\b(" + varNameArray.join("|" ) + " )\\b","ig" );
  674.     var match = theSQL.match(varExpr);
  675.     if (match)
  676.     {
  677.       for (var i=0; i < match.length; i++)
  678.       {
  679.         varRefsArray.push(match[i]);
  680.       }
  681.       retVal = retVal.replace(varExpr, "%s" );
  682.     }
  683.   }
  684.   return retVal;
  685. }
  686. //--------------------------------------------------------------------
  687. // FUNCTION:
  688. //   SBRecordsetPHP.analyzeDatabaseCall
  689. //
  690. // DESCRIPTION:
  691. //   Check that the SQL and SQL parameters are valid
  692. //
  693. // ARGUMENTS:
  694. //   none
  695. //
  696. // RETURNS:
  697. //   nothing
  698. //--------------------------------------------------------------------
  699. function SBRecordsetPHP_analyzeDatabaseCall()
  700. {
  701.    
  702.   // work-around a bug in the C find code
  703.   var varName = this.getParameter(this.EXT_DATA_SQL_VAR_NAMES);
  704.   if (typeof varNames == "string" )
  705.   {
  706.     this.setParameter(this.EXT_DATA_SQL_VAR_NAMES, (varNames) ? new Array(varNames) : new Array());
  707.   }
  708.   var defaultValues = this.getParameter(this.EXT_DATA_SQL_VAR_DEFAULT);
  709.   if (typeof defaultValues == "string" )
  710.   {
  711.     this.setParameter(this.EXT_DATA_SQL_VAR_DEFAULT, (defaultValues) ? new Array(defaultValues) : new Array());
  712.   }
  713.   var runtimeValues = this.getParameter(this.EXT_DATA_SQL_VAR_RUNTIME);
  714.   if (typeof runtimeValues == "string" )
  715.   {
  716.     this.setParameter(this.EXT_DATA_SQL_VAR_RUNTIME, (runtimeValues) ? new Array(runtimeValues) : new Array());
  717.   }
  718.   // end: work-around
  719.    
  720.      
  721.   // Check the variable blocks against the references in the sql. If they are not
  722.   //   the same, the found instance is incomplete.
  723.   var partVarRefNames = this.getParameter(this.EXT_DATA_SQL_VAR_NAMES);
  724.    
  725.   var sqlVarRefNames = new Array();
  726.   this.decodeVarRefs(this.getParameter(this.EXT_DATA_DB_CALL_TEXT), sqlVarRefNames);
  727.    
  728.   if (!partVarRefNames && sqlVarRefNames.length || partVarRefNames && !sqlVarRefNames)
  729.   {
  730.     this.setIsIncomplete(true);
  731.     //TODO: this.appendErrorMessage();
  732.   }  
  733.   else if (partVarRefNames && partVarRefNames.length &&  
  734.            sqlVarRefNames && sqlVarRefNames.length)
  735.   {
  736.     for (var j=0; !this.getIsIncomplete() && j < sqlVarRefNames.length; j++)  
  737.     {
  738.       var found = false;
  739.       for (var k=0; !found && k < partVarRefNames.length; k++)  
  740.       {
  741.         if (sqlVarRefNames[j] == partVarRefNames[k])  
  742.         {
  743.           found = true;
  744.         }
  745.       }
  746.       if (!found)  
  747.       {
  748.         this.setIsIncomplete(true);
  749.         //TODO: this.appendErrorMessage();
  750.       }
  751.     }
  752.   }   
  753. }
  754. //--------------------------------------------------------------------
  755. // FUNCTION:
  756. //   SBRecordsetPHP.analyzePlatformSpecific
  757. //
  758. // DESCRIPTION:
  759. //   Check that the platform specific parameters are valid
  760. //
  761. // ARGUMENTS:
  762. //   none
  763. //
  764. // RETURNS:
  765. //   nothing
  766. //--------------------------------------------------------------------
  767. function SBRecordsetPHP_analyzePlatformSpecific()
  768. {
  769. }
  770. //--------------------------------------------------------------------
  771. // FUNCTION:
  772. //   checkData
  773. //
  774. // DESCRIPTION:
  775. //   This function is moved from the base class to here so that Copy/Paste
  776. //   functionality works correctly. In order for Copy/Paste to happen all the
  777. //   SQL arrays need to be intialized through a call to setDatabaseCall  
  778. //
  779. // ARGUMENTS:
  780. //   bIsForTest
  781. //
  782. // RETURNS:
  783. //   objcet - 2 parameters: column, direction
  784. //--------------------------------------------------------------------
  785. function SBRecordsetPHP_checkData(bIsForTest)
  786. {
  787.   // Set default value for argument if not present.
  788.   if (arguments.length == 0)
  789.   {
  790.     var bIsForTest = false;
  791.   }
  792.    
  793.   var isValid = true;
  794.  
  795.   // Clear out the error messages
  796.   this.setErrorMessage("" );
  797.    
  798.   // Begin checking the recordset
  799.   isValid = this.checkRecordsetName(bIsForTest) && isValid;
  800. //set the url format based on whether the connection path is  
  801. //doc-relative or site relative
  802.   var bSiteRelative = this.IsSiteRelativePath();
  803. var urlFormat = "require_once";
  804. if (bSiteRelative)
  805. {
  806.  urlFormat = "virtual";
  807. }  
  808. this.setParameter(this.EXT_DATA_CONN_URLFORMAT,urlFormat);
  809.   isValid = this.checkConnectionName(bIsForTest,bSiteRelative) && isValid;
  810.    
  811.   // If recordset or connection aren't valid, just quit there so our error message
  812.   //   doesn't balloon too much. (Note - this is especially important for simple
  813.   //   recordsets. If the connection name is bad, we won't get a sql statement.
  814.   //   We don't want to popup a 'Bad SQL' error in the simple dialog because users
  815.   //   can't enter SQL there. So bail.)
  816.   if (isValid)
  817.   {
  818.     isValid = this.checkDatabaseCall(bIsForTest) && isValid;
  819.     isValid = this.checkPlatformSpecific(bIsForTest) && isValid;
  820.     var sqlParams = new Array();
  821.     var theSQL = this.getDatabaseCall(sqlParams);
  822.      
  823.     // when doing a test - setDatabase call messes up params
  824.     if ( bIsForTest == false )
  825.     {
  826.       this.setDatabaseCall( theSQL, sqlParams );   
  827.     }
  828.   }
  829.   return isValid;
  830. }
  831. //--------------------------------------------------------------------
  832. // FUNCTION:
  833. //   SBRecordsetPHP.checkDatabaseCall
  834. //
  835. // DESCRIPTION:
  836. //   Check that the entered SQL and SQL parameters are valid.
  837. //
  838. // ARGUMENTS:
  839. //   bIsForTest - boolean - indicates if this check is for the test button
  840. //
  841. // RETURNS:
  842. //   boolean
  843. //--------------------------------------------------------------------
  844. function SBRecordsetPHP_checkDatabaseCall(bIsForTest)
  845. {
  846.   var isValidRS = true;
  847.    
  848.   // Make sure the SQL is a Select statement or call to stored procedure.
  849.   var sqlParams = new Array();
  850.   var theSQL = this.getDatabaseCall(sqlParams);
  851.   if (dwscripts.stripChars(theSQL, " \r\n\t" ) == "" )
  852.   {
  853.     isValidRS = false;
  854.     this.appendErrorMessage(MM.MSG_NoSelectStatement);
  855.   }
  856.   else
  857.   {
  858.     var sqlObj = new SQLStatement(theSQL);
  859.     if (   !sqlObj ||  
  860.             (sqlObj.getType() != SQLStatement.STMT_TYPE_SELECT  
  861.              && sqlObj.type != SQLStatement.STMT_TYPE_STORED_PROC)
  862.        )
  863.     {
  864.       isValidRS = false;
  865.       this.appendErrorMessage(MM.MSG_NoSelectStatement);
  866.     }
  867.   }
  868.   for (var i = 0; i < sqlParams.length; i++)
  869.   {
  870.     var param = sqlParams[i];
  871.  
  872.     var theName = dwscripts.trim(param.varName);
  873.     var theDefaultVal = dwscripts.trim(param.defaultValue);
  874.     var theRunTimeVal = dwscripts.trim(param.runtimeValue);
  875.     if (theName == "" )
  876.     {
  877.       this.appendErrorMessage(MM.MSG_MissingParamNames);
  878.       isValidRS = false;
  879.       // Return here since we need the param name to label further parameter errors.
  880.       return isValidRS;
  881.     }
  882.     else
  883.     {
  884.       if (!dwscripts.isValidVarName(theName))
  885.       {
  886.         isValidRS = false;
  887.         this.appendErrorMessage(theName + " " + MM.MSG_InvalidParamName);
  888.       }
  889.       else
  890.       {
  891.         var re = new RegExp("\\b" + theName + "\\b" );
  892.         if (theSQL.search(re) == -1)
  893.         {
  894.           isValidRS = false;
  895.           this.appendErrorMessage(theName + " " + MM.MSG_InvalidParamNameNotInSQL);
  896.         }
  897.       }
  898.       if (theDefaultVal == "" )
  899.       {
  900.         isValidRS = false;
  901.         this.appendErrorMessage(MM.MSG_DefaultValMissing + theName);
  902.       }
  903.    
  904.       if (!bIsForTest)
  905.       {
  906.         if (theRunTimeVal == "" )
  907.         {
  908.           isValidRS = false;
  909.           this.appendErrorMessage(MM.MSG_RunTimeValMissing + theName);
  910.         }
  911.       }  
  912.     }
  913.   }
  914.   return isValidRS;
  915. }
  916. //--------------------------------------------------------------------
  917. // FUNCTION:
  918. //   SBRecordsetPHP.checkPlatformSpecific
  919. //
  920. // DESCRIPTION:
  921. //   Check that the platform specific parameters are valid, and provide
  922. //   the proper defaults if no values were provided.
  923. //
  924. // ARGUMENTS:
  925. //   bIsForTest - boolean - indicates if this check is for the test button
  926. //
  927. // RETURNS:
  928. //   boolean
  929. //--------------------------------------------------------------------
  930. function SBRecordsetPHP_checkPlatformSpecific(bIsForText)
  931. {
  932.   var isValidRS = true;
  933.    
  934.   return isValidRS;
  935. }
  936. //--------------------------------------------------------------------
  937. // FUNCTION:
  938. //   SBRecordsetPHP.getSQLForRecordsetBindings
  939. //
  940. // DESCRIPTION:
  941. //   Returns the SQL statement that should be used to get the meta data
  942. //   for this Recordset
  943. //
  944. // ARGUMENTS:
  945. //   none
  946. //
  947. // RETURNS:
  948. //   string - sql statement
  949. //--------------------------------------------------------------------
  950. function SBRecordsetPHP_getSQLForRecordsetBindings()
  951. {
  952.   var sqlParams = new Array();
  953.   var sql = this.getDatabaseCall(sqlParams);
  954.   // To keep the fix minimized, we do it for simple SQL Statement only.
  955.   var sqlObj = new SQLStatement(sql);  
  956. /*
  957.   var tempSQL = sqlObj.getStatementForMMDB();  
  958.   if (tempSQL)  {
  959.     sql = tempSQL;
  960.   }
  961. */
  962.   sql = this.replaceParamsWithVals(sql, sqlParams);
  963.   return sql;
  964. }
  965. //--------------------------------------------------------------------
  966. // FUNCTION:
  967. //   SBRecordsetPHP.getSQLForTest
  968. //
  969. // DESCRIPTION:
  970. //   Returns the SQL statement that should be used when displaying  
  971. //   the test dialog.
  972. //
  973. // ARGUMENTS:
  974. //   none
  975. //
  976. // RETURNS:
  977. //   string - sql statement
  978. //--------------------------------------------------------------------
  979. function SBRecordsetPHP_getSQLForTest()
  980. {
  981.   var sqlParams = new Array();
  982.   var sql = this.getDatabaseCall(sqlParams);
  983.  
  984.   // remove SQL comments
  985.   sql = SQLStatement.stripComments(sql);
  986.  
  987.   for (var i = 0; i < sqlParams.length; i++)
  988.   {
  989.     var theParamVal = "";
  990.    
  991.     if (this.paramValuePromptArray && this.paramValuePromptArray[i])
  992.     {
  993.       // ask the user for the value to replace
  994.       // Pop up a dialog to get the default value to use in the test   
  995.       MM.paramName = this.paramValuePromptArray[i]
  996.       dw.runCommand("GetTestValue" );
  997.       if (MM.clickedOK)
  998.       {
  999.         theParamVal = MM.retVal.replace(/'/g, "''" );
  1000.       }
  1001.       else
  1002.       {
  1003.         // user clicked cancel, so exit and set statement to blank
  1004.         sql = "";
  1005.         break;
  1006.       }
  1007.     }
  1008.     else
  1009.     {
  1010.       theParamVal = String(sqlParams[i].defaultValue).replace(/'/g, "''" );
  1011.     }
  1012.    
  1013.     var varRef = new RegExp("\\b" + sqlParams[i].varName + "\\b","g" );
  1014.     sql = sql.replace(varRef, theParamVal);
  1015.   }
  1016.  
  1017.   return sql;
  1018. }
  1019. //--------------------------------------------------------------------
  1020. // FUNCTION:
  1021. //   SBRecordsetPHP.replaceParamsWithVals
  1022. //
  1023. // DESCRIPTION:
  1024. //   Replace the parameter names in the sql with the associated values.
  1025. //   override of a SBDatabaseCall.replaceParamsWithVals
  1026. //
  1027. // ARGUMENTS:
  1028. //   sql - string. sql string in which to replace the parameter names.
  1029. //   sqlParams - SQLParameters. describes the parameters in the sql.
  1030. //
  1031. // RETURNS:
  1032. //   string - sql with parameters replaced.
  1033. //--------------------------------------------------------------------
  1034. function SBRecordsetPHP_replaceParamsWithVals(sql, sqlParams)
  1035. {
  1036.   var statement = sql;
  1037.  
  1038.   for (var i = 0; i < sqlParams.length; i++)
  1039.   {
  1040.     var theParam = sqlParams[i];
  1041.     var theParamVal = String(theParam.defaultValue).replace(/'/g, "''" );
  1042.     var myRe = new RegExp("\\b" + theParam.varName + "\\b","g" );
  1043.     statement = statement.replace(myRe, theParamVal);
  1044.   }
  1045.  
  1046.   return statement;
  1047. }
  1048. //--------------------------------------------------------------------
  1049. // FUNCTION:
  1050. //   SBRecordsetPHP_stripPHPTags
  1051. //
  1052. // DESCRIPTION:
  1053. //   Helper function for SBRecordsetPHP_getParamObject to strip the ASP  
  1054. //   directives.
  1055. //
  1056. // ARGUMENTS:
  1057. //   inStr - string. string to strip.
  1058. //
  1059. // RETURNS:
  1060. //   string - with ASP directives stripped.
  1061. //--------------------------------------------------------------------
  1062. function SBRecordsetPHP_stripPHPTags(inStr)
  1063. {
  1064.   var theStr = String(inStr);
  1065.   theStr = theStr.replace(/(<\?\s*php\s*echo)*/gi,"" );    //remove open tags   
  1066.   theStr = theStr.replace(/(\?> )*/gi,"" );  //remove close tags
  1067.   return theStr;
  1068. }
  1069. //--------------------------------------------------------------------
  1070. // FUNCTION:
  1071. //   isSimpleColumnName
  1072. //
  1073. // DESCRIPTION:
  1074. //   Returns true if the given column name is not a renamed or  
  1075. //   calculated column
  1076. //
  1077. // ARGUMENTS:
  1078. //   columnName - string - the column to check
  1079. //
  1080. // RETURNS:
  1081. //   boolean
  1082. //--------------------------------------------------------------------
  1083. function SBRecordsetPHP_isSimpleColumnName(columnName)
  1084. {
  1085.   var retVal = false;
  1086.  
  1087.   var colName = dwscripts.trim(columnName);
  1088.   if (colName == '*' || ((colName.search(/^[\w\. ]*$/) == 0) &&
  1089.        (colName.search(/\bas\b/i) == -1)))
  1090.   {
  1091.     retVal = true;
  1092.   }
  1093.   return retVal;
  1094. }
  1095. //--------------------------------------------------------------------
  1096. // FUNCTION:
  1097. //   getSimpleWhereInfo
  1098. //
  1099. // DESCRIPTION:
  1100. //   Returns an object with information about the current where clause,
  1101. //   if it is based on a single parameter.
  1102. //   Returns an empty object if the where clause is empty, and null  
  1103. //   if the where clause is not a simple parameter comparison
  1104. //
  1105. // ARGUMENTS:
  1106. //   none
  1107. //
  1108. // RETURNS:
  1109. //   object - has 4 properties: lval, rval, operator, isString
  1110. //--------------------------------------------------------------------
  1111. function SBRecordsetPHP_getSimpleWhereInfo(sqlObj)
  1112. {
  1113.   var retVal = null;
  1114.   var whereStr = dwscripts.trim(sqlObj.whereClause);
  1115.  
  1116.   var info = new Object();
  1117.   info.lval = "";
  1118.   info.rval = "";
  1119.   info.operator = "";
  1120.   info.isString = false;
  1121.   if (whereStr != "" )
  1122.   {
  1123.     if (whereStr.search(/^\s*([\w\. `]+?)\s*([=><])\s*([\w\. ]+?)\s*$/) != -1)
  1124.     {
  1125.       info.lval = RegExp.$1
  1126.       info.operator = RegExp.$2
  1127.       info.rval = RegExp.$3
  1128.     }
  1129.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*([=><])\s*'([\w\. ]+?)'\s*$/) != -1)
  1130.     {
  1131.       info.lval = RegExp.$1
  1132.       info.operator = RegExp.$2
  1133.       info.rval = RegExp.$3
  1134.       info.isString = true
  1135.     } 
  1136.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*((<> )|(>=)|(<=))\s*([\w\. ]+?)\s*$/) != -1)
  1137.     {
  1138.       info.lval = RegExp.$1
  1139.       info.operator = RegExp.$2
  1140.       info.rval = RegExp.$6
  1141.     } 
  1142.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*((<> )|(>=)|(<=))\s*'([\w\. ]+?)'\s*$/) != -1)
  1143.     {
  1144.       info.lval = RegExp.$1
  1145.       info.operator = RegExp.$2
  1146.       info.rval = RegExp.$6
  1147.       info.isString = true
  1148.     }
  1149.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*(like)\s*('%([\w\. ]+?)%')\s*$/i) != -1)
  1150.     {
  1151.       info.lval = RegExp.$1
  1152.       info.operator = "contains"
  1153.       info.rval = RegExp.$4
  1154.       info.isString = true
  1155.     }
  1156.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*(like)\s*('%([\w\. ]+?)')\s*$/i) != -1)
  1157.     {
  1158.       info.lval = RegExp.$1
  1159.       info.operator = "ends with"
  1160.       info.rval = RegExp.$4
  1161.       info.isString = true
  1162.     }
  1163.     else if (whereStr.search(/^\s*([\w\. `]+?)\s*(like)\s*('([\w\. ]+?)%')\s*$/i) != -1)
  1164.     {
  1165.       info.lval = RegExp.$1
  1166.       info.operator = "begins with"
  1167.       info.rval = RegExp.$4
  1168.       info.isString = true
  1169.     }
  1170.     else
  1171.     {
  1172.       info = null;
  1173.     }
  1174.   }
  1175.  
  1176.   if (info && info.lval)
  1177.   {
  1178.     info.lval = dwscripts.decodeSQLColumnRef(info.lval);
  1179.   }
  1180.   retVal = info;
  1181.   return retVal;
  1182. }
  1183. //--------------------------------------------------------------------
  1184. // FUNCTION:
  1185. //   addSimpleWhere
  1186. //
  1187. // DESCRIPTION:
  1188. //   <description>
  1189. //
  1190. // ARGUMENTS:
  1191. //   <arg1> - <type and description>
  1192. //
  1193. // RETURNS:
  1194. //   <type and description>
  1195. //--------------------------------------------------------------------
  1196. function SBRecordsetPHP_addSimpleWhere(sqlObj, columnName, operatorType, parameterName)
  1197. {
  1198.  
  1199.    
  1200.   switch (operatorType)
  1201.   {
  1202.   case "=":
  1203.   case ">":
  1204.   case "<":
  1205.   case ">=":
  1206.   case "<=":
  1207.   case "<>":
  1208.     sqlObj.whereClause = dwscripts.encodeSQLColumnRef("" ,columnName) + " " + operatorType + " " + parameterName;
  1209.     break;
  1210.   case "begins with":
  1211.     sqlObj.whereClause = dwscripts.encodeSQLColumnRef("" ,columnName) + " LIKE '" + dwscripts.trimQuotes(parameterName) + "%'";
  1212.     break;
  1213.   case "ends with":
  1214.     sqlObj.whereClause = dwscripts.encodeSQLColumnRef("" ,columnName) + " LIKE '%" + dwscripts.trimQuotes(parameterName) + "'";
  1215.     break;
  1216.   case "contains":
  1217.     sqlObj.whereClause = dwscripts.encodeSQLColumnRef("" ,columnName) + " LIKE '%" + dwscripts.trimQuotes(parameterName) + "%'";
  1218.     break;
  1219.   }
  1220.   if (sqlObj.whereClause && !sqlObj.whereKeyword)
  1221.   {
  1222.     sqlObj.whereKeyword = SQLStatement.WHERE_KEYWORD;
  1223.   }
  1224. }
  1225. //--------------------------------------------------------------------
  1226. // FUNCTION:
  1227. //   getSimpleOrderByInfo
  1228. //
  1229. // DESCRIPTION:
  1230. //   Returns an object with information about the current order by clause,
  1231. //   if it is based on a single column.
  1232. //   Returns an empty object if the where clause is empty, and null if  
  1233. //   the order by clause is not a single column
  1234. //
  1235. // ARGUMENTS:
  1236. //   none
  1237. //
  1238. // RETURNS:
  1239. //   objcet - 2 parameters: column, direction
  1240. //--------------------------------------------------------------------
  1241. function SBRecordsetPHP_getSimpleOrderByInfo(sqlObj)
  1242. {
  1243.   var retVal = null;
  1244.   var orderByStr = dwscripts.trim(sqlObj.orderByClause);
  1245.   var info = new Object();
  1246.   info.column = "";
  1247.   info.direction = "";
  1248.   if (orderByStr != "" )
  1249.   {
  1250.     // Note: The order of these regexp checks is important. The third regexp matches
  1251.     //   the case where no order (ASC, DESC) is specified; however, it will match  
  1252.     //   the first two cases where an order is specified. When matching these cases,
  1253.     //   it extracts the incorrect value for the column. So, we perform the more  
  1254.     //   specific regexp matches first.
  1255.     if (orderByStr.search(/^\s*([\w\. `]+)\s+asc\s*$/i) != -1)
  1256.     {
  1257.       info.column = RegExp.$1   
  1258.       info.direction = "ASC"
  1259.     }
  1260.     else if (orderByStr.search(/^\s*([\w\. `]+)\s+desc\s*$/i) != -1)
  1261.     {
  1262.       info.column = RegExp.$1   
  1263.       info.direction = "DESC"
  1264.     }
  1265.     else if (orderByStr.search(/^\s*([\w\. `]+)\s*$/i) != -1)
  1266.     {
  1267.       info.column = RegExp.$1   
  1268.       info.direction = "ASC"
  1269.     }
  1270.     else
  1271.     {
  1272.       info = null;
  1273.     }
  1274.    
  1275.     if (info && info.column)
  1276.     {
  1277.       info.column = dwscripts.decodeSQLColumnRef(info.column);
  1278.     }
  1279.    
  1280.     retVal = info;
  1281.    }
  1282.    else
  1283.    {
  1284.     retVal = new Object();
  1285.    }
  1286.    return retVal;
  1287. }
  1288. //--------------------------------------------------------------------
  1289. // FUNCTION:
  1290. //   SBRecordsetPHP.getPageSize
  1291. //
  1292. // DESCRIPTION:
  1293. //   Returns the PageSize currently set for this recordset
  1294. //
  1295. // ARGUMENTS:
  1296. //   none
  1297. //
  1298. // RETURNS:
  1299. //   string
  1300. //--------------------------------------------------------------------
  1301. function SBRecordsetPHP_getPageSize()
  1302. {
  1303.    return this.getParameter(this.EXT_DATA_RR_PAGE_SIZE) ;
  1304. }
  1305. //--------------------------------------------------------------------
  1306. // FUNCTION:
  1307. //   SBRecordsetPHP.setPageSize
  1308. //
  1309. // DESCRIPTION:
  1310. //   Sets the page size for the current recordset.  Passing in 0 will
  1311. //   cause the page size related code to be removed.
  1312. //
  1313. // ARGUMENTS:
  1314. //   pageSize - integer - the page size to use with this recordset, or
  1315. //     0 to remove the page size code.
  1316. //
  1317. // RETURNS:
  1318. //   nothing
  1319. //--------------------------------------------------------------------
  1320. function SBRecordsetPHP_setPageSize(pageSize)
  1321. {
  1322.   pageSize = (pageSize != null) ? pageSize.toString() : "1";
  1323.  
  1324.   if (pageSize == "0" )
  1325.   {
  1326.     pageSize = "";
  1327.   }
  1328.  
  1329.   this.setParameter(this.EXT_DATA_RR_START_RECORD, "0" );
  1330.   this.setParameter(this.EXT_DATA_RR_PAGE_SIZE, pageSize );
  1331. }
  1332. //--------------------------------------------------------------------
  1333. // FUNCTION:
  1334. //   SBRecordsetPHP.setDefaultPageSize
  1335. //
  1336. // DESCRIPTION:
  1337. //   This function is called by SB's which require paging, but do
  1338. //   not have the UI to collect a page size.  This function will
  1339. //   set a valid default value.
  1340. //
  1341. // ARGUMENTS:
  1342. //   none
  1343. //
  1344. // RETURNS:
  1345. //   nothing
  1346. //--------------------------------------------------------------------
  1347. function SBRecordsetPHP_setDefaultPageSize()
  1348. {
  1349.   if (!this.getParameter(this.EXT_DATA_RR_PAGE_SIZE))
  1350.   {
  1351.     // if we have a Repeat Region on the page, set the page size to 10,
  1352.     //  otherwise set it to 1
  1353.     var sbObj = dwscripts.getServerBehaviorByParam("RepeatedRegion.htm","RecordsetName", this.getParameter("RecordsetName" ));
  1354.     if (sbObj)
  1355.     {
  1356.       this.setPageSize(10);
  1357.     }
  1358.     else
  1359.     {
  1360.       this.setPageSize(1);
  1361.     }
  1362.   }
  1363. }
  1364. //--------------------------------------------------------------------
  1365. // FUNCTION:
  1366. //   SBRecordsetPHP.updatePageSize
  1367. //
  1368. // DESCRIPTION:
  1369. //   This function is called when a Server Behavior which depends on
  1370. //   the page size is deleted.  This will check to see if any other  
  1371. //   Server Behaviors depend on the page size, and remove it if no  
  1372. //   dependencies are found.
  1373. //
  1374. // ARGUMENTS:
  1375. //   removedSBObj - Server Behavior object - the object being removed
  1376. //
  1377. // RETURNS:
  1378. //   nothing
  1379. //--------------------------------------------------------------------
  1380. function SBRecordsetPHP_updatePageSize(removedSBObj)
  1381. {
  1382.   if (this.getPageSize())
  1383.   {
  1384.     var rsName = this.getParameter("RecordsetName" );
  1385.    
  1386.     var depFound = false;
  1387.     var allSBs = dw.serverBehaviorInspector.getServerBehaviors();
  1388.     for (var i=0; i < allSBs.length; i++)
  1389.     {
  1390.       if (allSBs[i] != removedSBObj &&
  1391.           allSBs[i].getParameter != null &&
  1392.           allSBs[i].getParameter("NeedsPageSize_" + rsName))
  1393.       {
  1394.         depFound = true;
  1395.         break;
  1396.       }
  1397.     }
  1398.     if (!depFound)
  1399.     {
  1400.       this.setPageSize(0);
  1401.     }
  1402.   }
  1403. }


Message édité par antx le 27-02-2006 à 19:01:04
Reply

Marsh Posté le 27-02-2006 à 17:36:04    

et une petite balise de code nous permetrais de voir les numeros de ligne :D
 
@+


---------------
:Moultiplayers:.:Quatuor Chevalier:.:Admin G15-france.com:.:Wiki -G15-france:.:-Papa-:.
Reply

Marsh Posté le 27-02-2006 à 19:01:36    

Reply

Marsh Posté le 27-02-2006 à 22:46:04    


 
maintenant, je vais pas lire les 1563 lignes du code des fonctions DW pour eventuellement reperer un bug, alors que, un ptit coup de fil au suport technique serais plus approprié !  ;)  
 
@+


---------------
:Moultiplayers:.:Quatuor Chevalier:.:Admin G15-france.com:.:Wiki -G15-france:.:-Papa-:.
Reply

Marsh Posté le 27-02-2006 à 23:42:20    

je n'ai pas encore de license,... :(

Reply

Marsh Posté le 28-02-2006 à 17:26:06    

personne n'aurait une petite solution ?

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed