1. /************************************************************//**
  2. The following function is used to get the offset to the nth
  3. data field in an old-style record.
  4. @return offset to the field */
  5. UNIV_INTERN
  6. ulint
  7. rec_get_nth_field_offs_old(
  8. /*=======================*/
  9. const rec_t* rec, /*!< in: record */
  10. ulint n, /*!< in: index of the field */
  11. ulint* len) /*!< out: length of the field;
  12. UNIV_SQL_NULL if SQL null */
  13. {
  14. ulint os;
  15. ulint next_os;
  16.  
  17. ut_ad(len);
  18. ut_a(rec);
  19. ut_a(n < rec_get_n_fields_old(rec));
  20.  
  21. if (rec_get_1byte_offs_flag(rec)) {
  22. os = rec_1_get_field_start_offs(rec, n);
  23.  
  24. next_os = rec_1_get_field_end_info(rec, n);
  25.  
  26. if (next_os & REC_1BYTE_SQL_NULL_MASK) {
  27. *len = UNIV_SQL_NULL;
  28.  
  29. return(os);
  30. }
  31.  
  32. next_os = next_os & ~REC_1BYTE_SQL_NULL_MASK;
  33. } else {
  34. os = rec_2_get_field_start_offs(rec, n);
  35.  
  36. next_os = rec_2_get_field_end_info(rec, n);
  37.  
  38. if (next_os & REC_2BYTE_SQL_NULL_MASK) {
  39. *len = UNIV_SQL_NULL;
  40.  
  41. return(os);
  42. }
  43.  
  44. next_os = next_os & ~(REC_2BYTE_SQL_NULL_MASK
  45. | REC_2BYTE_EXTERN_MASK);
  46. }
  47.  
  48. *len = next_os - os;
  49.  
  50. ut_ad(*len < UNIV_PAGE_SIZE);
  51.  
  52. return(os);
  53. }
  54.  
  55. /******************************************************//**
  56. Returns the offset of nth field start if the record is stored in the 1-byte
  57. offsets form.
  58. @return offset of the start of the field */
  59. UNIV_INLINE
  60. ulint
  61. rec_1_get_field_start_offs(
  62. /*=======================*/
  63. const rec_t* rec, /*!< in: record */
  64. ulint n) /*!< in: field index */
  65. {
  66. ut_ad(rec_get_1byte_offs_flag(rec));
  67. ut_ad(n <= rec_get_n_fields_old(rec));
  68.  
  69. ) {
  70.  
  71. );
  72. }
  73.  
  74. return(rec_1_get_prev_field_end_info(rec, n)
  75. & ~REC_1BYTE_SQL_NULL_MASK);
  76. }

/******************************************************//**
Returns the offset of n - 1th field end if the record is stored in the 1-byte
offsets form. If the field is SQL null, the flag is ORed in the returned
value. This function and the 2-byte counterpart are defined here because the
C-compiler was not able to sum negative and positive constant offsets, and
warned of constant arithmetic overflow within the compiler.
@return offset of the start of the PREVIOUS field, SQL null flag ORed */
UNIV_INLINE
ulint
rec_1_get_prev_field_end_info(
/*==========================*/
  const rec_t* rec, /*!< in: record */
  ulint n) /*!< in: field index */
  {
    ut_ad(rec_get_1byte_offs_flag(rec));
    ut_ad(n <= rec_get_n_fields_old(rec));

  1.  

  return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n)));
}

  1. /******************************************************//**
  2. Returns the offset of nth field end if the record is stored in the 1-byte
  3. offsets form. If the field is SQL null, the flag is ORed in the returned
  4. value.
  5. @return offset of the start of the field, SQL null flag ORed */
  6. UNIV_INLINE
  7. ulint
  8. rec_1_get_field_end_info(
  9. /*=====================*/
  10. const rec_t* rec, /*!< in: record */
  11. ulint n) /*!< in: field index */
  12. {
  13. ut_ad(rec_get_1byte_offs_flag(rec));
  14. ut_ad(n < rec_get_n_fields_old(rec));
  15.  
  16. )));
  17. }

函数rec_get_nth_field_offs_old的更多相关文章

  1. Python 小而美的函数

    python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况   any any(iterable) ...

  2. 探究javascript对象和数组的异同,及函数变量缓存技巧

    javascript中最经典也最受非议的一句话就是:javascript中一切皆是对象.这篇重点要提到的,就是任何jser都不陌生的Object和Array. 有段时间曾经很诧异,到底两种数据类型用来 ...

  3. JavaScript权威指南 - 函数

    函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...

  4. C++对C的函数拓展

    一,内联函数 1.内联函数的概念 C++中的const常量可以用来代替宏常数的定义,例如:用const int a = 10来替换# define a 10.那么C++中是否有什么解决方案来替代宏代码 ...

  5. 菜鸟Python学习笔记第一天:关于一些函数库的使用

    2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...

  6. javascript中的this与函数讲解

    前言 javascript中没有块级作用域(es6以前),javascript中作用域分为函数作用域和全局作用域.并且,大家可以认为全局作用域其实就是Window函数的函数作用域,我们编写的js代码, ...

  7. 复杂的 Hash 函数组合有意义吗?

    很久以前看到一篇文章,讲某个大网站储存用户口令时,会经过十分复杂的处理.怎么个复杂记不得了,大概就是先 Hash,结果加上一些特殊字符再 Hash,结果再加上些字符.再倒序.再怎么怎么的.再 Hash ...

  8. JS核心系列:浅谈函数的作用域

    一.作用域(scope) 所谓作用域就是:变量在声明它们的函数体以及这个函数体嵌套的任意函数体内都是有定义的. function scope(){ var foo = "global&quo ...

  9. C++中的时间函数

    C++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...

随机推荐

  1. MVC与WebForm的一些区别

    MVC与WebForm的一些区别 它们都是ASP.NET WEB开发的两种方式 .但是他们也是有一些不同.做个小结. 1.MVC是没有服务器端控件这么一说的,也就是没有viewstate,也就不会产生 ...

  2. 一个inline-block的样式。

    <span style="height: 31px; font-family: 宋体; font-weight: bold; color: rgb(160, 64, 0); text- ...

  3. 关于拓扑排序(topologicalsort)

    假设我们有一组任务要完成,并且有些任务要在其它任务完成之后才能开始,所以我们必须非常小心这些任务的执行顺序.如果这些任务的执行顺序足够简单的话,我们可以用链表来存储它们,这是一个很好的方案,让我们可以 ...

  4. IOS 后台运行

    默认情况下,当app被按home键退出后,app仅有最多5秒钟的时候做一些保存或清理资源的工作.但是应用可以调用UIApplication的beginBackgroundTaskWithExpirat ...

  5. 【转】成为it精英,我奋斗7年

    转载地址:http://liangwang985.blog.163.com/blog/static/119549233201191394259491/ 这些日子 我一直在写一个实时操作系统内核,已有小 ...

  6. spoj 138

    离散化  去掉重复点 排序  二分查找 #include<cstdio> #include<cstring> #include<algorithm> #define ...

  7. MariaDB Galera Cluster 部署(如何快速部署MariaDB集群)

    MariaDB Galera Cluster 部署(如何快速部署MariaDB集群) [日期:--] 来源:Linux社区 作者:Linux [字体:大 中 小] MariaDB作为Mysql的一个分 ...

  8. CentOS(RHEL) 操作备忘

    1.安装中文语言包及切换 yum groupinstall chinese-support vi /etc/sysconfig/i18n change en_US to zh_CN 2.用户自动登录 ...

  9. linux sort 命令详解(转 )

    linux sort 命令详解 sort是在Linux里非常常用的一个命令,管排序的,集中精力,五分钟搞定sort,现在开始! 1 sort的工作原理 sort将文件的每一行作为一个单位,相互比较,比 ...

  10. HDU 3038 How Many Answers Are Wrong(带权并查集)

    太坑人了啊,读入数据a,b,s的时候,我刚开始s用的%lld,给我WA. 实在找不到错误啊,后来不知怎么地突然有个想法,改成%I64d,竟然AC了 思路:我建立一个sum数组,设i的父亲为fa,sum ...